From 6516b460ad03ddad2bf89adccaae823ea8e08bb6 Mon Sep 17 00:00:00 2001 From: Jaroslav Rohel Date: Fri, 19 May 2023 09:43:10 +0200 Subject: [PATCH] Remove patch: "reposync: Implement --safe-write-path option" Resolves: rhbz#2208444 --- ...nt-safe-write-path-opt-RhBug-1898089.patch | 97 ------------------- dnf-plugins-core.spec | 6 +- 2 files changed, 4 insertions(+), 99 deletions(-) delete mode 100644 0033-reposync-Implement-safe-write-path-opt-RhBug-1898089.patch diff --git a/0033-reposync-Implement-safe-write-path-opt-RhBug-1898089.patch b/0033-reposync-Implement-safe-write-path-opt-RhBug-1898089.patch deleted file mode 100644 index 5ce26f6..0000000 --- a/0033-reposync-Implement-safe-write-path-opt-RhBug-1898089.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 632ab7751b42d3bf27a59f3ff9c572afb3ac3cd4 Mon Sep 17 00:00:00 2001 -From: Marek Blaha -Date: Wed, 6 Oct 2021 16:43:10 +0200 -Subject: [PATCH] reposync: Implement --safe-write-path option (RhBug:1898089) - -By default reposync is not allowed to write files outside of repository -download path (by default ./). But there are some repositories -that store packages using relative parent paths (e.g. -../packages-store/f/foo.rpm). -This patch introduces new --safe-write-path option that can override -this limitation and set a root directory that is considered safe for -writing. -For example `dnf reposync --repoid=the_repo --safe-write-path=.` will -allow reposync to write files not only to `./the_repo` directory but -also to current working directory itself. - -= changelog = -msg: With --safe-write-path option reposync can download repositories with relative package locations (like ../package-store/f/foo.rpm) -type: enhancement -resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1898089 ---- - doc/reposync.rst | 3 +++ - plugins/reposync.py | 27 ++++++++++++++++++++------- - 2 files changed, 23 insertions(+), 7 deletions(-) - -diff --git a/doc/reposync.rst b/doc/reposync.rst -index bbf714c..ede8901 100644 ---- a/doc/reposync.rst -+++ b/doc/reposync.rst -@@ -71,6 +71,9 @@ All general DNF options are accepted. Namely, the ``--repoid`` option can be use - ``-p , --download-path=`` - Root path under which the downloaded repositories are stored, relative to the current working directory. Defaults to the current working directory. Every downloaded repository has a subdirectory named after its ID under this path. - -+``--safe-write-path`` -+ Specify the filesystem path prefix under which the reposync is allowed to write. If not specified it defaults to download path of the repository. Useful for repositories that use relative locations of packages out of repository directory (e.g. "../packages_store/foo.rpm"). Use with care, any file under the ``safe-write-path`` can be overwritten. Can be only used when syncing a single repository. -+ - ``--remote-time`` - Try to set the timestamps of the downloaded files to those on the remote side. - -diff --git a/plugins/reposync.py b/plugins/reposync.py -index 0ff936f..63d8e98 100644 ---- a/plugins/reposync.py -+++ b/plugins/reposync.py -@@ -88,6 +88,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('--safe-write-path', default=None, -+ help=_("Filesystem path that is considered safe for writing. Defaults to download path.")) - - def configure(self): - demands = self.cli.demands -@@ -108,9 +110,16 @@ class RepoSyncCommand(dnf.cli.Command): - if self.opts.source: - repos.enable_source_repos() - -- if len(list(repos.iter_enabled())) > 1 and self.opts.norepopath: -- raise dnf.cli.CliError( -- _("Can't use --norepopath with multiple repositories")) -+ if self.opts.safe_write_path is not None: -+ self.opts.safe_write_path = os.path.realpath(self.opts.safe_write_path) -+ -+ if len(list(repos.iter_enabled())) > 1: -+ if self.opts.norepopath: -+ raise dnf.cli.CliError( -+ _("Can't use --norepopath with multiple repositories")) -+ elif self.opts.safe_write_path is not None: -+ raise dnf.cli.CliError( -+ _("Can't use --safe-write-path with multiple repositories")) - - for repo in repos.iter_enabled(): - repo._repo.expire() -@@ -188,13 +197,17 @@ class RepoSyncCommand(dnf.cli.Command): - repo_target = self.repo_target(pkg.repo) - pkg_download_path = os.path.realpath( - os.path.join(repo_target, pkg.location)) -- # join() ensures repo_target ends with a path separator (otherwise the -+ -+ # join() ensures safe_write_path ends with a path separator (otherwise the - # check would pass if pkg_download_path was a "sibling" path component - # of repo_target that has the same prefix). -- if not pkg_download_path.startswith(os.path.join(repo_target, '')): -+ safe_write_path = os.path.join(self.opts.safe_write_path or repo_target, '') -+ -+ if not pkg_download_path.startswith(safe_write_path): - raise dnf.exceptions.Error( -- _("Download target '{}' is outside of download path '{}'.").format( -- pkg_download_path, repo_target)) -+ _("Download target '{0}' for location '{1}' of '{2}' package " -+ "is outside of safe write path '{3}'.").format( -+ pkg_download_path, pkg.location, pkg.name, safe_write_path)) - return pkg_download_path - - def delete_old_local_packages(self, repo, pkglist): --- -libgit2 1.3.2 - diff --git a/dnf-plugins-core.spec b/dnf-plugins-core.spec index 36e8603..a4c24dd 100644 --- a/dnf-plugins-core.spec +++ b/dnf-plugins-core.spec @@ -34,7 +34,7 @@ Name: dnf-plugins-core Version: 4.0.21 -Release: 20%{?dist} +Release: 21%{?dist} Summary: Core Plugins for DNF License: GPLv2+ URL: https://github.com/rpm-software-management/dnf-plugins-core @@ -71,7 +71,6 @@ Patch29: 0029-Update-translations.patch Patch30: 0030-versionlock-Use-only-most-specif-NEVRA-RhBug-1961217.patch Patch31: 0031-Fix-boot-time-derivation-for-systems-with-no-rtc.patch Patch32: 0032-Doc-update-for-reposync-RhBug-2132383-2182004.patch -Patch33: 0033-reposync-Implement-safe-write-path-opt-RhBug-1898089.patch BuildArch: noarch @@ -848,6 +847,9 @@ ln -sf %{_mandir}/man1/%{yum_utils_subpackage_name}.1.gz %{buildroot}%{_mandir}/ %endif %changelog +* Fri May 19 2023 Jaroslav Rohel - 4.0.21-21 +- Remove patch: "reposync: Implement --safe-write-path option (RhBug:1898089,2203766)" (RhBug:2208444) + * Wed May 17 2023 Jaroslav Rohel - 4.0.21-20 - versionlock: Use only the most specific NEVRA (RhBug:1961217) - Fix boot time derivation for systems with no rtc (RhBug:2166444,2182157)