From b369aec04a7db6eb959662fe977d9e20840d71d1 Mon Sep 17 00:00:00 2001 From: Anders F Bjorklund Date: Wed, 6 Mar 2013 23:42:41 +0100 Subject: [PATCH 1/9] Fix compatibility with rpm.org (no RPMSENSE_MISSINGOK) --- smart/backends/rpm/header.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/smart/backends/rpm/header.py b/smart/backends/rpm/header.py index 4880f43..0281576 100644 --- a/smart/backends/rpm/header.py +++ b/smart/backends/rpm/header.py @@ -309,7 +309,8 @@ def load(self): # RPMSENSE_SCRIPT_PREUN | # RPMSENSE_SCRIPT_POST | # RPMSENSE_SCRIPT_POSTUN == 7744 - if (f[i]&rpm.RPMSENSE_MISSINGOK): + hint = (f[i]&1 << 19) # RPMSENSE_MISSINGOK + if hint: recdict[(f[i]&7744 and PreReq or Req, intern(ni), r, vi)] = True else: From 87cc91c8c03f9e68cc9ad148893f4824062f36a4 Mon Sep 17 00:00:00 2001 From: Anders F Bjorklund Date: Sat, 30 Mar 2013 18:13:57 +0100 Subject: [PATCH 2/9] Fix compatibility with rpm.org (no rpm.ts.setDFlags) --- smart/backends/rpm/pm.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/smart/backends/rpm/pm.py b/smart/backends/rpm/pm.py index aec82e7..9bbd952 100644 --- a/smart/backends/rpm/pm.py +++ b/smart/backends/rpm/pm.py @@ -106,22 +106,23 @@ def commit(self, changeset, pkgpaths): flags |= rpm.RPMTRANS_FLAG_TEST ts.setFlags(flags) - dflags = ts.setDFlags(0) - if sysconf.get("rpm-noupgrade", False): - dflags |= rpm.RPMDEPS_FLAG_NOUPGRADE - if sysconf.get("rpm-norequires", False): - dflags |= rpm.RPMDEPS_FLAG_NOREQUIRES - if sysconf.get("rpm-noconflicts", False): - dflags |= rpm.RPMDEPS_FLAG_NOCONFLICTS - if sysconf.get("rpm-noobsoletes", False): - dflags |= rpm.RPMDEPS_FLAG_NOOBSOLETES - if sysconf.get("rpm-noparentdirs", False): - dflags |= rpm.RPMDEPS_FLAG_NOPARENTDIRS - if sysconf.get("rpm-nolinktos", False): - dflags |= rpm.RPMDEPS_FLAG_NOLINKTOS - if sysconf.get("rpm-nosuggest", False): - dflags |= rpm.RPMDEPS_FLAG_NOSUGGEST - ts.setDFlags(dflags) + if hasattr(ts, 'setDFlags'): + dflags = ts.setDFlags(0) + if sysconf.get("rpm-noupgrade", False): + dflags |= rpm.RPMDEPS_FLAG_NOUPGRADE + if sysconf.get("rpm-norequires", False): + dflags |= rpm.RPMDEPS_FLAG_NOREQUIRES + if sysconf.get("rpm-noconflicts", False): + dflags |= rpm.RPMDEPS_FLAG_NOCONFLICTS + if sysconf.get("rpm-noobsoletes", False): + dflags |= rpm.RPMDEPS_FLAG_NOOBSOLETES + if sysconf.get("rpm-noparentdirs", False): + dflags |= rpm.RPMDEPS_FLAG_NOPARENTDIRS + if sysconf.get("rpm-nolinktos", False): + dflags |= rpm.RPMDEPS_FLAG_NOLINKTOS + if sysconf.get("rpm-nosuggest", False): + dflags |= rpm.RPMDEPS_FLAG_NOSUGGEST + ts.setDFlags(dflags) # Set rpm verbosity level. levelname = sysconf.get('rpm-log-level') From 20af0aac334acf431b1969eb56acf59bed75472f Mon Sep 17 00:00:00 2001 From: Anders F Bjorklund Date: Sat, 30 Mar 2013 19:07:42 +0100 Subject: [PATCH 3/9] Restore optparse (to Python 2.4.6), subclass instead --- smart/option.py | 80 +++++++++++++++++++++++++++++++++++++++++- smart/util/optparse.py | 61 +++----------------------------- 2 files changed, 83 insertions(+), 58 deletions(-) diff --git a/smart/option.py b/smart/option.py index 326c255..0d35249 100644 --- a/smart/option.py +++ b/smart/option.py @@ -23,12 +23,13 @@ from smart import Error, _ import textwrap import sys, os +import re # NOTICE: The standard optparse module haven't been touched, but since # this code subclasses it and trusts on a specific interface, # an internal copy is being used to avoid future breakage. -__all__ = ["OptionParser", "OptionValueError", "append_all"] +__all__ = ["OptionParser", "OptionValueError", "Values", "Option", "append_all"] try: optparse.STD_HELP_OPTION.help = \ @@ -64,17 +65,94 @@ def format_option(self, option): option.help = help return result +class Values(optparse.Values): + + # Check if the given option has the specified number of arguments + # Raise an error if the option has an invalid number of arguments + # A negative number for 'nargs' means "at least |nargs| arguments are needed" + def check_args_of_option(self, opt, nargs, err=None): + given_opts = getattr(self, "_given_opts", []) + if not opt in given_opts: + return + values = getattr(self, opt, []) + if type(values) != type([]): + return + if nargs < 0: + nargs = -nargs + if len(values) >= nargs: + return + if not err: + if nargs == 1: + err = _("Option '%s' requires at least one argument") % opt + else: + err = _("Option '%s' requires at least %d arguments") % (opt, nargs) + raise Error, err + elif nargs == 0: + if len( values ) == 0: + return + raise Error, err + else: + if len(values) == nargs: + return + if not err: + if nargs == 1: + err = _("Option '%s' requires one argument") % opt + else: + err = _("Option '%s' requires %d arguments") % (opt, nargs) + raise Error, err + + # Check that at least one of the options in 'actlist' was given as an argument + # to the command 'cmdname' + def ensure_action(self, cmdname, actlist): + given_opts = getattr(self, "_given_opts", []) + for action in actlist: + if action in given_opts: + return + raise Error, _("No action specified for command '%s'") % cmdname + + # Check if there are any other arguments left after parsing the command line and + # raise an error if such arguments are found + def check_remaining_args(self): + if self.args: + raise Error, _("Invalid argument(s) '%s'" % str(self.args)) + +class Option(optparse.Option): + + def take_action(self, action, dest, opt, value, values, parser): + # Keep all the options in the command line in the '_given_opts' array + # This will be used later to validate the command line + given_opts = getattr(parser.values, "_given_opts", []) + user_opt = re.sub(r"^\-*", "", opt).replace("-", "_") + given_opts.append(user_opt) + setattr(parser.values, "_given_opts", given_opts) + optparse.Option.take_action(self, action, dest, opt, value, values, parser) + class OptionParser(optparse.OptionParser): def __init__(self, usage=None, help=None, examples=None, skipunknown=False, **kwargs): if not "formatter" in kwargs: kwargs["formatter"] = HelpFormatter() + kwargs["option_class"] = Option optparse.OptionParser.__init__(self, usage, **kwargs) self._override_help = help self._examples = examples self._skipunknown = skipunknown + def get_default_values(self): + if not self.process_default_values: + # Old, pre-Optik 1.5 behaviour. + return Values(self.defaults) + + defaults = self.defaults.copy() + for option in self._get_all_options(): + default = defaults.get(option.dest) + if isinstance(default, basestring): + opt_str = option.get_opt_string() + defaults[option.dest] = option.check_value(opt_str, default) + + return Values(defaults) + def format_help(self, formatter=None): if formatter is None: formatter = self.formatter diff --git a/smart/util/optparse.py b/smart/util/optparse.py index 279b0bf..6fff1bc 100644 --- a/smart/util/optparse.py +++ b/smart/util/optparse.py @@ -70,8 +70,6 @@ import types import textwrap from gettext import gettext as _ -from smart import Error -import re def _repr(self): return "<%s at 0x%x: %s>" % (self.__class__.__name__, id(self), self) @@ -549,8 +547,10 @@ def _set_attrs(self, attrs): else: setattr(self, attr, None) if attrs: + attrs = attrs.keys() + attrs.sort() raise OptionError( - "invalid keyword arguments: %s" % ", ".join(attrs.keys()), + "invalid keyword arguments: %s" % ", ".join(attrs), self) @@ -710,12 +710,6 @@ def process(self, opt, value, values, parser): self.action, self.dest, opt, value, values, parser) def take_action(self, action, dest, opt, value, values, parser): - # Keep all the options in the command line in the '_given_opts' array - # This will be used later to validate the command line - given_opts = getattr(parser.values, "_given_opts", []) - user_opt = re.sub(r"^\-*", "", opt).replace("-", "_") - given_opts.append(user_opt) - setattr(parser.values, "_given_opts", given_opts) if action == "store": setattr(values, dest, value) elif action == "store_const": @@ -827,54 +821,6 @@ def ensure_value(self, attr, value): setattr(self, attr, value) return getattr(self, attr) - # Check if the given option has the specified number of arguments - # Raise an error if the option has an invalid number of arguments - # A negative number for 'nargs' means "at least |nargs| arguments are needed" - def check_args_of_option(self, opt, nargs, err=None): - given_opts = getattr(self, "_given_opts", []) - if not opt in given_opts: - return - values = getattr(self, opt, []) - if type(values) != type([]): - return - if nargs < 0: - nargs = -nargs - if len(values) >= nargs: - return - if not err: - if nargs == 1: - err = _("Option '%s' requires at least one argument") % opt - else: - err = _("Option '%s' requires at least %d arguments") % (opt, nargs) - raise Error, err - elif nargs == 0: - if len( values ) == 0: - return - raise Error, err - else: - if len(values) == nargs: - return - if not err: - if nargs == 1: - err = _("Option '%s' requires one argument") % opt - else: - err = _("Option '%s' requires %d arguments") % (opt, nargs) - raise Error, err - - # Check that at least one of the options in 'actlist' was given as an argument - # to the command 'cmdname' - def ensure_action(self, cmdname, actlist): - given_opts = getattr(self, "_given_opts", []) - for action in actlist: - if action in given_opts: - return - raise Error, _("No action specified for command '%s'") % cmdname - - # Check if there are any other arguments left after parsing the command line and - # raise an error if such arguments are found - def check_remaining_args(self): - if self.args: - raise Error, _("Invalid argument(s) '%s'" % str(self.args)) class OptionContainer: @@ -1612,6 +1558,7 @@ def _match_abbrev(s, wordmap): raise BadOptionError(_("no such option: %s") % s) else: # More than one possible completion: ambiguous prefix. + possibilities.sort() raise BadOptionError(_("ambiguous option: %s (%s?)") % (s, ", ".join(possibilities))) From 68a28b9c334e48a3ed20ea3747a98362d1a015b5 Mon Sep 17 00:00:00 2001 From: Anders F Bjorklund Date: Sat, 30 Mar 2013 19:26:58 +0100 Subject: [PATCH 4/9] Restore the order while handling the hint/missingok --- smart/backends/rpm/metadata.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/smart/backends/rpm/metadata.py b/smart/backends/rpm/metadata.py index 99b28ef..788ce79 100644 --- a/smart/backends/rpm/metadata.py +++ b/smart/backends/rpm/metadata.py @@ -289,16 +289,15 @@ def load(self): lasttag = queue[-1].tag if lasttag == REQUIRES: - if elem.get("missingok") == "1": + if elem.get("pre") == "1": + reqdict[(RPMPreRequires, + ename, erelation, eversion)] = True + elif elem.get("hint") == "1" or elem.get("missingok") == "1": recdict[(RPMRequires, - ename, erelation, eversion)] = True + ename, erelation, eversion)] = True else: - if elem.get("pre") == "1": - reqdict[(RPMPreRequires, - ename, erelation, eversion)] = True - else: - reqdict[(RPMRequires, - ename, erelation, eversion)] = True + reqdict[(RPMRequires, + ename, erelation, eversion)] = True elif lasttag == PROVIDES: if ename[0] == "/": From 4ba7924825e073b15bbbe7b1eb3c59e45756cea8 Mon Sep 17 00:00:00 2001 From: Anders F Bjorklund Date: Sun, 31 Mar 2013 12:13:49 +0200 Subject: [PATCH 5/9] Add suse-recommends to rpm, fix failing test case --- smart/backends/rpm/header.py | 32 +++++++++++++++++++++++++++++++- smart/backends/rpm/metadata.py | 5 +++++ tests/rpmloader.py | 6 +++--- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/smart/backends/rpm/header.py b/smart/backends/rpm/header.py index 0281576..76e922b 100644 --- a/smart/backends/rpm/header.py +++ b/smart/backends/rpm/header.py @@ -319,9 +319,39 @@ def load(self): recargs = collapse_libc_requires(recdict.keys()) reqargs = collapse_libc_requires(reqdict.keys()) else: - recargs = None + recargs = [] reqargs = None + n = h[1156] # RPMTAG_SUGGESTSNAME + if n: + f = h[1158] # RPMTAG_SUGGESTSFLAGS + v = h[1157] # RPMTAG_SUGGESTSVERSION + if f == None: + f = [0] + elif type(f) != list: + f = [f] + recdict = {} + for i in range(len(n)): + ni = n[i] + if ni[:7] not in ("rpmlib(", "config("): + vi = v[i] or None + if vi and vi[:2] == "0:": + vi = vi[2:] + r = CM.get(f[i]&CF) + if not ((r is None or "=" in r) and + (Prv, ni, vi) in prvdict or + system_provides.match(ni, r, vi)): + # RPMSENSE_PREREQ | + # RPMSENSE_SCRIPT_PRE | + # RPMSENSE_SCRIPT_PREUN | + # RPMSENSE_SCRIPT_POST | + # RPMSENSE_SCRIPT_POSTUN == 7744 + strong = (f[i]&1 << 27) # RPMSENSE_STRONG + if strong: + recdict[(f[i]&7744 and PreReq or Req, + intern(ni), r, vi)] = True + recargs.extend(recdict.keys()) + n = h[1054] # RPMTAG_CONFLICTNAME if n: f = h[1053] # RPMTAG_CONFLICTFLAGS diff --git a/smart/backends/rpm/metadata.py b/smart/backends/rpm/metadata.py index 788ce79..f84a4d5 100644 --- a/smart/backends/rpm/metadata.py +++ b/smart/backends/rpm/metadata.py @@ -144,6 +144,7 @@ def load(self): LICENSE = nstag(NS_RPM, "license") ENTRY = nstag(NS_RPM, "entry") REQUIRES = nstag(NS_RPM, "requires") + RECOMMENDS = nstag(NS_RPM, "recommends") PROVIDES = nstag(NS_RPM, "provides") CONFLICTS = nstag(NS_RPM, "conflicts") OBSOLETES = nstag(NS_RPM, "obsoletes") @@ -299,6 +300,10 @@ def load(self): reqdict[(RPMRequires, ename, erelation, eversion)] = True + elif lasttag == RECOMMENDS: + recdict[(RPMRequires, + ename, erelation, eversion)] = True + elif lasttag == PROVIDES: if ename[0] == "/": filedict[ename] = True diff --git a/tests/rpmloader.py b/tests/rpmloader.py index ecc1807..2cbb1df 100644 --- a/tests/rpmloader.py +++ b/tests/rpmloader.py @@ -105,13 +105,13 @@ class RPMPackageVersionTest(MockerTestCase): # RPMTAG_CONFLICTNAME, RPMTAG_OBSOLETENAME, RPMTAG_GROUP header = {1000: "name", 1001: "1.0", 1002: "1", 1003: None, 1022: "noarch", 1106: None, 1155: "unity", 1218: "2011.0", - 1047: [], 1113: [], 1049: [], 1054: [], 1090: [], + 1047: [], 1113: [], 1049: [], 1054: [], 1090: [], 1156: [], rpm.RPMTAG_GROUP: "" } def test_packageVersion_distepoch(self): def getHeaders(prog): return [(self.header, 0)] - def buildPackage(pkgargs, prvargs, reqargs, upgargs, cnfargs): + def buildPackage(pkgargs, prvargs, reqargs, upgargs, cnfargs, recargs): assert(pkgargs[2] == "1.0-1-unity2011.0@noarch") from smart.cache import Package return Package(pkgargs[1], pkgargs[2]) @@ -123,7 +123,7 @@ def buildPackage(pkgargs, prvargs, reqargs, upgargs, cnfargs): def test_packageDepends_distepoch(self): def getHeaders(prog): return [(self.header, 0)] - def buildPackage(pkgargs, prvargs, reqargs, upgargs, cnfargs): + def buildPackage(pkgargs, prvargs, reqargs, upgargs, cnfargs, recargs): assert(upgargs[0][3] == "1.0-1@noarch") from smart.cache import Package return Package(pkgargs[1], pkgargs[2]) From cb21f466411ea9ffff462ee2d707425703c2393c Mon Sep 17 00:00:00 2001 From: Anders F Bjorklund Date: Sun, 31 Mar 2013 20:55:50 +0200 Subject: [PATCH 6/9] Add recommends support for deb packages as well --- smart/backends/deb/loader.py | 12 +++++++++++- tests/aptdeb.txt | 5 +++++ tests/debdir.txt | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/smart/backends/deb/loader.py b/smart/backends/deb/loader.py index 373a186..71549e7 100644 --- a/smart/backends/deb/loader.py +++ b/smart/backends/deb/loader.py @@ -215,6 +215,16 @@ def load(self): upgargs = [(Upg, name, '<', version)] + recargs = [] + value = section.get("recommends") + if value: + for relation in parserelations(value): + if type(relation) is not list: + n, r, v = relation + recargs.append((Req, intern(n), r, v)) + else: + recargs.append((OrReq, tuple(relation))) + cnfargs = [] value = section.get("conflicts") if value: @@ -236,7 +246,7 @@ def load(self): reqargs = newargs pkg = self.buildPackage((Pkg, name, version), - prvargs, reqargs, upgargs, cnfargs) + prvargs, reqargs, upgargs, cnfargs, recargs) pkg.loaders[self] = offset self._sections[pkg] = intern(section.get("section", "")) diff --git a/tests/aptdeb.txt b/tests/aptdeb.txt index 9d9890c..e199a55 100644 --- a/tests/aptdeb.txt +++ b/tests/aptdeb.txt @@ -68,6 +68,11 @@ Let's inspect the package data. >>> [type(x).__name__ for x in sorted(pkg.requires)] ['DebPreRequires', 'DebRequires'] + >>> sorted(pkg.recommends) + [recommendsname1 = recommendsversion1] + >>> [type(x).__name__ for x in sorted(pkg.recommends)] + ['DebRequires'] + >>> sorted(pkg.upgrades) [name1 < version1-release1] >>> [type(x).__name__ for x in sorted(pkg.upgrades)] diff --git a/tests/debdir.txt b/tests/debdir.txt index 9ab625d..86cae45 100644 --- a/tests/debdir.txt +++ b/tests/debdir.txt @@ -67,6 +67,11 @@ Let's inspect the package data. >>> [type(x).__name__ for x in sorted(pkg.requires)] ['DebPreRequires', 'DebRequires'] + >>> sorted(pkg.recommends) + [recommendsname1 = recommendsversion1] + >>> [type(x).__name__ for x in sorted(pkg.recommends)] + ['DebRequires'] + >>> sorted(pkg.upgrades) [name1 < version1-release1] >>> [type(x).__name__ for x in sorted(pkg.upgrades)] From ce926dd86a84b013c569854665bcedb3142290af Mon Sep 17 00:00:00 2001 From: Anders F Bjorklund Date: Sun, 9 Mar 2014 21:32:16 +0100 Subject: [PATCH 7/9] Ignore all but first line of Fink pkg description --- smart/backends/deb/base.py | 2 ++ tests/data/aptdeb/fink-virtual-pkgs | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/smart/backends/deb/base.py b/smart/backends/deb/base.py index 80bb70f..3043ca1 100644 --- a/smart/backends/deb/base.py +++ b/smart/backends/deb/base.py @@ -196,6 +196,8 @@ def __init__(self, path): output = os.popen(path).readlines() for line in output: line = string.rstrip(line) + if line.startswith(' '): + continue keyval = string.split(line, ':', 1) if len(keyval) > 1: val = string.lstrip(keyval[1]) diff --git a/tests/data/aptdeb/fink-virtual-pkgs b/tests/data/aptdeb/fink-virtual-pkgs index 595c5e2..5ea1a72 100755 --- a/tests/data/aptdeb/fink-virtual-pkgs +++ b/tests/data/aptdeb/fink-virtual-pkgs @@ -14,4 +14,18 @@ Version: 10.4.11-1 homepage: http://www.finkproject.org/faq/usage-general.php#virtpackage description: [virtual package representing the system] +Package: macosx +Status: install ok installed +Priority: optional +Architecture: darwin-i386 +Version: 10.6.8-1 +Maintainer: Fink Core Group +Description: [virtual package representing the system] + This package represents the Mac OS X software release. + It will not show as installed on pure Darwin systems. + . + Web site: http://www.finkproject.org/faq/usage-general.php#virtpackage + . + Maintainer: Fink Core Group + __EOF__ From e005aa91f837e0149fc7a95718cf8e8b916dedd9 Mon Sep 17 00:00:00 2001 From: Anders F Bjorklund Date: Sun, 9 Mar 2014 22:53:35 +0100 Subject: [PATCH 8/9] Only use nodigests/nosignatures where available These have been removed in rpm5.org (but not in rpm.org). See http://rpm5.org/cvs/chngview?cn=16659 for the removal. --- smart/plugins/yumchannelsync.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smart/plugins/yumchannelsync.py b/smart/plugins/yumchannelsync.py index 17695d9..f8107e6 100644 --- a/smart/plugins/yumchannelsync.py +++ b/smart/plugins/yumchannelsync.py @@ -56,8 +56,8 @@ def _getreleasever(): rpmroot = sysconf.get("rpm-root", "/") ts = rpmUtils.transaction.initReadOnlyTransaction(root=rpmroot) - #ts.pushVSFlags(~(rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NODIGESTS)) - ts.pushVSFlags(~(rpm._RPMVSF_NODIGESTS)) + if hasattr(rpm, '_RPMVSF_NOSIGNATURES') and hasattr(rpm, '_RPMVSF_NODIGESTS'): + ts.pushVSFlags(~(rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NODIGESTS)) releasever = None # HACK: we're hard-coding the most used distros, will add more if needed idx = ts.dbMatch('provides', 'fedora-release') From 30593ad9dce665f981e934f12d8bd0f93bedcb93 Mon Sep 17 00:00:00 2001 From: Anders F Bjorklund Date: Sun, 9 Mar 2014 22:57:21 +0100 Subject: [PATCH 9/9] Require rpm-check-signatures=true to check sigs The smart default is to skip signature checking, but that doesn't work if rpm has made it mandatory... Require the config to match, rather than silently skipping over parameters in the smart config. (Probably means that it should be set in the distro config, though) Skipping over was added in a58b270532dbc2ed2135a8cf14983e43c25c5612 by simply commenting out the code checking the sysconf settings. --- smart/backends/rpm/base.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/smart/backends/rpm/base.py b/smart/backends/rpm/base.py index 7140c1b..555d9db 100644 --- a/smart/backends/rpm/base.py +++ b/smart/backends/rpm/base.py @@ -63,8 +63,11 @@ def getTS(new=False): if sysconf.get("rpm-dbpath"): rpm.addMacro('_dbpath', "/" + sysconf.get("rpm-dbpath")) getTS.ts = rpm.ts(getTS.root) - #if not sysconf.get("rpm-check-signatures", False): - # getTS.ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) + if not sysconf.get("rpm-check-signatures", False): + if hasattr(rpm, '_RPMVSF_NOSIGNATURES'): + getTS.ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) + else: + raise Error, _("rpm requires checking signatures") rpm_dbpath = sysconf.get("rpm-dbpath", "var/lib/rpm") dbdir = rpm_join_dbpath(getTS.root, rpm_dbpath) if not os.path.isdir(dbdir): @@ -86,8 +89,11 @@ def getTS(new=False): if sysconf.get("rpm-dbpath"): rpm.addMacro('_dbpath', "/" + sysconf.get("rpm-dbpath")) ts = rpm.ts(getTS.root) - #if not sysconf.get("rpm-check-signatures", False): - # ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) + if not sysconf.get("rpm-check-signatures", False): + if hasattr(rpm, '_RPMVSF_NOSIGNATURES'): + ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) + else: + raise Error, _("rpm requires checking signatures") return ts else: return getTS.ts