From 05fb1da0acde7d2dd7a4337342f49996fb5dd5d8 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 16 Oct 2011 12:58:44 +0000 Subject: [PATCH] Add support for --allow-{arch,vendor}change on updates. --- po/pakfire.pot | 136 +++++++++++++++++++----------------- python/pakfire/api.py | 5 +- python/pakfire/base.py | 6 +- python/pakfire/cli.py | 33 +++++---- python/pakfire/satsolver.py | 11 ++- 5 files changed, 110 insertions(+), 81 deletions(-) diff --git a/po/pakfire.pot b/po/pakfire.pot index 3907b616e..354034997 100644 --- a/po/pakfire.pot +++ b/po/pakfire.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-10-16 14:09+0200\n" +"POT-Creation-Date: 2011-10-16 12:51+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -68,8 +68,8 @@ msgid "Downgrading" msgstr "" #: ../python/pakfire/base.py:203 ../python/pakfire/base.py:233 -#: ../python/pakfire/base.py:279 ../python/pakfire/base.py:328 -#: ../python/pakfire/base.py:361 +#: ../python/pakfire/base.py:279 ../python/pakfire/base.py:330 +#: ../python/pakfire/base.py:363 msgid "Nothing to do" msgstr "" @@ -82,11 +82,11 @@ msgstr "" msgid "Excluding %s." msgstr "" -#: ../python/pakfire/base.py:473 +#: ../python/pakfire/base.py:475 msgid "Build command has failed." msgstr "" -#: ../python/pakfire/base.py:553 +#: ../python/pakfire/base.py:555 msgid "Everything is fine." msgstr "" @@ -168,196 +168,204 @@ msgid "Give name of at least one package to remove." msgstr "" #: ../python/pakfire/cli.py:154 -msgid "Update the whole system or one specific package." -msgstr "" - -#: ../python/pakfire/cli.py:156 ../python/pakfire/cli.py:166 msgid "Give a name of a package to update or leave emtpy for all." msgstr "" -#: ../python/pakfire/cli.py:158 ../python/pakfire/cli.py:168 +#: ../python/pakfire/cli.py:156 msgid "Exclude package from update." msgstr "" -#: ../python/pakfire/cli.py:164 +#: ../python/pakfire/cli.py:158 +msgid "Allow changing the vendor of packages." +msgstr "" + +#: ../python/pakfire/cli.py:160 +msgid "Allow changing the architecture of packages." +msgstr "" + +#: ../python/pakfire/cli.py:165 +msgid "Update the whole system or one specific package." +msgstr "" + +#: ../python/pakfire/cli.py:172 msgid "Check, if there are any updates available." msgstr "" -#: ../python/pakfire/cli.py:174 +#: ../python/pakfire/cli.py:179 msgid "Print some information about the given package(s)." msgstr "" -#: ../python/pakfire/cli.py:176 +#: ../python/pakfire/cli.py:181 msgid "Give at least the name of one package." msgstr "" -#: ../python/pakfire/cli.py:182 +#: ../python/pakfire/cli.py:187 msgid "Search for a given pattern." msgstr "" -#: ../python/pakfire/cli.py:184 +#: ../python/pakfire/cli.py:189 msgid "A pattern to search for." msgstr "" -#: ../python/pakfire/cli.py:190 +#: ../python/pakfire/cli.py:195 msgid "Get a list of packages that provide a given file or feature." msgstr "" -#: ../python/pakfire/cli.py:192 +#: ../python/pakfire/cli.py:197 msgid "File or feature to search for." msgstr "" -#: ../python/pakfire/cli.py:198 +#: ../python/pakfire/cli.py:203 msgid "Get list of packages that belong to the given group." msgstr "" -#: ../python/pakfire/cli.py:200 +#: ../python/pakfire/cli.py:205 msgid "Group name to search for." msgstr "" -#: ../python/pakfire/cli.py:206 +#: ../python/pakfire/cli.py:211 msgid "Install all packages that belong to the given group." msgstr "" -#: ../python/pakfire/cli.py:208 +#: ../python/pakfire/cli.py:213 msgid "Group name." msgstr "" -#: ../python/pakfire/cli.py:214 +#: ../python/pakfire/cli.py:219 msgid "List all currently enabled repositories." msgstr "" -#: ../python/pakfire/cli.py:218 +#: ../python/pakfire/cli.py:223 msgid "Cleanup commands." msgstr "" -#: ../python/pakfire/cli.py:226 +#: ../python/pakfire/cli.py:231 msgid "Cleanup all temporary files." msgstr "" -#: ../python/pakfire/cli.py:232 +#: ../python/pakfire/cli.py:237 msgid "Check the system for any errors." msgstr "" -#: ../python/pakfire/cli.py:238 +#: ../python/pakfire/cli.py:243 msgid "Check the dependencies for a particular package." msgstr "" -#: ../python/pakfire/cli.py:240 +#: ../python/pakfire/cli.py:245 msgid "Give name of at least one package to check." msgstr "" -#: ../python/pakfire/cli.py:304 ../python/pakfire/transaction.py:316 +#: ../python/pakfire/cli.py:313 ../python/pakfire/transaction.py:316 msgid "Repository" msgstr "" -#: ../python/pakfire/cli.py:304 +#: ../python/pakfire/cli.py:313 msgid "Enabled" msgstr "" -#: ../python/pakfire/cli.py:304 +#: ../python/pakfire/cli.py:313 msgid "Priority" msgstr "" -#: ../python/pakfire/cli.py:304 +#: ../python/pakfire/cli.py:313 msgid "Packages" msgstr "" -#: ../python/pakfire/cli.py:316 +#: ../python/pakfire/cli.py:325 msgid "Cleaning up everything..." msgstr "" -#: ../python/pakfire/cli.py:332 +#: ../python/pakfire/cli.py:341 msgid "You cannot run pakfire-builder in a pakfire chroot." msgstr "" -#: ../python/pakfire/cli.py:335 ../python/pakfire/cli.py:592 +#: ../python/pakfire/cli.py:344 ../python/pakfire/cli.py:601 msgid "Pakfire builder command line interface." msgstr "" -#: ../python/pakfire/cli.py:390 +#: ../python/pakfire/cli.py:399 msgid "Update the package indexes." msgstr "" -#: ../python/pakfire/cli.py:396 ../python/pakfire/cli.py:612 +#: ../python/pakfire/cli.py:405 ../python/pakfire/cli.py:621 msgid "Build one or more packages." msgstr "" -#: ../python/pakfire/cli.py:398 ../python/pakfire/cli.py:614 +#: ../python/pakfire/cli.py:407 ../python/pakfire/cli.py:623 msgid "Give name of at least one package to build." msgstr "" -#: ../python/pakfire/cli.py:402 ../python/pakfire/cli.py:618 +#: ../python/pakfire/cli.py:411 ../python/pakfire/cli.py:627 msgid "Build the package for the given architecture." msgstr "" -#: ../python/pakfire/cli.py:404 ../python/pakfire/cli.py:432 -#: ../python/pakfire/cli.py:620 +#: ../python/pakfire/cli.py:413 ../python/pakfire/cli.py:441 +#: ../python/pakfire/cli.py:629 msgid "Path were the output files should be copied to." msgstr "" -#: ../python/pakfire/cli.py:406 ../python/pakfire/cli.py:421 -#: ../python/pakfire/cli.py:622 +#: ../python/pakfire/cli.py:415 ../python/pakfire/cli.py:430 +#: ../python/pakfire/cli.py:631 msgid "Mode to run in. Is either 'release' or 'development' (default)." msgstr "" -#: ../python/pakfire/cli.py:408 +#: ../python/pakfire/cli.py:417 msgid "Run a shell after a successful build." msgstr "" -#: ../python/pakfire/cli.py:413 +#: ../python/pakfire/cli.py:422 msgid "Go into a shell." msgstr "" -#: ../python/pakfire/cli.py:415 +#: ../python/pakfire/cli.py:424 msgid "Give name of a package." msgstr "" -#: ../python/pakfire/cli.py:419 +#: ../python/pakfire/cli.py:428 msgid "Emulated architecture in the shell." msgstr "" -#: ../python/pakfire/cli.py:426 +#: ../python/pakfire/cli.py:435 msgid "Generate a source package." msgstr "" -#: ../python/pakfire/cli.py:428 +#: ../python/pakfire/cli.py:437 msgid "Give name(s) of a package(s)." msgstr "" -#: ../python/pakfire/cli.py:505 +#: ../python/pakfire/cli.py:514 msgid "Pakfire server command line interface." msgstr "" -#: ../python/pakfire/cli.py:542 +#: ../python/pakfire/cli.py:551 msgid "Request a build job from the server." msgstr "" -#: ../python/pakfire/cli.py:548 +#: ../python/pakfire/cli.py:557 msgid "Send a keepalive to the server." msgstr "" -#: ../python/pakfire/cli.py:555 +#: ../python/pakfire/cli.py:564 msgid "Update all repositories." msgstr "" -#: ../python/pakfire/cli.py:561 +#: ../python/pakfire/cli.py:570 msgid "Repository management commands." msgstr "" -#: ../python/pakfire/cli.py:569 +#: ../python/pakfire/cli.py:578 msgid "Create a new repository index." msgstr "" -#: ../python/pakfire/cli.py:570 +#: ../python/pakfire/cli.py:579 msgid "Path to the packages." msgstr "" -#: ../python/pakfire/cli.py:571 +#: ../python/pakfire/cli.py:580 msgid "Path to input packages." msgstr "" -#: ../python/pakfire/cli.py:624 +#: ../python/pakfire/cli.py:633 msgid "Do not verify build dependencies." msgstr "" @@ -585,33 +593,33 @@ msgstr "" msgid "Cannot download this file in offline mode: %s" msgstr "" -#: ../python/pakfire/satsolver.py:148 +#: ../python/pakfire/satsolver.py:157 msgid "The solver returned one problem:" msgstr "" #. Ask the user if he or she want to modify the request. If not, just exit. -#: ../python/pakfire/satsolver.py:164 +#: ../python/pakfire/satsolver.py:173 msgid "Do you want to manually alter the request?" msgstr "" -#: ../python/pakfire/satsolver.py:167 +#: ../python/pakfire/satsolver.py:176 msgid "You can now try to satisfy the solver by modifying your request." msgstr "" -#: ../python/pakfire/satsolver.py:172 +#: ../python/pakfire/satsolver.py:181 msgid "Which problem to you want to resolve?" msgstr "" -#: ../python/pakfire/satsolver.py:174 +#: ../python/pakfire/satsolver.py:183 msgid "Press enter to try to re-solve the request." msgstr "" -#: ../python/pakfire/satsolver.py:205 +#: ../python/pakfire/satsolver.py:214 #, python-format msgid " Solution: %s" msgstr "" -#: ../python/pakfire/satsolver.py:214 +#: ../python/pakfire/satsolver.py:223 msgid " Solutions:" msgstr "" diff --git a/python/pakfire/api.py b/python/pakfire/api.py index 699f206fa..42ebe1715 100644 --- a/python/pakfire/api.py +++ b/python/pakfire/api.py @@ -45,10 +45,11 @@ def remove(what, **pakfire_args): return pakfire.remove(what) -def update(pkgs, check=False, excludes=None, **pakfire_args): +def update(pkgs, check=False, excludes=None, allow_vendorchange=False, allow_archchange=False, **pakfire_args): pakfire = Pakfire(**pakfire_args) - return pakfire.update(pkgs, check=check, excludes=excludes) + return pakfire.update(pkgs, check=check, excludes=excludes, + allow_vendorchange=allow_vendorchange, allow_archchange=allow_archchange) def info(patterns, **pakfire_args): # Create pakfire instance. diff --git a/python/pakfire/base.py b/python/pakfire/base.py index fcc510434..4f537be32 100644 --- a/python/pakfire/base.py +++ b/python/pakfire/base.py @@ -296,7 +296,7 @@ class Pakfire(object): repo.remove() self.repos.rem_repo(repo) - def update(self, pkgs, check=False, excludes=None): + def update(self, pkgs, check=False, excludes=None, allow_vendorchange=False, allow_archchange=False): """ check indicates, if the method should return after calculation of the transaction. @@ -322,7 +322,9 @@ class Pakfire(object): request.lock(exclude) solver = self.create_solver() - t = solver.solve(request, update=update) + t = solver.solve(request, update=update, + allow_vendorchange=allow_vendorchange, + allow_archchange=allow_archchange) if not t: logging.info(_("Nothing to do")) diff --git a/python/pakfire/cli.py b/python/pakfire/cli.py index 761ade023..fb5d3c10f 100644 --- a/python/pakfire/cli.py +++ b/python/pakfire/cli.py @@ -148,25 +148,30 @@ class Cli(object): help=_("Give name of at least one package to remove.")) sub_remove.add_argument("action", action="store_const", const="remove") + @staticmethod + def _parse_command_update(parser): + parser.add_argument("package", nargs="*", + help=_("Give a name of a package to update or leave emtpy for all.")) + parser.add_argument("--exclude", "-x", nargs="+", + help=_("Exclude package from update.")) + parser.add_argument("--allow-vendorchange", action="store_true", + help=_("Allow changing the vendor of packages.")) + parser.add_argument("--allow-archchange", action="store_true", + help=_("Allow changing the architecture of packages.")) + def parse_command_update(self): # Implement the "update" command. sub_update = self.sub_commands.add_parser("update", help=_("Update the whole system or one specific package.")) - sub_update.add_argument("package", nargs="*", - help=_("Give a name of a package to update or leave emtpy for all.")) - sub_update.add_argument("--exclude", "-x", nargs="+", - help=_("Exclude package from update.")) sub_update.add_argument("action", action="store_const", const="update") + self._parse_command_update(sub_update) def parse_command_check_update(self): # Implement the "check-update" command. sub_check_update = self.sub_commands.add_parser("check-update", help=_("Check, if there are any updates available.")) - sub_check_update.add_argument("package", nargs="*", - help=_("Give a name of a package to update or leave emtpy for all.")) - sub_check_update.add_argument("--exclude", "-x", nargs="+", - help=_("Exclude package from update.")) sub_check_update.add_argument("action", action="store_const", const="check_update") + self._parse_command_update(sub_check_update) def parse_command_info(self): # Implement the "info" command. @@ -265,12 +270,16 @@ class Cli(object): for pkg in pkgs: print pkg.dump(short=True) - def handle_update(self): - pakfire.update(self.args.package, excludes=self.args.exclude, **self.pakfire_args) + def handle_update(self, **args): + args.update(self.pakfire_args) + + pakfire.update(self.args.package, excludes=self.args.exclude, + allow_vendorchange=self.args.allow_vendorchange, + allow_archchange=self.args.allow_archchange, + **args) def handle_check_update(self): - pakfire.update(self.args.package, check=True, excludes=self.args.exclude, - **self.pakfire_args) + self.handle_update(check=True) def handle_install(self): pakfire.install(self.args.package, **self.pakfire_args) diff --git a/python/pakfire/satsolver.py b/python/pakfire/satsolver.py index 75ca831c5..d91d9acec 100644 --- a/python/pakfire/satsolver.py +++ b/python/pakfire/satsolver.py @@ -112,7 +112,9 @@ class Solver(object): self.pool = pool def solve(self, request, update=False, uninstall=False, allow_downgrade=False, - fix_system=False, interactive=False, logger=None): + allow_vendorchange=False, allow_archchange=False, fix_system=False, + interactive=False, logger=None): + # If no logger was provided, we use the root logger. if logger is None: logger = logging.getLogger() @@ -124,6 +126,13 @@ class Solver(object): solver.set_allow_uninstall(uninstall) solver.set_allow_downgrade(allow_downgrade) + # Optionally allow packages to change their vendors. + # This is not recommended because it may have weird effects. + solver.set_allow_vendorchange(allow_vendorchange) + + # Optionally allow packages ot change their architecture. + solver.set_allow_archchange(allow_archchange) + # Configure the solver for an update. if update: solver.set_updatesystem(True) -- 2.39.5