diff options
Diffstat (limited to 'meta/recipes-devtools/python/python-smartpm')
16 files changed, 0 insertions, 2374 deletions
diff --git a/meta/recipes-devtools/python/python-smartpm/smart-channelsdir.patch b/meta/recipes-devtools/python/python-smartpm/smart-channelsdir.patch deleted file mode 100644 index e621b33875..0000000000 --- a/meta/recipes-devtools/python/python-smartpm/smart-channelsdir.patch +++ /dev/null @@ -1,24 +0,0 @@ -Make CHANNELSDIR in smart empty, since this causes host contamination issues -on some RPM-based hosts on which smart is already installed. - -[YOCTO #3881] - -Upstream-Status: Inappropriate [embedded specific] - -diff --git a/smart/plugins/channelsync.py b/smart/plugins/channelsync.py -index 3ba95ff..646d696 100644 ---- a/smart/plugins/channelsync.py -+++ b/smart/plugins/channelsync.py -@@ -23,7 +23,11 @@ from smart.channel import * - from smart import * - import os - --CHANNELSDIR = "/etc/smart/channels/" -+# For now, we leave the definition of CHANNELSDIR empty. This prevents smart -+# from erroneously consider the build host's channels while setting up its -+# channels [YOCTO #3881]. If this feature will be used in the future, CHANNELSDIR -+# should be set to a proper value. -+CHANNELSDIR = "" - - def syncChannels(channelsdir, force=None): - diff --git a/meta/recipes-devtools/python/python-smartpm/smart-config-ignore-all-recommends.patch b/meta/recipes-devtools/python/python-smartpm/smart-config-ignore-all-recommends.patch deleted file mode 100644 index df9d7799e8..0000000000 --- a/meta/recipes-devtools/python/python-smartpm/smart-config-ignore-all-recommends.patch +++ /dev/null @@ -1,24 +0,0 @@ -Add a simple method to disable the install of recommended packages - -Upstream-Status: Pending - -Usage: - smart config --set ignore-all-recommends=1 - -Signed-off-by: Mark Hatle <mark.hatle@windriver.com> - -Index: smart-1.4.1/smart/transaction.py -=================================================================== ---- smart-1.4.1.orig/smart/transaction.py -+++ smart-1.4.1/smart/transaction.py -@@ -611,7 +611,9 @@ class Transaction(object): - for prv in req.providedby: - for prvpkg in prv.packages: - if not reqrequired: -- if pkgconf.testFlag("ignore-recommends", prvpkg): -+ if sysconf.get("ignore-all-recommends", 0) == 1: -+ continue -+ elif pkgconf.testFlag("ignore-recommends", prvpkg): - continue - if isinst(prvpkg): - found = True diff --git a/meta/recipes-devtools/python/python-smartpm/smart-conflict-provider.patch b/meta/recipes-devtools/python/python-smartpm/smart-conflict-provider.patch deleted file mode 100644 index 10a7447cb4..0000000000 --- a/meta/recipes-devtools/python/python-smartpm/smart-conflict-provider.patch +++ /dev/null @@ -1,196 +0,0 @@ -Report a reason when a dependency could not be installed because it is locked - -If a requirement of a package is conflicted, depending on how the -solution is reached, the transaction code may eliminate all providers -of the requirement and then error out because nothing provides them. To -work around this, store a reason in the locked dict and report that back -if we need to, so for example instead of: - - error: Can't install packagegroup-core-ssh-dropbear-1.0-r1@all: no package provides dropbear - -we now get: - - error: Can't install packagegroup-core-ssh-dropbear-1.0-r1@all: unable to install provider for dropbear: - error: dropbear-2013.58-r1.0@armv5te is conflicted by openssh-sshd-6.2p2-r0@armv5te - -Upstream-Status: Pending - -Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> ---- - smart/const.py | 7 +++++++ - smart/transaction.py | 58 +++++++++++++++++++++++++++++++++++++++++----------- - 2 files changed, 53 insertions(+), 12 deletions(-) - -diff --git a/smart/const.py b/smart/const.py -index 4d8e5cb..67c1ac5 100644 ---- a/smart/const.py -+++ b/smart/const.py -@@ -70,4 +70,11 @@ DATADIR = "/var/lib/smart/" - USERDATADIR = "~/.smart/" - CONFFILE = "config" - -+LOCKED_INSTALL = Enum('LOCKED_INSTALL') -+LOCKED_REMOVE = Enum('LOCKED_REMOVE') -+LOCKED_CONFLICT = Enum('LOCKED_CONFLICT') -+LOCKED_CONFLICT_BY = Enum('LOCKED_CONFLICT_BY') -+LOCKED_NO_COEXIST = Enum('LOCKED_NO_COEXIST') -+LOCKED_SYSCONF = Enum('LOCKED_SYSCONF') -+ - # vim:ts=4:sw=4:et -diff --git a/smart/transaction.py b/smart/transaction.py -index 300b9cc..dd9aa38 100644 ---- a/smart/transaction.py -+++ b/smart/transaction.py -@@ -19,10 +19,31 @@ - # along with Smart Package Manager; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # --from smart.const import INSTALL, REMOVE, UPGRADE, FIX, REINSTALL, KEEP -+from smart.const import INSTALL, REMOVE, UPGRADE, FIX, REINSTALL, KEEP, LOCKED_INSTALL, LOCKED_CONFLICT, LOCKED_CONFLICT_BY, LOCKED_NO_COEXIST, LOCKED_SYSCONF, LOCKED_REMOVE - from smart.cache import PreRequires, Package - from smart import * - -+def lock_reason(pkg, lockvalue): -+ try: -+ (reason, otherpkg) = lockvalue -+ except TypeError: -+ reason = None -+ lockvalue = None -+ if reason == LOCKED_INSTALL: -+ return _("%s is to be installed") % pkg -+ elif reason == LOCKED_CONFLICT: -+ return _("%s conflicts with %s") % (pkg, otherpkg) -+ elif reason == LOCKED_CONFLICT_BY: -+ return _("%s is conflicted by %s") % (pkg, otherpkg) -+ elif reason == LOCKED_NO_COEXIST: -+ return _("%s cannot coexist with %s") % (pkg, otherpkg) -+ elif reason == LOCKED_SYSCONF: -+ return _("%s is locked in system configuration") % pkg -+ elif reason == LOCKED_REMOVE: -+ return _("%s is to be removed") % pkg -+ else: -+ return _("%s is locked (unknown reason)") % pkg -+ - class ChangeSet(dict): - - def __init__(self, cache, state=None, requested=None): -@@ -187,7 +208,7 @@ class Policy(object): - for pkg in pkgconf.filterByFlag("lock", cache.getPackages()): - if pkg not in self._locked: - self._sysconflocked.append(pkg) -- self._locked[pkg] = True -+ self._locked[pkg] = (LOCKED_SYSCONF, None) - - def runFinished(self): - self._priorities.clear() -@@ -524,7 +545,7 @@ class Transaction(object): - if ownpending: - pending = [] - -- locked[pkg] = True -+ locked[pkg] = (LOCKED_INSTALL, None) - changeset.set(pkg, INSTALL) - isinst = changeset.installed - -@@ -535,7 +556,7 @@ class Transaction(object): - if prvpkg is pkg: - continue - if not isinst(prvpkg): -- locked[prvpkg] = True -+ locked[prvpkg] = (LOCKED_CONFLICT_BY, pkg) - continue - if prvpkg in locked: - raise Failed, _("Can't install %s: conflicted package " -@@ -550,7 +571,7 @@ class Transaction(object): - if cnfpkg is pkg: - continue - if not isinst(cnfpkg): -- locked[cnfpkg] = True -+ locked[cnfpkg] = (LOCKED_CONFLICT, pkg) - continue - if cnfpkg in locked: - raise Failed, _("Can't install %s: it's conflicted by " -@@ -565,7 +586,7 @@ class Transaction(object): - for namepkg in namepkgs: - if namepkg is not pkg and not pkg.coexists(namepkg): - if not isinst(namepkg): -- locked[namepkg] = True -+ locked[namepkg] = (LOCKED_NO_COEXIST, pkg) - continue - if namepkg in locked: - raise Failed, _("Can't install %s: it can't coexist " -@@ -577,6 +598,7 @@ class Transaction(object): - - # Check if someone is already providing it. - prvpkgs = {} -+ lockedpkgs = {} - found = False - for prv in req.providedby: - for prvpkg in prv.packages: -@@ -585,6 +607,8 @@ class Transaction(object): - break - if prvpkg not in locked: - prvpkgs[prvpkg] = True -+ else: -+ lockedpkgs[prvpkg] = locked[prvpkg] - else: - continue - break -@@ -597,7 +621,17 @@ class Transaction(object): - if not prvpkgs: - # No packages provide it at all. Give up. - if req in pkg.requires: -- raise Failed, _("Can't install %s: no package provides %s") % \ -+ reasons = [] -+ for prv in req.providedby: -+ for prvpkg in prv.packages: -+ lockedres = lockedpkgs.get(prvpkg, None) -+ if lockedres: -+ reasons.append(lock_reason(prvpkg, lockedres)) -+ if reasons: -+ raise Failed, _("Can't install %s: unable to install provider for %s:\n %s") % \ -+ (pkg, req, '\n '.join(reasons)) -+ else: -+ raise Failed, _("Can't install %s: no package provides %s") % \ - (pkg, req) - else: - # It's only a recommend, skip -@@ -627,7 +661,7 @@ class Transaction(object): - if ownpending: - pending = [] - -- locked[pkg] = True -+ locked[pkg] = (LOCKED_REMOVE, None) - changeset.set(pkg, REMOVE) - isinst = changeset.installed - -@@ -1140,22 +1174,22 @@ class Transaction(object): - if op is KEEP: - if pkg in changeset: - del changeset[pkg] -- locked[pkg] = True -+ locked[pkg] = (LOCKED_KEEP, None) - elif op is INSTALL: - if not isinst(pkg) and pkg in locked: - raise Failed, _("Can't install %s: it's locked") % pkg - changeset.set(pkg, INSTALL) -- locked[pkg] = True -+ locked[pkg] = (LOCKED_INSTALL, None) - elif op is REMOVE: - if isinst(pkg) and pkg in locked: - raise Failed, _("Can't remove %s: it's locked") % pkg - changeset.set(pkg, REMOVE) -- locked[pkg] = True -+ locked[pkg] = (LOCKED_REMOVE, None) - elif op is REINSTALL: - if pkg in locked: - raise Failed, _("Can't reinstall %s: it's locked")%pkg - changeset.set(pkg, INSTALL, force=True) -- locked[pkg] = True -+ locked[pkg] = (LOCKED_INSTALL, None) - elif op is UPGRADE: - pass - --- -1.8.1.2 - diff --git a/meta/recipes-devtools/python/python-smartpm/smart-dflags.patch b/meta/recipes-devtools/python/python-smartpm/smart-dflags.patch deleted file mode 100644 index 3f27262156..0000000000 --- a/meta/recipes-devtools/python/python-smartpm/smart-dflags.patch +++ /dev/null @@ -1,40 +0,0 @@ -backends/rpm: add support for setting dependency flags - -This is useful for OpenEmbedded so that we can do the equivalent of -the --nolinktos and --noparentdirs rpm command line options. - -Upstream-Status: Pending - -Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> - -diff --git a/smart/backends/rpm/pm.py b/smart/backends/rpm/pm.py -index 707a146..aec82e7 100644 ---- a/smart/backends/rpm/pm.py -+++ b/smart/backends/rpm/pm.py -@@ -106,6 +106,23 @@ class RPMPackageManager(PackageManager): - 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) -+ - # Set rpm verbosity level. - levelname = sysconf.get('rpm-log-level') - level = { --- -1.7.9.5 - diff --git a/meta/recipes-devtools/python/python-smartpm/smart-flag-exclude-packages.patch b/meta/recipes-devtools/python/python-smartpm/smart-flag-exclude-packages.patch deleted file mode 100644 index 21a28746a1..0000000000 --- a/meta/recipes-devtools/python/python-smartpm/smart-flag-exclude-packages.patch +++ /dev/null @@ -1,70 +0,0 @@ -Add exclude-packages flag support - -Allow configuring specific packages to be excluded. This will allow -users to specify things NOT to install, and if they are attempted an -error will be generated. - -Upstream-Status: Pending - -Signed-off-by: Mark Hatle <mark.hatle@windriver.com> - -Index: smart-1.4.1/smart/const.py -=================================================================== ---- smart-1.4.1.orig/smart/const.py -+++ smart-1.4.1/smart/const.py -@@ -70,6 +70,7 @@ DATADIR = "/var/lib/smart/" - USERDATADIR = "~/.smart/" - CONFFILE = "config" - -+LOCKED_EXCLUDE = Enum('LOCKED_EXCLUDE') - LOCKED_INSTALL = Enum('LOCKED_INSTALL') - LOCKED_REMOVE = Enum('LOCKED_REMOVE') - LOCKED_CONFLICT = Enum('LOCKED_CONFLICT') -Index: smart-1.4.1/smart/transaction.py -=================================================================== ---- smart-1.4.1.orig/smart/transaction.py -+++ smart-1.4.1/smart/transaction.py -@@ -19,7 +19,7 @@ - # along with Smart Package Manager; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # --from smart.const import INSTALL, REMOVE, UPGRADE, FIX, REINSTALL, KEEP, LOCKED_INSTALL, LOCKED_CONFLICT, LOCKED_CONFLICT_BY, LOCKED_NO_COEXIST, LOCKED_SYSCONF, LOCKED_REMOVE -+from smart.const import INSTALL, REMOVE, UPGRADE, FIX, REINSTALL, KEEP, LOCKED_EXCLUDE, LOCKED_INSTALL, LOCKED_CONFLICT, LOCKED_CONFLICT_BY, LOCKED_NO_COEXIST, LOCKED_SYSCONF, LOCKED_REMOVE - from smart.cache import PreRequires, Package - from smart import * - -@@ -29,7 +29,9 @@ def lock_reason(pkg, lockvalue): - except TypeError: - reason = None - lockvalue = None -- if reason == LOCKED_INSTALL: -+ if reason == LOCKED_EXCLUDE: -+ return _("%s is to be excluded") % pkg -+ elif reason == LOCKED_INSTALL: - return _("%s is to be installed") % pkg - elif reason == LOCKED_CONFLICT: - return _("%s conflicts with %s") % (pkg, otherpkg) -@@ -210,6 +212,10 @@ class Policy(object): - self._sysconflocked.append(pkg) - self._locked[pkg] = (LOCKED_SYSCONF, None) - -+ for pkg in pkgconf.filterByFlag("exclude-packages", cache.getPackages()): -+ if pkg not in self._locked: -+ self._locked[pkg] = (LOCKED_EXCLUDE, None) -+ - def runFinished(self): - self._priorities.clear() - for pkg in self._sysconflocked: -Index: smart-1.4.1/smart/commands/flag.py -=================================================================== ---- smart-1.4.1.orig/smart/commands/flag.py -+++ smart-1.4.1/smart/commands/flag.py -@@ -47,6 +47,8 @@ Currently known flags are: - multi-version - Flagged packages may have more than one version - installed in the system at the same time - (backend dependent). -+ exclude-packages - Flagged packages will be excluded, if they are -+ required, an error will be generated. - ignore-recommends - Flagged packages will not be installed, if - they are only recommended by a package to be - installed rather than required. diff --git a/meta/recipes-devtools/python/python-smartpm/smart-flag-ignore-recommends.patch b/meta/recipes-devtools/python/python-smartpm/smart-flag-ignore-recommends.patch deleted file mode 100644 index 5d5c6f4346..0000000000 --- a/meta/recipes-devtools/python/python-smartpm/smart-flag-ignore-recommends.patch +++ /dev/null @@ -1,60 +0,0 @@ -Add ignore-recommends flag support - -Allow configuring recommends on specific packages to be ignored. - -Upstream-Status: Pending - -Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> ---- - smart/commands/flag.py | 3 +++ - smart/transaction.py | 7 ++++++- - 2 files changed, 9 insertions(+), 1 deletion(-) - -diff --git a/smart/commands/flag.py b/smart/commands/flag.py -index 8b90496..191bb11 100644 ---- a/smart/commands/flag.py -+++ b/smart/commands/flag.py -@@ -47,6 +47,9 @@ Currently known flags are: - multi-version - Flagged packages may have more than one version - installed in the system at the same time - (backend dependent). -+ ignore-recommends - Flagged packages will not be installed, if -+ they are only recommended by a package to be -+ installed rather than required. - - security - Flagged packages are updates for security errata. - bugfix - Flagged packages are updates for bugfix errata. -diff --git a/smart/transaction.py b/smart/transaction.py -index dd9aa38..38eabae 100644 ---- a/smart/transaction.py -+++ b/smart/transaction.py -@@ -596,12 +596,17 @@ class Transaction(object): - # Install packages required by this one. - for req in pkg.requires + pkg.recommends: - -+ reqrequired = req in pkg.requires -+ - # Check if someone is already providing it. - prvpkgs = {} - lockedpkgs = {} - found = False - for prv in req.providedby: - for prvpkg in prv.packages: -+ if not reqrequired: -+ if pkgconf.testFlag("ignore-recommends", prvpkg): -+ continue - if isinst(prvpkg): - found = True - break -@@ -620,7 +625,7 @@ class Transaction(object): - - if not prvpkgs: - # No packages provide it at all. Give up. -- if req in pkg.requires: -+ if reqrequired: - reasons = [] - for prv in req.providedby: - for prvpkg in prv.packages: --- -1.8.1.2 - diff --git a/meta/recipes-devtools/python/python-smartpm/smart-improve-error-reporting.patch b/meta/recipes-devtools/python/python-smartpm/smart-improve-error-reporting.patch deleted file mode 100644 index fece5b9009..0000000000 --- a/meta/recipes-devtools/python/python-smartpm/smart-improve-error-reporting.patch +++ /dev/null @@ -1,253 +0,0 @@ -Improve error reporting in smart - -Add code to check proper command line arguments for various -smart commands. Exit with error if erroneous/additional arguments -are given in the command line. - -Upstream-Status: Pending - -Signed-off-by: Bogdan Marinescu <bogdan.a.marinescu@intel.com> - -diff --git a/smart/commands/channel.py b/smart/commands/channel.py -index aa76f91..63fbb35 100644 ---- a/smart/commands/channel.py -+++ b/smart/commands/channel.py -@@ -157,7 +157,17 @@ def main(ctrl, opts): - opts.show is None and opts.yaml is None): - iface.warning(_("Can't edit channels information.")) - raise Error, _("Configuration is in readonly mode.") -- -+ -+ # Argument check -+ opts.check_args_of_option("set", -1) -+ opts.check_args_of_option("remove", -1) -+ opts.check_args_of_option("edit", 0) -+ opts.check_args_of_option("enable", -1) -+ opts.check_args_of_option("disable", -1) -+ opts.ensure_action("channel", ["add", "set", "remove", "remove-all", -+ "list", "show", "yaml", "enable", "disable"]) -+ opts.check_remaining_args() -+ - if opts.add is not None: - if not opts.add and opts.args == ["-"]: - newchannels = [] -diff --git a/smart/commands/check.py b/smart/commands/check.py -index b08608a..506e852 100644 ---- a/smart/commands/check.py -+++ b/smart/commands/check.py -@@ -72,6 +72,9 @@ def parse_options(argv): - - def main(ctrl, opts, reloadchannels=True): - -+ # Argument check -+ opts.check_args_of_option("channels", 1) -+ - if sysconf.get("auto-update"): - from smart.commands import update - updateopts = update.parse_options([]) -diff --git a/smart/commands/config.py b/smart/commands/config.py -index dd50dee..4fe4366 100644 ---- a/smart/commands/config.py -+++ b/smart/commands/config.py -@@ -80,6 +80,12 @@ def main(ctrl, opts): - globals["false"] = False - globals["no"] = False - -+ # Check arguments -+ opts.check_args_of_option("set", -1) -+ opts.check_args_of_option("remove", -1) -+ opts.ensure_action("config", ["set", "show", "yaml", "remove"]) -+ opts.check_remaining_args() -+ - if opts.set: - for opt in opts.set: - m = SETRE.match(opt) -diff --git a/smart/commands/download.py b/smart/commands/download.py -index 6837993..b853c61 100644 ---- a/smart/commands/download.py -+++ b/smart/commands/download.py -@@ -81,6 +81,14 @@ def parse_options(argv): - - def main(ctrl, opts): - -+ # Argument check -+ opts.check_args_of_option("target", 1) -+ opts.check_args_of_option("output", 1) -+ opts.check_args_of_option("from_urls", -1) -+ opts.check_args_of_option("from_metalink", -1) -+ if not opts.args and not opts.from_metalink and not opts.from_urls: -+ raise Error, _("no package(s) given") -+ - packages = [] - if opts.args: - if sysconf.get("auto-update"): -diff --git a/smart/commands/info.py b/smart/commands/info.py -index 12f74f0..59fbe98 100644 ---- a/smart/commands/info.py -+++ b/smart/commands/info.py -@@ -58,6 +58,10 @@ def parse_options(argv): - - def main(ctrl, opts, reloadchannels=True): - -+ # Argument check -+ if not opts.args: -+ raise Error, _("No package(s) given") -+ - if sysconf.get("auto-update"): - from smart.commands import update - updateopts = update.parse_options([]) -diff --git a/smart/commands/install.py b/smart/commands/install.py -index 8a45954..590222c 100644 ---- a/smart/commands/install.py -+++ b/smart/commands/install.py -@@ -76,6 +76,10 @@ def parse_options(argv): - - def main(ctrl, opts): - -+ # Argument check -+ if not opts.args: -+ raise Error, _("no package(s) given") -+ - if opts.explain: - sysconf.set("explain-changesets", True, soft=True) - -diff --git a/smart/commands/reinstall.py b/smart/commands/reinstall.py -index e59d896..32da3e6 100644 ---- a/smart/commands/reinstall.py -+++ b/smart/commands/reinstall.py -@@ -68,7 +68,11 @@ def parse_options(argv): - return opts - - def main(ctrl, opts): -- -+ -+ # Argument check -+ if not opts.args: -+ raise Error, _("no package(s) given") -+ - if opts.explain: - sysconf.set("explain-changesets", True, soft=True) - -diff --git a/smart/commands/remove.py b/smart/commands/remove.py -index b4823a6..acd3bbd 100644 ---- a/smart/commands/remove.py -+++ b/smart/commands/remove.py -@@ -74,6 +74,10 @@ def parse_options(argv): - - def main(ctrl, opts): - -+ # Argument check -+ if not opts.args: -+ raise Error, _("no package(s) given") -+ - if opts.explain: - sysconf.set("explain-changesets", True, soft=True) - -diff --git a/smart/commands/search.py b/smart/commands/search.py -index 0d0b573..44806b8 100644 ---- a/smart/commands/search.py -+++ b/smart/commands/search.py -@@ -44,6 +44,8 @@ def option_parser(): - def parse_options(argv): - opts = query.parse_options(argv, usage=USAGE, \ - description=DESCRIPTION, examples=EXAMPLES) -+ if not argv: -+ raise Error, _("Search expression not specified") - opts.name = opts.args - opts.summary = opts.args - opts.description = opts.args -diff --git a/smart/commands/upgrade.py b/smart/commands/upgrade.py -index ec86290..7e290d8 100644 ---- a/smart/commands/upgrade.py -+++ b/smart/commands/upgrade.py -@@ -91,6 +91,9 @@ def parse_options(argv): - - def main(ctrl, opts): - -+ # Argument check -+ opts.check_args_of_option("flag", 1) -+ - if opts.explain: - sysconf.set("explain-changesets", True, soft=True) - -diff --git a/smart/util/optparse.py b/smart/util/optparse.py -index 4a3d3a8..279b0bf 100644 ---- a/smart/util/optparse.py -+++ b/smart/util/optparse.py -@@ -70,6 +70,8 @@ import sys, os - 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) -@@ -708,6 +710,12 @@ class Option: - 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": -@@ -819,6 +827,54 @@ class Values: - 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: - diff --git a/meta/recipes-devtools/python/python-smartpm/smart-metadata-match.patch b/meta/recipes-devtools/python/python-smartpm/smart-metadata-match.patch deleted file mode 100644 index d06f416605..0000000000 --- a/meta/recipes-devtools/python/python-smartpm/smart-metadata-match.patch +++ /dev/null @@ -1,28 +0,0 @@ -smart - backends/rmp/metadata.py: Fix incorrect call to the match function - -The match function should take three parameters, name, comparison, version... -The original code was passing it a reference to the object holding the data -instead, which caused the comparison in match to always fail. - -Upstream-Status: Pending - -Signed-off-by: Mark Hatle <mark.hatle@windriver.com> - ---- a/smart/backends/rpm/metadata.py -+++ b/smart/backends/rpm/metadata.py -@@ -332,13 +332,13 @@ - reqargs = [x for x in reqdict - if not ((x[2] is None or "=" in x[2]) and - (RPMProvides, x[1], x[3]) in prvdict or -- system_provides.match(*x[:3]))] -+ system_provides.match(x[1], x[2], x[3]))] - reqargs = collapse_libc_requires(reqargs) - - recargs = [x for x in recdict - if not ((x[2] is None or "=" in x[2]) and - (RPMProvides, x[1], x[3]) in prvdict or -- system_provides.match(*x[:3]))] -+ system_provides.match(x[1], x[2], x[3]))] - - prvargs = prvdict.keys() - cnfargs = cnfdict.keys() diff --git a/meta/recipes-devtools/python/python-smartpm/smart-multilib-fixes.patch b/meta/recipes-devtools/python/python-smartpm/smart-multilib-fixes.patch deleted file mode 100644 index 56fef79a5f..0000000000 --- a/meta/recipes-devtools/python/python-smartpm/smart-multilib-fixes.patch +++ /dev/null @@ -1,22 +0,0 @@ -To fix some multilib issues, change the way the RPM backend decides -if two packages can coexist: if they have a different architecture, -automatically assume that they can coexist (which is fundamental for -multilib). - -Upstream-Status: Pending - -Signed-off-by: Bogdan Marinescu <bogdan.a.marinescu@intel.com> - -diff --git a/smart/backends/rpm/base.py b/smart/backends/rpm/base.py -index 6e83d40..7140c1b 100644 ---- a/smart/backends/rpm/base.py -+++ b/smart/backends/rpm/base.py -@@ -228,6 +228,8 @@ class RPMPackage(Package): - return False - selfver, selfarch = splitarch(self.version) - otherver, otherarch = splitarch(other.version) -+ if selfarch != otherarch: -+ return True - selfcolor = getArchColor(selfarch) - othercolor = getArchColor(otherarch) - if (selfcolor and othercolor and selfcolor != othercolor and diff --git a/meta/recipes-devtools/python/python-smartpm/smart-recommends.patch b/meta/recipes-devtools/python/python-smartpm/smart-recommends.patch deleted file mode 100644 index a41b1beaa9..0000000000 --- a/meta/recipes-devtools/python/python-smartpm/smart-recommends.patch +++ /dev/null @@ -1,1362 +0,0 @@ -Handle recommended packages in core and rpm backends - -Identify and store recommended packages in the cache, add a query option -to read them and ignore them if they are not present when installing. - -Initial identification code from Mark Hatle <mark.hatle@windriver.com>. - -Upstream-Status: Pending - -Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> - -diff --git a/smart/backends/rpm/base.py b/smart/backends/rpm/base.py -index 0489e11..b9e9cb2 100644 ---- a/smart/backends/rpm/base.py -+++ b/smart/backends/rpm/base.py -@@ -198,6 +198,29 @@ class RPMPackage(Package): - break - else: - return False -+ srecs = fk(self.recommends) -+ orecs = fk(other.recommends) -+ if srecs != orecs: -+ for srec in srecs: -+ if srec.name[0] == "/" or srec in orecs: -+ continue -+ for orec in orecs: -+ if (srec.name == orec.name and -+ srec.relation == orec.relation and -+ checkver(srec.version, orec.version)): -+ break -+ else: -+ return False |
