Compare commits

...

5 Commits
master ... f25

Author SHA1 Message Date
Jaroslav Mracek 37646c3254 Add new API add_new_repo in RepoDict (RhBug:1427132) 2017-03-15 09:41:14 +01:00
Igor Gnatenko 8d0dadc6ef fix patch
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2017-01-17 16:45:16 +01:00
Igor Gnatenko baead5f166 Prefer obsoletes (RHBZ #1096506)
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2017-01-17 16:41:23 +01:00
Igor Gnatenko da682e0ebb Backport upstream fix for dnf.Repo.repofile
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2016-12-02 16:52:18 +01:00
Richard W.M. Jones fa731a51db Backport support for riscv64 architecture.
https://github.com/rpm-software-management/dnf/pull/623
d84aee9c5a
2016-10-16 19:48:44 +01:00
5 changed files with 221 additions and 2 deletions

View File

@ -0,0 +1,26 @@
From 70ff5de1944b1375e528ef8867a1764f3ce38962 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 28 Sep 2016 21:53:43 +0100
Subject: [PATCH] Add RISC-V architectures.
---
dnf/rpm/__init__.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dnf/rpm/__init__.py b/dnf/rpm/__init__.py
index 91385f2..5f34cc0 100644
--- a/dnf/rpm/__init__.py
+++ b/dnf/rpm/__init__.py
@@ -78,6 +78,9 @@ _BASEARCH_MAP = _invert({
'ppc': ('ppc',),
'ppc64': ('ppc64', 'ppc64iseries', 'ppc64p7', 'ppc64pseries'),
'ppc64le': ('ppc64le',),
+ 'riscv32' : ('riscv32',),
+ 'riscv64' : ('riscv64',),
+ 'riscv128' : ('riscv128',),
's390': ('s390',),
's390x': ('s390x',),
'sh3': ('sh3',),
--
2.7.4

View File

@ -0,0 +1,102 @@
From efc5f9c5ae36935d05c51419d53e09ededcf0efe Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Mon, 13 Mar 2017 08:35:30 +0100
Subject: [PATCH] Add new API add_new_repo() in RepoDict() (RhBug:1427132)
It allows to initialize new repo object and add it into RepoDict.
https://bugzilla.redhat.com/show_bug.cgi?id=1427132
---
dnf/repodict.py | 25 +++++++++++++++++++++++++
dnf/util.py | 3 +++
doc/api_repos.rst | 7 +++++++
3 files changed, 35 insertions(+)
diff --git a/dnf/repodict.py b/dnf/repodict.py
index d1c1904..33739d2 100644
--- a/dnf/repodict.py
+++ b/dnf/repodict.py
@@ -20,9 +20,13 @@
from __future__ import unicode_literals
from dnf.exceptions import ConfigError
+from dnf.i18n import _
+
import dnf.util
import fnmatch
+import os
+logger = dnf.util.logger
class RepoDict(dict):
# :api
@@ -44,6 +48,27 @@ class RepoDict(dict):
def any_enabled(self):
return not dnf.util.empty(self.iter_enabled())
+ def add_new_repo(self, repoid, conf, baseurl=(), **kwargs):
+ # :api
+ """
+ Creates new repo object and add it into RepoDict.
+ :param repoid: Repo ID - string
+ :param conf: dnf Base().conf object
+ :param baseurl: List of strings
+ :param kwargs: keys and values that will be used to setattr on dnf.repo.Repo() object
+ :return: dnf.repo.Repo() object
+ """
+ repo = dnf.repo.Repo(repoid, conf.cachedir)
+ for path in baseurl:
+ if '://' not in path:
+ path = 'file://{}'.format(os.path.abspath(path))
+ repo.baseurl.append(path)
+ for (key, value) in kwargs.items():
+ setattr(repo, key, value)
+ self.add(repo)
+ logger.info(_("Added %s repo from %s"), repoid, ', '.join(baseurl))
+ return repo
+
def enabled(self):
return [r for r in self.values() if r.enabled]
diff --git a/dnf/util.py b/dnf/util.py
index b35aba5..c196958 100644
--- a/dnf/util.py
+++ b/dnf/util.py
@@ -29,6 +29,7 @@ import dnf.const
import dnf.pycomp
import itertools
import librepo
+import logging
import os
import pwd
import shutil
@@ -37,6 +38,8 @@ import sys
import tempfile
import time
+logger = logging.getLogger('dnf')
+
"""DNF Utilities.
Generally these are not a part of the public DNF API.
diff --git a/doc/api_repos.rst b/doc/api_repos.rst
index 96e10ac..295c330 100644
--- a/doc/api_repos.rst
+++ b/doc/api_repos.rst
@@ -46,6 +46,13 @@ Repository Configuration
Return an iterator over all enabled repos from the dict.
+ .. method:: add_new_repo(repoid, conf, baseurl=(), **kwargs)
+
+ Initialize new :class:`.Repo` object and add it to the repodict. It requires ``repoid``
+ (string), and :class:`dnf.conf.Conf` object. Optionally it can be speciffied baseurl (list), and
+ additionally key/value pairs from `kwargs` to set additional attribute of the :class:`.Repo`
+ object. It returns the :class:`.Repo` object.
+
.. module:: dnf.repo
.. function:: repo_id_invalid(repo_id)
--
2.9.3

View File

@ -0,0 +1,25 @@
From fba7ae2890ddc725fdad3fd092278e36dd029a83 Mon Sep 17 00:00:00 2001
From: Pavel Studenik <pstudeni@redhat.com>
Date: Fri, 2 Dec 2016 14:59:39 +0100
Subject: [PATCH] 'SpacewalkRepo' object has no attribute 'repofile'
(RhBug:1395737)
---
dnf/repo.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/dnf/repo.py b/dnf/repo.py
index 5956206..ed9af43 100644
--- a/dnf/repo.py
+++ b/dnf/repo.py
@@ -467,6 +467,7 @@ class Repo(dnf.yum.config.RepoConf):
self.name = self.id
self.key_import = _NullKeyImport()
self.metadata = None # :api
+ self.repofile = None # :api
self.sync_strategy = self.DEFAULT_SYNC
self.substitutions = dnf.conf.substitutions.Substitutions()
self.max_mirror_tries = 0 # try them all
--
2.10.2

View File

@ -0,0 +1,46 @@
From 4838eeb486df7bce075da97ea1233935b6688a2e Mon Sep 17 00:00:00 2001
From: Jan Silhan <jsilhan@redhat.com>
Date: Mon, 13 Jun 2016 23:05:44 +0200
Subject: [PATCH] subject: prefer obsoletes (RhBug:1096506)(RhBug:1332830)
DNF makes better selection of packages considering obsoletes from
'pkg_spec' input when `multilib_policy` is set to `best`
(by Subject.set_best_selector()). Moreover the selection of packages
is evaluated during resolution so when the obsoleting package has
broken dependencies the next best choose is picked (RhBug:1096506)
Subject.get_best_selector searches by provides first (RhBug:1332830)
while prioritizing obsoletes and then packages with the same name as a
provide.
Closes: #609
Approved by: j-mracek
---
dnf/subject.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/dnf/subject.py b/dnf/subject.py
index ea7a0e57..a1b3fbf4 100644
--- a/dnf/subject.py
+++ b/dnf/subject.py
@@ -123,9 +123,14 @@ class Subject(object):
nevra = first(self.subj.nevra_possibilities_real(sack, **kwargs))
if nevra:
sltr = dnf.selector.Selector(sack)
- s = self._nevra_to_selector(sltr, nevra)
- if len(s.matches()) > 0:
- return s
+ if nevra._has_just_name():
+ s = sltr.set(provides=nevra.name)
+ if len(s.matches()) > 0:
+ return s
+ else:
+ s = self._nevra_to_selector(sltr, nevra)
+ if len(s.matches()) > 0:
+ return s
reldep = first(self.subj.reldep_possibilities_real(sack))
if reldep:
--
2.11.0

View File

@ -1,4 +1,4 @@
%global hawkey_min_ver 0.6.1
%global hawkey_min_ver 0.6.3-6.1
%global hawkey_max_ver 0.7.0
%global librepo_version 1.7.16
%global libcomps_version 0.1.6
@ -25,7 +25,7 @@
Name: dnf
Version: 1.1.10
Release: 2%{?dist}
Release: 6%{?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
@ -33,6 +33,14 @@ URL: https://github.com/rpm-software-management/dnf
Source0: %{url}/archive/%{name}-%{version}-1.tar.gz
# https://github.com/rpm-software-management/dnf/commit/61df26328ed819e4f220760a98ce31529c4ec609
Patch0001: 0001-cli-repolist-fix-showing-repository-name-with-disabl.patch
# https://github.com/rpm-software-management/dnf/pull/623
# https://github.com/rpm-software-management/dnf/commit/d84aee9c5a6f4249e7418865a1bb24aed194e659
Patch0002: 0001-Add-RISC-V-architectures.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1401041
# https://github.com/rpm-software-management/dnf/commit/fba7ae2890ddc725fdad3fd092278e36dd029a83
Patch0003: 0001-SpacewalkRepo-object-has-no-attribute-repofile-RhBug.patch
Patch0004: 0001-subject-prefer-obsoletes-RhBug-1096506-RhBug-1332830.patch
Patch0005: 0001-Add-new-API-add_new_repo-in-RepoDict-RhBug-1427132.patch
BuildArch: noarch
BuildRequires: cmake
BuildRequires: gettext
@ -336,6 +344,18 @@ exit 0
%endif
%changelog
* Wed Mar 15 2017 Jaroslav Mracek <jmracek@redhat.com> - 1.1.10-6
- Add new API add_new_repo in RepoDict (RhBug:1427132)
* Tue Jan 17 2017 Igor Gnatenko <ignatenko@redhat.com> - 1.1.10-5
- Prefer obsoletes (RHBZ #1096506)
* Fri Dec 02 2016 Igor Gnatenko <ignatenko@redhat.com> - 1.1.10-4
- Backport upstream fix for dnf.Repo.repofile
* Sun Oct 16 2016 Richard W.M. Jones <rjones@redhat.com> - 1.1.10-3
- Backport upstream support for the RISC-V architectures.
* Thu Sep 08 2016 Igor Gnatenko <ignatenko@redhat.com> - 1.1.10-2
- Obsolete dnf-langpacks
- Backport patch for dnf repolist disabled