Unblock libguestfs builds due to regression here
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
This commit is contained in:
parent
1436ff2554
commit
cf55de7358
158
0001-Fix-problems-with-downloaddir-options-RhBug-1476464.patch
Normal file
158
0001-Fix-problems-with-downloaddir-options-RhBug-1476464.patch
Normal file
@ -0,0 +1,158 @@
|
||||
From ab6eb565dc069d827a0b9fe0784ea9339554b010 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Mracek <jmracek@redhat.com>
|
||||
Date: Tue, 1 Aug 2017 10:17:32 +0200
|
||||
Subject: [PATCH] Fix problems with --downloaddir options (RhBug:1476464)
|
||||
|
||||
It will copy all files even from local repository
|
||||
|
||||
It removes permissions change, because it will not work for repos where
|
||||
pkg.location is not only filename but path + filename.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1476464
|
||||
---
|
||||
dnf/base.py | 44 ++++++++++++++++++++++++++++++++------------
|
||||
dnf/cli/cli.py | 35 ++---------------------------------
|
||||
2 files changed, 34 insertions(+), 45 deletions(-)
|
||||
|
||||
diff --git a/dnf/base.py b/dnf/base.py
|
||||
index 4e02d5c6..fa44425d 100644
|
||||
--- a/dnf/base.py
|
||||
+++ b/dnf/base.py
|
||||
@@ -57,6 +57,7 @@ import dnf.transaction
|
||||
import dnf.util
|
||||
import dnf.yum.rpmtrans
|
||||
import functools
|
||||
+import hawkey
|
||||
import itertools
|
||||
import logging
|
||||
import os
|
||||
@@ -1008,8 +1009,7 @@ class Base(object):
|
||||
with lock:
|
||||
drpm = dnf.drpm.DeltaInfo(self.sack.query().installed(),
|
||||
progress, self.conf.deltarpm_percentage)
|
||||
- remote_pkgs = [po for po in pkglist
|
||||
- if not po._is_local_pkg()]
|
||||
+ remote_pkgs = self._select_remote_pkgs(pkglist)
|
||||
self._add_tempfiles([pkg.localPkg() for pkg in remote_pkgs])
|
||||
|
||||
payloads = [dnf.repo._pkg2payload(pkg, progress, drpm.delta_factory,
|
||||
@@ -1081,16 +1081,9 @@ class Base(object):
|
||||
|
||||
if self.conf.destdir:
|
||||
dnf.util.ensure_dir(self.conf.destdir)
|
||||
- for pload in payloads:
|
||||
- payloadlocation = os.path.join(
|
||||
- pload.pkg.repo.pkgdir,
|
||||
- os.path.basename(pload.pkg.location)
|
||||
- )
|
||||
- shutil.copy(payloadlocation, self.conf.destdir)
|
||||
- os.chmod(
|
||||
- os.path.join(self.conf.destdir, os.path.basename(pload.pkg.location)),
|
||||
- 0o755
|
||||
- )
|
||||
+ for pkg in pkglist:
|
||||
+ location = os.path.join(pkg.repo.pkgdir, os.path.basename(pkg.location))
|
||||
+ shutil.copy(location, self.conf.destdir)
|
||||
|
||||
def add_remote_rpms(self, path_list, strict=True):
|
||||
# :api
|
||||
@@ -2235,6 +2228,33 @@ class Base(object):
|
||||
installonly = q.filter(provides=self.conf.installonlypkgs)
|
||||
return installonly
|
||||
|
||||
+ def _select_remote_pkgs(self, install_pkgs):
|
||||
+ """ Check checksum of packages from local repositories and returns list packages from remote
|
||||
+ repositories that will be downloaded. Packages from commandline are skipped.
|
||||
+
|
||||
+ :param install_pkgs: list of packages
|
||||
+ :return: list of remote pkgs
|
||||
+ """
|
||||
+ remote_pkgs = []
|
||||
+ local_repository_pkgs = []
|
||||
+ for pkg in install_pkgs:
|
||||
+ if pkg._is_local_pkg():
|
||||
+ if pkg.reponame != hawkey.CMDLINE_REPO_NAME:
|
||||
+ local_repository_pkgs.append(pkg)
|
||||
+ else:
|
||||
+ remote_pkgs.append(pkg)
|
||||
+ error = False
|
||||
+ for pkg in local_repository_pkgs:
|
||||
+ if not pkg.verifyLocalPkg():
|
||||
+ msg = _("Package {} from local repository {} has incorrect checksum").format(
|
||||
+ pkg, pkg.reponame)
|
||||
+ logger.critical(msg)
|
||||
+ error = True
|
||||
+ if error:
|
||||
+ raise dnf.exceptions.Error(
|
||||
+ _("Some packages from local repository have incorrect checksum"))
|
||||
+ return remote_pkgs
|
||||
+
|
||||
|
||||
def _msg_installed(pkg):
|
||||
name = ucd(pkg)
|
||||
diff --git a/dnf/cli/cli.py b/dnf/cli/cli.py
|
||||
index 00b2a425..6b6ad987 100644
|
||||
--- a/dnf/cli/cli.py
|
||||
+++ b/dnf/cli/cli.py
|
||||
@@ -70,7 +70,6 @@ import logging
|
||||
import operator
|
||||
import os
|
||||
import random
|
||||
-import re
|
||||
import sys
|
||||
import time
|
||||
|
||||
@@ -214,14 +213,11 @@ class BaseCli(dnf.Base):
|
||||
return
|
||||
|
||||
if trans:
|
||||
- remote_pkgs = self.select_remote_pkgs(install_pkgs)
|
||||
-
|
||||
- if remote_pkgs:
|
||||
+ if install_pkgs:
|
||||
logger.info(_('Downloading Packages:'))
|
||||
try:
|
||||
total_cb = self.output.download_callback_total_cb
|
||||
- self.download_packages(remote_pkgs, self.output.progress,
|
||||
- total_cb)
|
||||
+ self.download_packages(install_pkgs, self.output.progress, total_cb)
|
||||
except dnf.exceptions.DownloadError as e:
|
||||
specific = dnf.cli.format.indent_block(ucd(e))
|
||||
errstr = _('Error downloading packages:') + '\n%s' % specific
|
||||
@@ -246,33 +242,6 @@ class BaseCli(dnf.Base):
|
||||
if tsi.op_type == dnf.transaction.FAIL:
|
||||
raise dnf.exceptions.Error(_('Transaction failed'))
|
||||
|
||||
- def select_remote_pkgs(self, install_pkgs):
|
||||
- """ Check checksum of packages from local repositories and returns list packages from remote
|
||||
- repositories that will be downloaded. Packages from commandline are skipped.
|
||||
-
|
||||
- :param install_pkgs: list of packages
|
||||
- :return: list of remote pkgs
|
||||
- """
|
||||
- remote_pkgs = []
|
||||
- local_repository_pkgs = []
|
||||
- for pkg in install_pkgs:
|
||||
- if pkg._is_local_pkg():
|
||||
- if pkg.reponame != hawkey.CMDLINE_REPO_NAME:
|
||||
- local_repository_pkgs.append(pkg)
|
||||
- else:
|
||||
- remote_pkgs.append(pkg)
|
||||
- error = False
|
||||
- for pkg in local_repository_pkgs:
|
||||
- if not pkg.verifyLocalPkg():
|
||||
- msg = _("Package {} from local repository {} has incorrect checksum").format(
|
||||
- str(pkg), pkg.reponame)
|
||||
- logger.critical(msg)
|
||||
- error = True
|
||||
- if error:
|
||||
- raise dnf.exceptions.Error(
|
||||
- _("Some packages from local repository have incorrect checksum"))
|
||||
- return remote_pkgs
|
||||
-
|
||||
def gpgsigcheck(self, pkgs):
|
||||
"""Perform GPG signature verification on the given packages,
|
||||
installing keys if possible.
|
||||
--
|
||||
2.13.3
|
||||
|
7
dnf.spec
7
dnf.spec
@ -25,7 +25,7 @@
|
||||
|
||||
Name: dnf
|
||||
Version: 2.6.2
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: Package manager forked from Yum, using libsolv as a dependency resolver
|
||||
# For a breakdown of the licensing, see PACKAGE-LICENSING
|
||||
License: GPLv2+ and GPLv2 and GPL
|
||||
@ -34,6 +34,8 @@ URL: https://github.com/rpm-software-management/dnf
|
||||
# cd dnf
|
||||
# tito build --tgz --tag=dnf-2.5.1-1
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1476464
|
||||
Patch0001: 0001-Fix-problems-with-downloaddir-options-RhBug-1476464.patch
|
||||
BuildArch: noarch
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gettext
|
||||
@ -331,6 +333,9 @@ popd
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Aug 01 2017 Igor Gnatenko <ignatenko@redhat.com> - 2.6.2-3
|
||||
- Unblock libguestfs builds due to regression here
|
||||
|
||||
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.2-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user