diff --git a/0013-reposync-add-min-buildtime-YYYY-MM-DD-filter.patch b/0013-reposync-add-min-buildtime-YYYY-MM-DD-filter.patch new file mode 100644 index 0000000..ab7087e --- /dev/null +++ b/0013-reposync-add-min-buildtime-YYYY-MM-DD-filter.patch @@ -0,0 +1,73 @@ +From 1fe0dde973b36edc12798e31a747082818e65e55 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= +Date: Tue, 5 May 2026 19:19:10 +0200 +Subject: [PATCH] reposync: add `--min-buildtime YYYY-MM-DD` filter + +--- + doc/reposync.rst | 3 +++ + plugins/reposync.py | 14 ++++++++++++++ + 2 files changed, 17 insertions(+) + +diff --git a/doc/reposync.rst b/doc/reposync.rst +index ede8901..8eb65df 100644 +--- a/doc/reposync.rst ++++ b/doc/reposync.rst +@@ -83,6 +83,9 @@ All general DNF options are accepted. Namely, the ``--repoid`` option can be use + ``-u, --urls`` + Just print urls of what would be downloaded, don't download. + ++``--min-buildtime `` ++ Download only packages with buildtime newer than YYYY-MM-DD. ++ Note that this option may result in partially synchronized repositories and the missing packages can cause dependency issues. + + -------- + Examples +diff --git a/plugins/reposync.py b/plugins/reposync.py +index 2e23a7e..a11d363 100644 +--- a/plugins/reposync.py ++++ b/plugins/reposync.py +@@ -25,6 +25,8 @@ import hawkey + import os + import shutil + import types ++import argparse ++from datetime import date, datetime + + from dnfpluginscore import _, logger + from dnf.cli.option_parser import OptionParser +@@ -36,6 +38,12 @@ def _pkgdir(intermediate, target): + cwd = dnf.i18n.ucd(os.getcwd()) + return os.path.realpath(os.path.join(cwd, intermediate, target)) + ++def _valid_date(s: str) -> datetime: ++ try: ++ return datetime.strptime(s, "%Y-%m-%d") ++ except ValueError: ++ raise argparse.ArgumentTypeError(f"invalid date: {s!r}") ++ + + class RPMPayloadLocation(dnf.repo.RPMPayload): + def __init__(self, pkg, progress, pkg_location): +@@ -90,6 +98,8 @@ class RepoSyncCommand(dnf.cli.Command): + "don't download")) + parser.add_argument('--safe-write-path', default=None, + help=_("Filesystem path that is considered safe for writing. Defaults to download path.")) ++ parser.add_argument('--min-buildtime', default=None, dest='min_buildtime', metavar='YYYY-MM-DD', ++ type=_valid_date, help=_("download only packages with buildtime newer than YYYY-MM-DD")) + + def configure(self): + demands = self.cli.demands +@@ -301,6 +311,10 @@ class RepoSyncCommand(dnf.cli.Command): + reponame=repo.id) + if self.opts.newest_only: + query = self._get_latest(query) ++ if self.opts.min_buildtime: ++ # recent filter takes number of days ++ days_diff = (date.today() - self.opts.min_buildtime.date()).days ++ query = query._recent(days_diff) + if self.opts.source: + query.filterm(arch='src') + elif self.opts.arches: +-- +2.55.0 + diff --git a/dnf-plugins-core.spec b/dnf-plugins-core.spec index 539aa70..b4e7c8b 100644 --- a/dnf-plugins-core.spec +++ b/dnf-plugins-core.spec @@ -42,7 +42,7 @@ Name: dnf-plugins-core Version: 4.7.0 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Core Plugins for DNF License: GPL-2.0-or-later URL: https://github.com/rpm-software-management/dnf-plugins-core @@ -59,6 +59,7 @@ Patch9: 0009-doc-needs-restarting-uses-UnitsLoadStartTimestamp-bo.patch Patch10: 0010-reposync-Avoid-multiple-downloads-of-duplicate-packa.patch Patch11: 0011-versionlock-Document-that-local-packages-are-not-aff.patch Patch12: 0012-needs-restarting-Don-t-suggest-restarting-NEED_REBOO.patch +Patch13: 0013-reposync-add-min-buildtime-YYYY-MM-DD-filter.patch BuildArch: noarch BuildRequires: cmake @@ -890,6 +891,9 @@ ln -sf %{yum_utils_subpackage_name}.1.gz %{buildroot}%{_mandir}/man1/repotrack.1 %endif %changelog +* Mon Aug 10 2026 Ales Matej - 4.7.0-12 +- reposync: add --min-buildtime YYYY-MM-DD filter (RHEL-236810) + * Wed Jul 15 2026 Marek Blaha - 4.7.0-11 - needs-restarting: Don't suggest restarting NEED_REBOOT services (RHEL-98293)