reposync: add --min-buildtime YYYY-MM-DD filter
Resolves: RHEL-119475
This commit is contained in:
parent
5fa0ac4ef4
commit
7c99b7cc65
73
0028-reposync-add-min-buildtime-YYYY-MM-DD-filter.patch
Normal file
73
0028-reposync-add-min-buildtime-YYYY-MM-DD-filter.patch
Normal file
@ -0,0 +1,73 @@
|
||||
From 9541ca6bff37c749c9a28834bb9e4c863e678b30 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
|
||||
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 bbf714c..bfead12 100644
|
||||
--- a/doc/reposync.rst
|
||||
+++ b/doc/reposync.rst
|
||||
@@ -80,6 +80,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 <YYYY-MM-DD>``
|
||||
+ 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 19f5440..19613be 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):
|
||||
@@ -88,6 +96,8 @@ class RepoSyncCommand(dnf.cli.Command):
|
||||
parser.add_argument('-u', '--urls', default=False, action='store_true',
|
||||
help=_("Just list urls of what would be downloaded, "
|
||||
"don't download"))
|
||||
+ 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
|
||||
@@ -288,6 +298,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
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
|
||||
Name: dnf-plugins-core
|
||||
Version: 4.3.0
|
||||
Release: 26%{?dist}
|
||||
Release: 27%{?dist}
|
||||
Summary: Core Plugins for DNF
|
||||
License: GPLv2+
|
||||
URL: https://github.com/rpm-software-management/dnf-plugins-core
|
||||
@ -63,6 +63,7 @@ Patch24: 0024-multisig-Do-not-parse-OpenPGP-keys.patch
|
||||
Patch25: 0025-multisig-Rename-dnf4-multisig-8-manual-page-to-dnf-m.patch
|
||||
Patch26: 0026-versionlock-Document-that-local-packages-are-not-aff.patch
|
||||
Patch27: 0027-multisig-Ignore-untrusted-signatures-if-there-is-tru.patch
|
||||
Patch28: 0028-reposync-add-min-buildtime-YYYY-MM-DD-filter.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: cmake >= 3.14
|
||||
@ -829,6 +830,9 @@ ln -sf %{_mandir}/man1/%{yum_utils_subpackage_name}.1.gz %{buildroot}%{_mandir}/
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Aug 11 2026 Ales Matej <amatej@redhat.com> - 4.3.0-27
|
||||
- reposync: add --min-buildtime YYYY-MM-DD filter (RHEL-119475)
|
||||
|
||||
* Wed Feb 11 2026 Petr Pisar <ppisar@redhat.com> - 4.3.0-26
|
||||
- Multisig: ignore untrusted signatures if there is trusted one (RHEL-145372)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user