From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id BC28F158018 for ; Sat, 2 Oct 2021 20:52:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 13E00E08F6; Sat, 2 Oct 2021 20:52:45 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id EEAACE08F6 for ; Sat, 2 Oct 2021 20:52:44 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id EF01D342C0C for ; Sat, 2 Oct 2021 20:52:43 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2A26EBE for ; Sat, 2 Oct 2021 20:52:42 +0000 (UTC) From: "Magnus Granberg" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Magnus Granberg" Message-ID: <1633207999.9a4cbee8916bebb51ad771a8e05e675b3b3a68b7.zorry@gentoo> Subject: [gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/steps/ X-VCS-Repository: proj/tinderbox-cluster X-VCS-Files: buildbot_gentoo_ci/steps/repos.py X-VCS-Directories: buildbot_gentoo_ci/steps/ X-VCS-Committer: zorry X-VCS-Committer-Name: Magnus Granberg X-VCS-Revision: 9a4cbee8916bebb51ad771a8e05e675b3b3a68b7 X-VCS-Branch: master Date: Sat, 2 Oct 2021 20:52:42 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: dd282392-f141-4cab-b2f5-c3197e1b7639 X-Archives-Hash: 3b47cc1f3b7f3cede709ddb3b5a67eb3 commit: 9a4cbee8916bebb51ad771a8e05e675b3b3a68b7 Author: Magnus Granberg gentoo org> AuthorDate: Sat Oct 2 20:53:19 2021 +0000 Commit: Magnus Granberg gentoo org> CommitDate: Sat Oct 2 20:53:19 2021 +0000 URL: https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=9a4cbee8 Use gitpython instead of pygit2 Signed-off-by: Magnus Granberg gentoo.org> buildbot_gentoo_ci/steps/repos.py | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/buildbot_gentoo_ci/steps/repos.py b/buildbot_gentoo_ci/steps/repos.py index 5b6b621..a2d46ce 100644 --- a/buildbot_gentoo_ci/steps/repos.py +++ b/buildbot_gentoo_ci/steps/repos.py @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 import os -import pygit2 +import git from twisted.internet import defer @@ -104,20 +104,31 @@ class CheckRepository(BuildStep): @defer.inlineCallbacks def checkRepos(self, repository_data): + success = False repository_path = yield os.path.join(self.getProperty("repository_basedir"), repository_data['name']) - repo_path = yield pygit2.discover_repository(repository_path) - print(repo_path) - if repo_path is None: - yield pygit2.clone_repository(repository_data['url'], repository_path) - success = True + try: + repo = git.Repo(repository_path) + except: + try: + yield git.Repo.clone_from(repository_data['url'], repository_path) + except: + pass + else: + repo = git.Repo(repository_path) + success = True else: - repo = yield pygit2.Repository(repo_path) - commit = repo.get(repo.head.target) - success = yield self.gitPull(repo) - print(commit.hex) - print(commit.commit_time) + try: + yield repo.git.pull() + except: + pass + else: + success = True + if success: + headcommit = repo.head.commit + print(headcommit.hexsha) + print(headcommit.committed_date) # chmod needed for ebuilds metadata portage.GetAuxMetadata step - yield self.setchmod(repository_path) + # yield self.setchmod(repository_path) return success @defer.inlineCallbacks @@ -140,8 +151,6 @@ class CheckRepository(BuildStep): if Poller_data['updated_at'] > self.getProperty("commit_time"): return SKIPPED success = yield self.checkRepos(repository_data) - if success is None: - return SKIPPED if not success: return FAILURE if repository_data['type'] == 'gitpuller':