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 6485C1382C5 for ; Sat, 20 Mar 2021 13:42:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BF55AE0839; Sat, 20 Mar 2021 13:42:23 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 97A69E0839 for ; Sat, 20 Mar 2021 13:42:23 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6C0A2340A12 for ; Sat, 20 Mar 2021 13:42:22 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CFC5B5C5 for ; Sat, 20 Mar 2021 13:42:20 +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: <1616247702.c852e4cb0089da63776d0b5939eadd1180da7080.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/update_db.py X-VCS-Directories: buildbot_gentoo_ci/steps/ X-VCS-Committer: zorry X-VCS-Committer-Name: Magnus Granberg X-VCS-Revision: c852e4cb0089da63776d0b5939eadd1180da7080 X-VCS-Branch: master Date: Sat, 20 Mar 2021 13:42:20 +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: 4a09bbc8-8ae4-4365-958b-71eb62039a58 X-Archives-Hash: 17827443c4b42537fb1989d3fdb24766 commit: c852e4cb0089da63776d0b5939eadd1180da7080 Author: Magnus Granberg gentoo org> AuthorDate: Sat Mar 20 13:41:42 2021 +0000 Commit: Magnus Granberg gentoo org> CommitDate: Sat Mar 20 13:41:42 2021 +0000 URL: https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=c852e4cb Fix gitpull back to origin Signed-off-by: Magnus Granberg gentoo.org> buildbot_gentoo_ci/steps/update_db.py | 45 +++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/buildbot_gentoo_ci/steps/update_db.py b/buildbot_gentoo_ci/steps/update_db.py index bfcd2ef..d35a967 100644 --- a/buildbot_gentoo_ci/steps/update_db.py +++ b/buildbot_gentoo_ci/steps/update_db.py @@ -65,7 +65,7 @@ class CheckPath(BuildStep): def run(self): self.gentooci = self.master.namedServices['services'].namedServices['gentooci'] self.repository_basedir = self.gentooci.config.project['repository_basedir'] - self.portage_path = 'portage' + self.portage_path = yield os.path.join('etc', 'portage') self.profile_path = yield os.path.join(self.portage_path, 'make.profile') self.repos_path = yield os.path.join(self.portage_path, 'repos.conf') print(os.getcwd()) @@ -74,10 +74,11 @@ class CheckPath(BuildStep): success = True print(os.getcwd()) for x in [ - self.profile_path, - self.repos_path, - self.repository_basedir - ]: + self.portage_path, + self.profile_path, + self.repos_path, + self.repository_basedir + ]: if not os.path.isdir(x): os.makedirs(x) return SUCCESS @@ -96,48 +97,52 @@ class UpdateRepos(BuildStep): # Origin: https://github.com/MichaelBoselowitz/pygit2-examples/blob/master/examples.py#L54 # Modifyed by Gentoo Authors. - @defer.inlineCallbacks def gitPull(self, repo, remote_name='origin', branch='master'): for remote in repo.remotes: if remote.name == remote_name: - yield remote.fetch() - remote_master_id = yield repo.lookup_reference('refs/remotes/origin/%s' % (branch)).target - merge_result, _ = yield repo.merge_analysis(remote_master_id) + remote.fetch() + remote_master_id = repo.lookup_reference('refs/remotes/origin/%s' % (branch)).target + print(remote_master_id) + merge_result, _ = repo.merge_analysis(remote_master_id) + print(merge_result) # Up to date, do nothing if merge_result & pygit2.GIT_MERGE_ANALYSIS_UP_TO_DATE: + print('UP_TO_DATE') return # We can just fastforward elif merge_result & pygit2.GIT_MERGE_ANALYSIS_FASTFORWARD: - yield repo.checkout_tree(repo.get(remote_master_id)) + print('FASTFORWARD') + repo.checkout_tree(repo.get(remote_master_id)) try: - master_ref = yield repo.lookup_reference('refs/heads/%s' % (branch)) - yield master_ref.set_target(remote_master_id) + master_ref = repo.lookup_reference('refs/heads/%s' % (branch)) + master_ref.set_target(remote_master_id) except KeyError: - yield repo.create_branch(branch, repo.get(remote_master_id)) - yield repo.head.set_target(remote_master_id) + repo.create_branch(branch, repo.get(remote_master_id)) + repo.head.set_target(remote_master_id) elif merge_result & pygit2.GIT_MERGE_ANALYSIS_NORMAL: - yield repo.merge(remote_master_id) - + print('NORMAL') + repo.merge(remote_master_id) if repo.index.conflicts is not None: for conflict in repo.index.conflicts: print('Conflicts found in:', conflict[0].path) raise AssertionError('Conflicts, ahhhhh!!') - user = yield repo.default_signature - tree = yield repo.index.write_tree() - commit = yield repo.create_commit('HEAD', + user = repo.default_signature + tree = repo.index.write_tree() + commit = repo.create_commit('HEAD', user, user, 'Merge!', tree, [repo.head.target, remote_master_id]) # We need to do this or git CLI will think we are still merging. - yield repo.state_cleanup() + repo.state_cleanup() else: raise AssertionError('Unknown merge analysis result') @defer.inlineCallbacks def run(self): + #FIXME check HEAD agenst local and worker local tree so we don't gitpull evrytime self.gentooci = self.master.namedServices['services'].namedServices['gentooci'] self.repository_basedir = self.gentooci.config.project['repository_basedir'] self.profile_repository_path = yield os.path.join(self.repository_basedir, self.getProperty("profile_repository_data")['name'])