public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpkg] 1.70-1: Backport patch to move inheritance check to a method
@ 2026-08-10 21:43
0 siblings, 0 replies; only message in thread
From: @ 2026-08-10 21:43 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/rpkg
Branch : 1.70-1
Commit : 37c0ec7ecf3f9393396d755dcbe92874da1a5984
Author : Lubomír Sedlář <lsedlar@redhat.com>
Date : 2017-02-01T08:37:01+01:00
Stats : +136/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpkg/c/37c0ec7ecf3f9393396d755dcbe92874da1a5984?branch=1.70-1
Log:
Backport patch to move inheritance check to a method
---
diff --git a/0001-Move-tag-inheritance-check-into-a-separate-method.patch b/0001-Move-tag-inheritance-check-into-a-separate-method.patch
new file mode 100644
index 0000000..337cf68
--- /dev/null
+++ b/0001-Move-tag-inheritance-check-into-a-separate-method.patch
@@ -0,0 +1,129 @@
+From 5d25a9186842c0a67fea3557dfda571f8eceef4f Mon Sep 17 00:00:00 2001
+From: Chenxiong Qi <cqi@redhat.com>
+Date: Tue, 10 Jan 2017 15:28:34 +0800
+Subject: [PATCH] Move tag inheritance check into a separate method
+
+Tag inheritance check may not be required by all downstream package
+tools built on top of rpkg. Moving this check into a separate method
+would be easy for downstream tools to customize the behavior. By
+default, tag inheritance check happens when doing a chain build. Once
+some tool does not need the check, it can be disabled in derived
+Commands class.
+
+Signed-off-by: Chenxiong Qi <cqi@redhat.com>
+---
+ CHANGELOG.rst | 5 +++++
+ pyrpkg/__init__.py | 19 ++++++++++---------
+ tests/test_commands.py | 37 +++++++++++++++++++++++++++++++++++++
+ 3 files changed, 52 insertions(+), 9 deletions(-)
+
+diff --git a/CHANGELOG.rst b/CHANGELOG.rst
+index 3b0031c..b25a4db 100644
+--- a/CHANGELOG.rst
++++ b/CHANGELOG.rst
+@@ -1,6 +1,11 @@
+ ChangeLog
+ =========
+
++NEXT
++----
++
++- Move tag inheritance check into a separate method (cqi)
++
+ v1.48 (2016-12-22)
+ ------------------
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 61907a2..61039f3 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -1822,6 +1822,14 @@ class Commands(object):
+ if self.repo.git.rev_list('%s...%s' % (merge, branch)):
+ raise rpkgError('There are unpushed changes in your repo')
+
++ def check_inheritance(self, build_target, dest_tag):
++ """Check if build tag inherits from dest tag"""
++ ancestors = self.kojisession.getFullInheritance(build_target['build_tag'])
++ ancestors = [ancestor['parent_id'] for ancestor in ancestors]
++ if dest_tag['id'] not in [build_target['build_tag']] + ancestors:
++ raise rpkgError('Packages in destination tag %(dest_tag_name)s are not inherited by'
++ ' build tag %(build_tag_name)s' % build_target)
++
+ def build(self, skip_tag=False, scratch=False, background=False,
+ url=None, chain=None, arches=None, sets=False, nvr_check=True):
+ """Initiate a build of the module. Available options are:
+@@ -1876,17 +1884,10 @@ class Commands(object):
+ % build_target['dest_tag_name'])
+ if dest_tag['locked'] and not scratch:
+ raise rpkgError('Destination tag %s is locked' % dest_tag['name'])
+- # If we're chain building, make sure inheritance works
+ if chain:
+ cmd.append('chain-build')
+- ancestors = self.kojisession.getFullInheritance(
+- build_target['build_tag'])
+- ancestors = [ancestor['parent_id'] for ancestor in ancestors]
+- if dest_tag['id'] not in [build_target['build_tag']] + ancestors:
+- raise rpkgError('Packages in destination tag '
+- '%(dest_tag_name)s are not inherited by'
+- 'build tag %(build_tag_name)s' %
+- build_target)
++ # We're chain building, make sure inheritance works
++ self.check_inheritance(build_target, dest_tag)
+ else:
+ cmd.append('build')
+ # define our dictionary for options
+diff --git a/tests/test_commands.py b/tests/test_commands.py
+index 0d08eb1..9765d6d 100644
+--- a/tests/test_commands.py
++++ b/tests/test_commands.py
+@@ -7,6 +7,7 @@ import tempfile
+ import git
+ import rpm
+ from mock import patch
++from mock import Mock
+
+ from pyrpkg import rpkgError
+
+@@ -504,3 +505,39 @@ class TestGetLatestCommit(CommandTestCase):
+ self.assertEqual(str(git.Repo(self.repo_path).iter_commits().next()),
+ cmd.get_latest_commit(os.path.basename(self.repo_path),
+ 'eng-rhel-6'))
++
++
++def load_kojisession(self):
++ self._kojisession = Mock()
++ self._kojisession.getFullInheritance.return_value = [
++ {'child_id': 342, 'currdepth': 1, 'filter': [], 'intransitive': False,
++ 'maxdepth': None, 'name': 'f25-override', 'nextdepth': None, 'noconfig': False,
++ 'parent_id': 341, 'pkg_filter': '', 'priority': 0},
++ {'child_id': 341, 'currdepth': 2, 'filter': [], 'intransitive': False,
++ 'maxdepth': None, 'name': 'f25-updates', 'nextdepth': None, 'noconfig': False,
++ 'parent_id': 336, 'pkg_filter': '', 'priority': 0},
++ {'child_id': 336, 'currdepth': 3, 'filter': [], 'intransitive': False,
++ 'maxdepth': None, 'name': 'f25', 'nextdepth': None, 'noconfig': False,
++ 'parent_id': 335, 'pkg_filter': '', 'priority': 0},
++ ]
++
++
++class TestTagInheritanceTag(CommandTestCase):
++
++ @patch('pyrpkg.Commands.load_kojisession', new=load_kojisession)
++ def test_error_if_not_inherit(self):
++ build_target = {
++ 'build_tag': 342, 'build_tag_name': 'f25-build',
++ 'dest_tag': 337, 'dest_tag_name': 'f25-updates-candidate',
++ 'id': 167, 'name': 'f25-candidate',
++ }
++ dest_tag = {
++ 'arches': None, 'extra': {},
++ 'id': 337, 'locked': False,
++ 'maven_include_all': False, 'maven_support': False,
++ 'name': 'f25-updates-candidate',
++ 'perm': None, 'perm_id': None,
++ }
++
++ cmd = self.make_commands()
++ self.assertRaises(rpkgError, cmd.check_inheritance, build_target, dest_tag)
+--
+2.9.3
+
diff --git a/rpkg.spec b/rpkg.spec
index 40e50df..849d54b 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -3,13 +3,15 @@
Name: rpkg
Version: 1.48
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Utility for interacting with rpm+git packaging systems
Group: Applications/System
License: GPLv2+ and LGPLv2
URL: https://pagure.io/rpkg
Source0: https://pagure.io/releases/rpkg/rpkg-%{version}.tar.gz
+# Backported from git; drop for next upstream release
+Patch0: 0001-Move-tag-inheritance-check-into-a-separate-method.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: pyrpkg >= %{version}-%{release}
@@ -62,6 +64,7 @@ A python library for managing RPM package sources in a git repository.
%prep
%setup -q
+%patch0 -p1
%build
@@ -96,6 +99,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Wed Feb 1 2017 Lubomír Sedlář <lsedlar@redhat.com> - 1.48-2
+- Backport patch to move tag inheritance check to separate method
+
* Thu Dec 22 2016 Chenxiong Qi <cqi@redhat.com> - 1.48-1
- Better message when fail to authenticate via Kerberos - #180 (cqi)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-10 21:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10 21:43 [rpms/rpkg] 1.70-1: Backport patch to move inheritance check to a method
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox