public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpkg] 1.70-1: Some patches
@ 2026-08-10 21:44 
  0 siblings, 0 replies; 2+ messages in thread
From:  @ 2026-08-10 21:44 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/rpkg
            Branch : 1.70-1
            Commit : fbeaedc842e4e6f3f0c2547d4afa36bd29a30bbb
            Author : Ondřej Nosek <onosek@redhat.com>
            Date   : 2021-12-01T00:45:43+00:00
            Stats  : +132/-1 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/rpkg/c/fbeaedc842e4e6f3f0c2547d4afa36bd29a30bbb?branch=1.70-1

            Log:
            Some patches

- Continue execution if specfile parsing fails
- Consider Patch tags in specfile parser

Signed-off-by: Ondřej Nosek <onosek@redhat.com>

---
diff --git a/0006-Consider-Patch-tags-in-specfile-parser.patch b/0006-Consider-Patch-tags-in-specfile-parser.patch
new file mode 100644
index 0000000..6b045cb
--- /dev/null
+++ b/0006-Consider-Patch-tags-in-specfile-parser.patch
@@ -0,0 +1,67 @@
+From bb12945220cc99e8797bb1ced74cdc0e7efb4df0 Mon Sep 17 00:00:00 2001
+From: Otto Urpelainen <oturpe@iki.fi>
+Date: Tue, 5 Oct 2021 08:50:28 +0300
+Subject: [PATCH] Consider Patch tags in specfile parser
+
+Patch files can be uploaded to the lookaside cache and referred
+to by Patch tags in the specfile.
+The specfile parser did not consider this case, leading to an error
+if a dist-git repo has such confiration. Fixed by parsing
+the patch tags.
+
+Resolves rhbz#2010518
+
+Signed-off-by: Otto Urpelainen <oturpe@iki.fi>
+---
+ pyrpkg/spec.py     |  5 +++--
+ tests/test_spec.py | 11 ++++++++---
+ 2 files changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/pyrpkg/spec.py b/pyrpkg/spec.py
+index a276120..bd862f1 100644
+--- a/pyrpkg/spec.py
++++ b/pyrpkg/spec.py
+@@ -14,8 +14,9 @@ from pyrpkg.errors import rpkgError
+ 
+ class SpecFile(object):
+     """Simple specfile parser that finds source file names"""
+-
+-    sourcefile_expression = re.compile(r'^source[0-9]*:\s*(?P<val>.*)\s*$', re.IGNORECASE)
++    sourcefile_expression = re.compile(
++        r'^((source[0-9]*|patch[0-9]*):\s*(?P<val>.*))\s*$',
++        re.IGNORECASE)
+ 
+     def __init__(self, spec, sourcedir):
+         self.spec = spec
+diff --git a/tests/test_spec.py b/tests/test_spec.py
+index 196b470..eefc475 100644
+--- a/tests/test_spec.py
++++ b/tests/test_spec.py
+@@ -36,8 +36,11 @@ class SpecFileTestCase(unittest.TestCase):
+         spec_fd.write(
+             "Source0: https://example.com/tarball.tar.gz\n"
+             "Source1: https://example.com/subdir/LICENSE.txt\n"
+-            "Source2: https://another.domain.com/source.tar.gz\n"
+-            "Source3: local.txt\n")
++            "source2: https://another.domain.com/source.tar.gz\n"
++            "SOURCE3: local.txt\n"
++            "\n"
++            "patch0: local.patch\n"
++            "PAtch999: https://remote.patch-sourcce.org/another-patch.bz2\n")
+         spec_fd.close()
+ 
+         s = spec.SpecFile(self.specfile, self.workdir)
+@@ -46,7 +49,9 @@ class SpecFileTestCase(unittest.TestCase):
+             "tarball.tar.gz",
+             "LICENSE.txt",
+             "source.tar.gz",
+-            "local.txt"]
++            "local.txt",
++            "local.patch",
++            "another-patch.bz2"]
+         self.assertEqual(len(actual), len(expected))
+         self.assertTrue(all([a == b for a, b in zip(actual, expected)]))
+ 
+-- 
+2.31.1
+

diff --git a/0007-Continue-execution-if-specfile-parsing-fails.patch b/0007-Continue-execution-if-specfile-parsing-fails.patch
new file mode 100644
index 0000000..4e84bb1
--- /dev/null
+++ b/0007-Continue-execution-if-specfile-parsing-fails.patch
@@ -0,0 +1,58 @@
+From 7ede78fc7b8fae2e78c700f39eb68df1696e107f Mon Sep 17 00:00:00 2001
+From: Otto Urpelainen <oturpe@iki.fi>
+Date: Tue, 12 Oct 2021 20:48:43 +0300
+Subject: [PATCH] Continue execution if specfile parsing fails
+
+The unused sources detection feature implemented by class SpecFile
+is simply an optimization to avoid downloading unused sources.
+The parsing is quite different from other steps performed by rpkg,
+which also meant it can fail in new ways.
+To avoid situations where an error in this optimization step prevents
+usage that would otherwise succeed, this commit changes handling
+of such errors from exiting to logging the situation and continuing
+with the assumption that all sources in the sources file may
+be needed.
+
+Resolves: #583
+JIRA: RHELCMP-7087
+Merges: https://pagure.io/rpkg/pull-request/581
+
+Signed-off-by: Otto Urpelainen <oturpe@iki.fi>
+---
+ pyrpkg/__init__.py | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 23bca5b..2edcb09 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -2042,8 +2042,15 @@ class Commands(object):
+             outdir = self.path
+ 
+         sourcesf = SourcesFile(self.sources_filename, self.source_entry_type)
+-        specf = SpecFile(os.path.join(self.layout.specdir, self.spec),
+-                         self.layout.sourcedir)
++
++        try:
++            specf = SpecFile(os.path.join(self.layout.specdir, self.spec),
++                             self.layout.sourcedir)
++            spec_parsed = True
++        except Exception:
++            self.log.warn("Parsing specfile for used sources failed. "
++                          "Falling back to downloading all sources.")
++            spec_parsed = False
+ 
+         args = dict()
+         if self.lookaside_request_params:
+@@ -2062,7 +2069,7 @@ class Commands(object):
+                     "Error: Attempting a download '{0}' that would override a git tracked file. "
+                     "Either remove the corresponding line from 'sources' file to keep the git "
+                     "tracked one or 'git rm' the file to allow the download.".format(outfile))
+-            if (entry.file not in specf.sources):
++            if (spec_parsed and entry.file not in specf.sources):
+                 self.log.info("Not downloading unused %s" % entry.file)
+                 continue
+             self.lookasidecache.download(
+-- 
+2.31.1
+

diff --git a/rpkg.spec b/rpkg.spec
index 11d1df9..d24ac7f 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -1,6 +1,6 @@
 Name:           rpkg
 Version:        1.63
-Release:        4%{?dist}
+Release:        5%{?dist}
 
 Summary:        Python library for interacting with rpm+git
 License:        GPLv2+ and LGPLv2
@@ -22,6 +22,8 @@ Patch2:         0002-Use-six-library-in-tests.patch
 Patch3:         0003-Pass-sourcedir-to-rpmspec-when-specfile-is-parsed.patch
 Patch4:         0004-Print-SpecFile-parsing-debug-info.patch
 Patch5:         0005-Fixes-import-fail-with-sources-already-imported.patch
+Patch6:         0006-Consider-Patch-tags-in-specfile-parser.patch
+Patch7:         0007-Continue-execution-if-specfile-parsing-fails.patch
 
 # RHEL7 is currently the only release that is built for Python 2.
 %if 0%{?fedora} || 0%{?rhel} > 7
@@ -245,6 +247,10 @@ example_cli_dir=$RPM_BUILD_ROOT%{_datadir}/%{name}/examples/cli
 
 
 %changelog
+* Wed Dec 01 2021 Ondřej Nosek <onosek@redhat.com> - 1.63-5
+- Patch: Continue execution if specfile parsing fails
+- Patch: Consider Patch tags in specfile parser
+
 * Mon Nov 29 2021 Ondřej Nosek <onosek@redhat.com> - 1.63-4
 - Patch: Fixes import fail with sources already imported
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [rpms/rpkg] 1.70-1: Some patches
@ 2026-08-10 21:44 
  0 siblings, 0 replies; 2+ messages in thread
From:  @ 2026-08-10 21:44 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/rpkg
            Branch : 1.70-1
            Commit : e6213fcfa3ba1fc76757d10a4941e102345c29e1
            Author : Ondřej Nosek <onosek@redhat.com>
            Date   : 2020-01-02T13:33:50+00:00
            Stats  : +218/-1 in 5 file(s)
            URL    : https://src.fedoraproject.org/rpms/rpkg/c/e6213fcfa3ba1fc76757d10a4941e102345c29e1?branch=1.70-1

            Log:
            Some patches

- Propagate module_hotfixes to getMockConfig
- Don't expect module build tasks to have "rpms"
- RPM 4.15 changed header - type conversion
- Create stats for module builds in 'init' state

Signed-off-by: Ondřej Nosek <onosek@redhat.com>

---
diff --git a/0008-Propagate-module_hotfixes-to-getMockConfig.patch b/0008-Propagate-module_hotfixes-to-getMockConfig.patch
new file mode 100644
index 0000000..10f0aca
--- /dev/null
+++ b/0008-Propagate-module_hotfixes-to-getMockConfig.patch
@@ -0,0 +1,62 @@
+From cf8d67db902203d18e86378632e22454deb960b4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
+Date: Mon, 16 Dec 2019 16:10:46 +0100
+Subject: [PATCH] Propagate module_hotfixes to getMockConfig
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The Koji cli does this, and any wrapper tool should too to generate the
+same output.
+
+Resolves: rhbz#1780228
+Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
+---
+ pyrpkg/__init__.py | 2 ++
+ tests/test_cli.py  | 3 ++-
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 7fbc6c2..2dddad7 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -2646,6 +2646,7 @@ class Commands(object):
+             build_target["build_tag_name"]
+         )
+         package_manager = build_config.get("extra", {}).get("mock.package_manager")
++        module_hotfixes = build_config.get("extra", {}).get("mock.yum.module_hotfixes")
+ 
+         # Generate the config
+         config = koji.genMockConfig(
+@@ -2656,6 +2657,7 @@ class Commands(object):
+             repoid=repoid,
+             topurl=self.topurl,
+             package_manager=package_manager,
++            module_hotfixes=module_hotfixes,
+         )
+ 
+         # Return the mess
+diff --git a/tests/test_cli.py b/tests/test_cli.py
+index bc9745f..d80243d 100644
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -1724,7 +1724,7 @@ class TestMockConfig(CliTestCase):
+         self.kojisession.getBuildTarget.return_value = self.fake_build_target
+         self.kojisession.getRepo.return_value = self.fake_repo
+         self.kojisession.getBuildConfig.return_value = {
+-            "extra": {"mock.package_manager": "dnf"}
++            "extra": {"mock.package_manager": "dnf", "mock.yum.module_hotfixes": 1}
+         }
+ 
+     def tearDown(self):
+@@ -1751,6 +1751,7 @@ class TestMockConfig(CliTestCase):
+             repoid=self.fake_repo['id'],
+             topurl='http://localhost/hub',
+             package_manager="dnf",
++            module_hotfixes=1,
+         )
+ 
+         mock_config = stdout.getvalue().strip()
+-- 
+2.21.0
+

diff --git a/0009-Don-t-expect-module-build-tasks-to-have-rpms.patch b/0009-Don-t-expect-module-build-tasks-to-have-rpms.patch
new file mode 100644
index 0000000..9f7c0a2
--- /dev/null
+++ b/0009-Don-t-expect-module-build-tasks-to-have-rpms.patch
@@ -0,0 +1,45 @@
+From 02affb458224f39eb4593cfba8dead8d2faa5084 Mon Sep 17 00:00:00 2001
+From: Mariana Ulaieva <mulaieva@redhat.com>
+Date: Mon, 16 Dec 2019 14:07:04 +0100
+Subject: [PATCH] Don't expect module build tasks to have "rpms"
+
+There are module builds, which won't build any components.There are
+module builds, which won't build any components. These module builds
+won't have an "rpms" key in "tasks".
+
+Expect this to happen and don't fail when watching module builds of
+this kind.
+
+Merges: https://pagure.io/rpkg/pull-request/476
+
+Signed-off-by: Mariana Ulaieva <mulaieva@redhat.com>
+---
+ pyrpkg/__init__.py | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 2dddad7..3271a03 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -3795,7 +3795,8 @@ class Commands(object):
+                 continue
+             stats[stats_key_mapping[task_state]] = n
+         stats['completion_percentage'] = \
+-            int(float(stats['done'] + stats['failed']) / stats['total'] * 100)
++            int(float(stats['done'] + stats['failed']) / stats['total'] * 100) \
++            if stats['total'] > 0 else 100  # to avoid zero division when there were no task_infos
+         return stats
+ 
+     def get_watched_module_builds(self, build_ids):
+@@ -3823,7 +3824,7 @@ class Commands(object):
+                 # with -1 so that None does not impact the comparison for
+                 # sort.
+                 formatted_tasks = []
+-                for pkg_name, task_info in module_build['tasks']['rpms'].items():
++                for pkg_name, task_info in module_build['tasks'].get('rpms', {}).items():
+                     new_task_info = task_info.copy()
+                     new_task_info['package_name'] = pkg_name
+                     if new_task_info['state'] is None:
+-- 
+2.21.0
+

diff --git a/0010-RPM-4.15-changed-header-returns-from-type-bytes-to-s.patch b/0010-RPM-4.15-changed-header-returns-from-type-bytes-to-s.patch
new file mode 100644
index 0000000..64e9553
--- /dev/null
+++ b/0010-RPM-4.15-changed-header-returns-from-type-bytes-to-s.patch
@@ -0,0 +1,48 @@
+From fdc40f7be78e120f6b880d352cc916f39d36477f Mon Sep 17 00:00:00 2001
+From: Merlin Mathesius <mmathesi@redhat.com>
+Date: Thu, 19 Dec 2019 07:48:20 -0600
+Subject: [PATCH] RPM 4.15 changed header returns from type 'bytes' to
+ 'string'. Handle either by converting to 'string' if necessary.
+
+Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
+---
+ pyrpkg/cli.py | 16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
+index a26e1be..6ae3d37 100644
+--- a/pyrpkg/cli.py
++++ b/pyrpkg/cli.py
+@@ -1683,6 +1683,20 @@ class cliClient(object):
+             contain RPM data.
+         :rtype: str
+         """
++
++        def _string(s):
++            """RPM 4.15 changed header returns from type 'bytes' to 'string'.
++            Handle either by always returning 'string'.
++
++            :param s: a 'bytes' or 'string' value representing an RPM
++                package header.
++            :return: always a 'string' representation of the RPM header.
++            :rtype: str
++            """
++            if isinstance(s, bytes):
++                return s.decode('utf-8')
++            return s
++
+         ts = rpm.TransactionSet()
+         ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES)
+         fdno = os.open(rpm_file, os.O_RDONLY)
+@@ -1691,7 +1705,7 @@ class cliClient(object):
+         except rpm.error:
+             return None
+         os.close(fdno)
+-        return hdr[rpm.RPMTAG_NAME].decode('utf-8')
++        return _string(hdr[rpm.RPMTAG_NAME])
+ 
+     def _handle_srpm_option(self):
+         """Generate SRPM according to --srpm option value and upload it
+-- 
+2.21.0
+

diff --git a/0011-Create-stats-for-module-builds-in-init-state.patch b/0011-Create-stats-for-module-builds-in-init-state.patch
new file mode 100644
index 0000000..152d286
--- /dev/null
+++ b/0011-Create-stats-for-module-builds-in-init-state.patch
@@ -0,0 +1,51 @@
+From 5cce3d5957afd757fb4b4cebacb6d7f72510d78d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Hunor=20Csomort=C3=A1ni?= <csomh@redhat.com>
+Date: Tue, 17 Dec 2019 10:40:46 +0100
+Subject: [PATCH] Create stats for module builds in 'init' state
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When watching builds, the dictionary to track module build progress was
+not populated with tracking information due to an early 'continue'
+statement.
+
+This caused watching builds fail when builds transitioned from 'init' to
+'build' state between two watch cycles, with:
+
+    Could not execute module_build: 'tasks_stats'
+
+This happened when building modules without any components and starting
+the watch as soon as the build was submitted.
+
+Treating 'init' as any other state solves this issue, as the 'build'
+branch in 'module_watch_build()' will find tracking information
+pre-populated.
+
+This is safe to do since 02affb4: we won't fail on an empty 'tasks'
+dictionary.
+
+Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
+
+Merges: https://pagure.io/rpkg/pull-request/478
+---
+ pyrpkg/__init__.py | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 3271a03..7236563 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -3812,9 +3812,6 @@ class Commands(object):
+                 module_build['link'] = \
+                     self.module_get_url(module_build['id']).split('?')[0]
+ 
+-                if module_build['state_name'] == 'init':
+-                    continue
+-
+                 # tasks/rpms is a mapping from package name to package info,
+                 # e.g. {'pkg': {'nvr': ..., 'task_id': ..., 'state': ...}}
+                 # The injected task info will look like:
+-- 
+2.21.0
+

diff --git a/rpkg.spec b/rpkg.spec
index 8bc3e2c..6c53a29 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -1,6 +1,6 @@
 Name:           rpkg
 Version:        1.59
-Release:        4%{?dist}
+Release:        5%{?dist}
 
 Summary:        Python library for interacting with rpm+git
 License:        GPLv2+ and LGPLv2
@@ -24,6 +24,10 @@ Patch4:         0004-tests-add-container-build-isolated-test.patch
 Patch5:         0005-container-build-add-koji-parent-build-argument.patch
 Patch6:         0006-Isolated-container-build-should-allow-arches-overrid.patch
 Patch7:         0007-Use-a-single-thread-pool-while-watching-module-build.patch
+Patch8:         0008-Propagate-module_hotfixes-to-getMockConfig.patch
+Patch9:         0009-Don-t-expect-module-build-tasks-to-have-rpms.patch
+Patch10:        0010-RPM-4.15-changed-header-returns-from-type-bytes-to-s.patch
+Patch11:        0011-Create-stats-for-module-builds-in-init-state.patch
 
 %if 0%{?fedora} || 0%{?rhel} > 7
 # Enable python3 build by default
@@ -277,6 +281,13 @@ nosetests tests
 
 
 %changelog
+* Thu Jan 02 2020 Ondřej Nosek <onosek@redhat.com> - 1.59-5
+- Some patches:
+- Propagate module_hotfixes to getMockConfig
+- Don't expect module build tasks to have "rpms"
+- RPM 4.15 changed header - type conversion
+- Create stats for module builds in 'init' state
+
 * Tue Dec 03 2019 Ondřej Nosek <onosek@redhat.com> - 1.59-4
 - Patch: limited thread pool for watching module builds
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-10 21:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10 21:44 [rpms/rpkg] 1.70-1: Some patches 
  -- strict thread matches above, loose matches on Subject: below --
2026-08-10 21:44 

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox