From: Michael Tremer Date: Sun, 20 Feb 2011 10:02:28 +0000 (+0100) Subject: Add new script "pakfire-server" that handles all the repository stuff. X-Git-Tag: 0.9.3~156 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92806f47ef6df6a73ebb056b1a6b75d1f4bef394;p=pakfire.git Add new script "pakfire-server" that handles all the repository stuff. --- diff --git a/pakfire/cli.py b/pakfire/cli.py index ae32c809f..5bbe08a8c 100644 --- a/pakfire/cli.py +++ b/pakfire/cli.py @@ -203,7 +203,6 @@ class CliBuilder(Cli): self.parse_command_search() self.parse_command_shell() self.parse_command_update() - self.parse_command_repo() self.parse_command_provides() # Finally parse all arguments from the command line and save them. @@ -222,7 +221,6 @@ class CliBuilder(Cli): "info" : self.handle_info, "search" : self.handle_search, "shell" : self.handle_shell, - "repo_create" : self.handle_repo_create, "provides" : self.handle_provides, } @@ -267,21 +265,6 @@ class CliBuilder(Cli): sub_dist.add_argument("--resultdir", nargs="?", help=_("Path were the output files should be copied to.")) - def parse_command_repo(self): - sub_repo = self.sub_commands.add_parser("repo", - help=_("Repository management commands.")) - - sub_repo_commands = sub_repo.add_subparsers() - - self.parse_command_repo_create(sub_repo_commands) - - def parse_command_repo_create(self, sub_commands): - sub_create = sub_commands.add_parser("create", - help=_("Create a new repository index.")) - sub_create.add_argument("path", nargs=1, help=_("Path to the packages.")) - sub_create.add_argument("inputs", nargs="+", help=_("Path to input packages.")) - sub_create.add_argument("action", action="store_const", const="repo_create") - def handle_info(self): Cli.handle_info(self, long=True) @@ -347,8 +330,48 @@ class CliBuilder(Cli): self.pakfire.dist(pkg, resultdirs=[self.args.resultdir,]) +class CliServer(Cli): + def __init__(self): + self.parser = argparse.ArgumentParser( + description = _("Pakfire server command line interface."), + ) + + self.parse_common_arguments() + + # Add sub-commands. + self.sub_commands = self.parser.add_subparsers() + + self.parse_command_repo() + + # Finally parse all arguments from the command line and save them. + self.args = self.parser.parse_args() + + self.pakfire = Pakfire( + builder = True, + configs = [self.args.config], + disable_repos = self.args.disable_repo, + ) + + self.action2func = { + "repo_create" : self.handle_repo_create, + } + + def parse_command_repo(self): + sub_repo = self.sub_commands.add_parser("repo", + help=_("Repository management commands.")) + + sub_repo_commands = sub_repo.add_subparsers() + + self.parse_command_repo_create(sub_repo_commands) + + def parse_command_repo_create(self, sub_commands): + sub_create = sub_commands.add_parser("create", + help=_("Create a new repository index.")) + sub_create.add_argument("path", nargs=1, help=_("Path to the packages.")) + sub_create.add_argument("inputs", nargs="+", help=_("Path to input packages.")) + sub_create.add_argument("action", action="store_const", const="repo_create") + def handle_repo_create(self): path = self.args.path[0] self.pakfire.repo_create(path, self.args.inputs) - diff --git a/po/pakfire.pot b/po/pakfire.pot index 1276e95c9..48e6a9250 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-02-20 01:13+0100\n" +"POT-Creation-Date: 2011-02-20 11:01+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -94,59 +94,63 @@ msgstr "" msgid "Pakfire builder command line interface." msgstr "" -#: ../pakfire/cli.py:232 +#: ../pakfire/cli.py:230 msgid "Update the package indexes." msgstr "" -#: ../pakfire/cli.py:238 +#: ../pakfire/cli.py:236 msgid "Build one or more packages." msgstr "" -#: ../pakfire/cli.py:240 +#: ../pakfire/cli.py:238 msgid "Give name of at least one package to build." msgstr "" -#: ../pakfire/cli.py:244 +#: ../pakfire/cli.py:242 msgid "Build the package for the given architecture." msgstr "" -#: ../pakfire/cli.py:246 ../pakfire/cli.py:268 +#: ../pakfire/cli.py:244 ../pakfire/cli.py:266 msgid "Path were the output files should be copied to." msgstr "" -#: ../pakfire/cli.py:251 +#: ../pakfire/cli.py:249 msgid "Go into a shell." msgstr "" -#: ../pakfire/cli.py:253 ../pakfire/cli.py:264 +#: ../pakfire/cli.py:251 ../pakfire/cli.py:262 msgid "Give name of a package." msgstr "" -#: ../pakfire/cli.py:257 +#: ../pakfire/cli.py:255 msgid "Emulated architecture in the shell." msgstr "" -#: ../pakfire/cli.py:262 +#: ../pakfire/cli.py:260 msgid "Generate a source package." msgstr "" -#: ../pakfire/cli.py:272 +#: ../pakfire/cli.py:336 +msgid "Pakfire server command line interface." +msgstr "" + +#: ../pakfire/cli.py:361 msgid "Repository management commands." msgstr "" -#: ../pakfire/cli.py:280 +#: ../pakfire/cli.py:369 msgid "Create a new repository index." msgstr "" -#: ../pakfire/cli.py:281 +#: ../pakfire/cli.py:370 msgid "Path to the packages." msgstr "" -#: ../pakfire/cli.py:282 +#: ../pakfire/cli.py:371 msgid "Path to input packages." msgstr "" -#: ../pakfire/__init__.py:165 +#: ../pakfire/__init__.py:174 msgid "Is this okay?" msgstr "" diff --git a/scripts/pakfire b/scripts/pakfire index 27cf848e9..b5063f463 100755 --- a/scripts/pakfire +++ b/scripts/pakfire @@ -4,11 +4,12 @@ import logging import os import sys -from pakfire.cli import Cli, CliBuilder +from pakfire.cli import Cli, CliBuilder, CliServer basename2cls = { "pakfire" : Cli, "pakfire-build" : CliBuilder, + "pakfire-server" : CliServer, } # Get the basename of the program diff --git a/scripts/pakfire-server b/scripts/pakfire-server new file mode 120000 index 000000000..83bb50a42 --- /dev/null +++ b/scripts/pakfire-server @@ -0,0 +1 @@ +pakfire \ No newline at end of file diff --git a/setup.py b/setup.py index 2a139ce54..4dce1c117 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( author_email = "info@ipfire.org", url = "http://redmine.ipfire.org/projects/buildsystem3", packages = ["pakfire", "pakfire.packages", "pakfire.plugins"], - scripts = ["scripts/pakfire", "scripts/pakfire-build"], + scripts = ["scripts/pakfire", "scripts/pakfire-build", "scripts/pakfire-server"], cmdclass = { "build" : build_extra.build_extra, "build_i18n" : build_i18n.build_i18n }, )