From b25a3d848e5c4d01dbb413ab21929b5b28ce7bee Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 6 Aug 2011 20:56:07 +0200 Subject: [PATCH] Add "resolvdep" command. --- pakfire/api.py | 5 ++ pakfire/base.py | 16 ++++++ pakfire/cli.py | 15 ++++++ po/pakfire.pot | 126 ++++++++++++++++++++++++++---------------------- 4 files changed, 105 insertions(+), 57 deletions(-) diff --git a/pakfire/api.py b/pakfire/api.py index f6b16568b..601bb78cc 100644 --- a/pakfire/api.py +++ b/pakfire/api.py @@ -30,6 +30,11 @@ def install(requires, **pakfire_args): return pakfire.install(requires) +def resolvdep(requires, **pakfire_args): + pakfire = Pakfire(**pakfire_args) + + return pakfire.resolvdep(requires) + def localinstall(files, **pakfire_args): pakfire = Pakfire(**pakfire_args) diff --git a/pakfire/base.py b/pakfire/base.py index 994cc2425..49e8139a2 100644 --- a/pakfire/base.py +++ b/pakfire/base.py @@ -171,6 +171,22 @@ class Pakfire(object): # XXX just backwards compatibility return self.mode == "builder" + def resolvdep(self, requires): + # Create a new request. + request = self.create_request() + for req in requires: + req = self.create_relation(req) + request.install(req) + + # Do the solving. + solver = self.create_solver() + t = solver.solve(request) + + if t: + t.dump() + else: + logging.info(_("Nothing to do")) + def install(self, requires): # Create a new request. request = self.create_request() diff --git a/pakfire/cli.py b/pakfire/cli.py index 35ddaea7d..04d548af5 100644 --- a/pakfire/cli.py +++ b/pakfire/cli.py @@ -64,6 +64,7 @@ class Cli(object): self.parse_command_repolist() self.parse_command_clean() self.parse_command_check() + self.parse_command_resolvdep() # Finally parse all arguments from the command line and save them. self.args = self.parser.parse_args() @@ -82,6 +83,7 @@ class Cli(object): "repolist" : self.handle_repolist, "clean_all" : self.handle_clean_all, "check" : self.handle_check, + "resolvdep" : self.handle_resolvdep, } @property @@ -222,6 +224,14 @@ class Cli(object): help=_("Check the system for any errors.")) sub_check.add_argument("action", action="store_const", const="check") + def parse_command_resolvdep(self): + # Implement the "resolvdep" command. + sub_resolvdep = self.sub_commands.add_parser("resolvdep", + help=_("Check the dependencies for a particular package.")) + sub_resolvdep.add_argument("package", nargs="+", + help=_("Give name of at least one package to check.")) + sub_resolvdep.add_argument("action", action="store_const", const="resolvdep") + def run(self): action = self.args.action @@ -301,6 +311,9 @@ class Cli(object): def handle_check(self): pakfire.check(**self.pakfire_args) + def handle_resolvdep(self): + pakfire.resolvdep(self.args.package, **self.pakfire_args) + class CliBuilder(Cli): def __init__(self): @@ -323,6 +336,7 @@ class CliBuilder(Cli): self.parse_command_grouplist() self.parse_command_repolist() self.parse_command_clean() + self.parse_command_resolvdep() # Finally parse all arguments from the command line and save them. self.args = self.parser.parse_args() @@ -338,6 +352,7 @@ class CliBuilder(Cli): "grouplist" : self.handle_grouplist, "repolist" : self.handle_repolist, "clean_all" : self.handle_clean_all, + "resolvdep" : self.handle_resolvdep, } @property diff --git a/po/pakfire.pot b/po/pakfire.pot index 10bc2eb50..0bb6f4309 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-08-06 18:04+0200\n" +"POT-Creation-Date: 2011-08-06 20:55+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -38,16 +38,16 @@ msgstr "" msgid "Downgrading" msgstr "" -#: ../pakfire/base.py:186 ../pakfire/base.py:228 ../pakfire/base.py:259 -#: ../pakfire/base.py:281 +#: ../pakfire/base.py:188 ../pakfire/base.py:202 ../pakfire/base.py:244 +#: ../pakfire/base.py:279 ../pakfire/base.py:312 msgid "Nothing to do" msgstr "" -#: ../pakfire/base.py:214 +#: ../pakfire/base.py:230 msgid "There are no packages to install." msgstr "" -#: ../pakfire/base.py:477 +#: ../pakfire/base.py:508 msgid "Everything is fine." msgstr "" @@ -64,211 +64,223 @@ msgstr "" msgid "The path where pakfire should operate in." msgstr "" -#: ../pakfire/cli.py:105 +#: ../pakfire/cli.py:109 msgid "Enable verbose output." msgstr "" -#: ../pakfire/cli.py:108 +#: ../pakfire/cli.py:112 msgid "Path to a configuration file to load." msgstr "" -#: ../pakfire/cli.py:111 +#: ../pakfire/cli.py:115 msgid "Disable a repository temporarily." msgstr "" -#: ../pakfire/cli.py:114 +#: ../pakfire/cli.py:118 msgid "Enable a repository temporarily." msgstr "" -#: ../pakfire/cli.py:117 +#: ../pakfire/cli.py:121 msgid "Run pakfire in offline mode." msgstr "" -#: ../pakfire/cli.py:122 +#: ../pakfire/cli.py:126 msgid "Install one or more packages to the system." msgstr "" -#: ../pakfire/cli.py:124 +#: ../pakfire/cli.py:128 msgid "Give name of at least one package to install." msgstr "" -#: ../pakfire/cli.py:130 +#: ../pakfire/cli.py:134 msgid "Install one or more packages from the filesystem." msgstr "" -#: ../pakfire/cli.py:132 +#: ../pakfire/cli.py:136 msgid "Give filename of at least one package." msgstr "" -#: ../pakfire/cli.py:138 +#: ../pakfire/cli.py:142 msgid "Remove one or more packages from the system." msgstr "" -#: ../pakfire/cli.py:140 +#: ../pakfire/cli.py:144 msgid "Give name of at least one package to remove." msgstr "" -#: ../pakfire/cli.py:146 +#: ../pakfire/cli.py:150 msgid "Update the whole system or one specific package." msgstr "" -#: ../pakfire/cli.py:148 +#: ../pakfire/cli.py:152 ../pakfire/cli.py:160 msgid "Give a name of a package to update or leave emtpy for all." msgstr "" -#: ../pakfire/cli.py:154 +#: ../pakfire/cli.py:158 +msgid "Check, if there are any updates available." +msgstr "" + +#: ../pakfire/cli.py:166 msgid "Print some information about the given package(s)." msgstr "" -#: ../pakfire/cli.py:156 +#: ../pakfire/cli.py:168 msgid "Give at least the name of one package." msgstr "" -#: ../pakfire/cli.py:162 +#: ../pakfire/cli.py:174 msgid "Search for a given pattern." msgstr "" -#: ../pakfire/cli.py:164 +#: ../pakfire/cli.py:176 msgid "A pattern to search for." msgstr "" -#: ../pakfire/cli.py:170 +#: ../pakfire/cli.py:182 msgid "Get a list of packages that provide a given file or feature." msgstr "" -#: ../pakfire/cli.py:172 +#: ../pakfire/cli.py:184 msgid "File or feature to search for." msgstr "" -#: ../pakfire/cli.py:178 +#: ../pakfire/cli.py:190 msgid "Get list of packages that belong to the given group." msgstr "" -#: ../pakfire/cli.py:180 +#: ../pakfire/cli.py:192 msgid "Group name to search for." msgstr "" -#: ../pakfire/cli.py:186 +#: ../pakfire/cli.py:198 msgid "Install all packages that belong to the given group." msgstr "" -#: ../pakfire/cli.py:188 +#: ../pakfire/cli.py:200 msgid "Group name." msgstr "" -#: ../pakfire/cli.py:194 +#: ../pakfire/cli.py:206 msgid "List all currently enabled repositories." msgstr "" -#: ../pakfire/cli.py:198 +#: ../pakfire/cli.py:210 msgid "Cleanup commands." msgstr "" -#: ../pakfire/cli.py:206 +#: ../pakfire/cli.py:218 msgid "Cleanup all temporary files." msgstr "" -#: ../pakfire/cli.py:212 +#: ../pakfire/cli.py:224 msgid "Check the system for any errors." msgstr "" -#: ../pakfire/cli.py:272 ../pakfire/transaction.py:194 +#: ../pakfire/cli.py:230 +msgid "Check the dependencies for a particular package." +msgstr "" + +#: ../pakfire/cli.py:232 +msgid "Give name of at least one package to check." +msgstr "" + +#: ../pakfire/cli.py:295 ../pakfire/transaction.py:194 msgid "Repository" msgstr "" -#: ../pakfire/cli.py:272 +#: ../pakfire/cli.py:295 msgid "Enabled" msgstr "" -#: ../pakfire/cli.py:272 +#: ../pakfire/cli.py:295 msgid "Priority" msgstr "" -#: ../pakfire/cli.py:272 +#: ../pakfire/cli.py:295 msgid "Packages" msgstr "" -#: ../pakfire/cli.py:284 +#: ../pakfire/cli.py:307 msgid "Cleaning up everything..." msgstr "" -#: ../pakfire/cli.py:295 +#: ../pakfire/cli.py:321 msgid "Pakfire builder command line interface." msgstr "" -#: ../pakfire/cli.py:348 +#: ../pakfire/cli.py:376 msgid "Update the package indexes." msgstr "" -#: ../pakfire/cli.py:354 +#: ../pakfire/cli.py:382 msgid "Build one or more packages." msgstr "" -#: ../pakfire/cli.py:356 +#: ../pakfire/cli.py:384 msgid "Give name of at least one package to build." msgstr "" -#: ../pakfire/cli.py:360 +#: ../pakfire/cli.py:388 msgid "Build the package for the given architecture." msgstr "" -#: ../pakfire/cli.py:362 ../pakfire/cli.py:388 +#: ../pakfire/cli.py:390 ../pakfire/cli.py:416 msgid "Path were the output files should be copied to." msgstr "" -#: ../pakfire/cli.py:364 ../pakfire/cli.py:377 +#: ../pakfire/cli.py:392 ../pakfire/cli.py:405 msgid "Mode to run in. Is either 'release' or 'development' (default)." msgstr "" -#: ../pakfire/cli.py:369 +#: ../pakfire/cli.py:397 msgid "Go into a shell." msgstr "" -#: ../pakfire/cli.py:371 +#: ../pakfire/cli.py:399 msgid "Give name of a package." msgstr "" -#: ../pakfire/cli.py:375 +#: ../pakfire/cli.py:403 msgid "Emulated architecture in the shell." msgstr "" -#: ../pakfire/cli.py:382 +#: ../pakfire/cli.py:410 msgid "Generate a source package." msgstr "" -#: ../pakfire/cli.py:384 +#: ../pakfire/cli.py:412 msgid "Give name(s) of a package(s)." msgstr "" -#: ../pakfire/cli.py:460 +#: ../pakfire/cli.py:488 msgid "Pakfire server command line interface." msgstr "" -#: ../pakfire/cli.py:497 +#: ../pakfire/cli.py:525 msgid "Request a build job from the server." msgstr "" -#: ../pakfire/cli.py:503 +#: ../pakfire/cli.py:531 msgid "Send a keepalive to the server." msgstr "" -#: ../pakfire/cli.py:510 +#: ../pakfire/cli.py:538 msgid "Update all repositories." msgstr "" -#: ../pakfire/cli.py:516 +#: ../pakfire/cli.py:544 msgid "Repository management commands." msgstr "" -#: ../pakfire/cli.py:524 +#: ../pakfire/cli.py:552 msgid "Create a new repository index." msgstr "" -#: ../pakfire/cli.py:525 +#: ../pakfire/cli.py:553 msgid "Path to the packages." msgstr "" -#: ../pakfire/cli.py:526 +#: ../pakfire/cli.py:554 msgid "Path to input packages." msgstr "" -- 2.39.5