]> git.ipfire.org Git - pakfire.git/commitdiff
Add new script "pakfire-server" that handles all the repository stuff.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 20 Feb 2011 10:02:28 +0000 (11:02 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 20 Feb 2011 10:02:28 +0000 (11:02 +0100)
pakfire/cli.py
po/pakfire.pot
scripts/pakfire
scripts/pakfire-server [new symlink]
setup.py

index ae32c809fbf6344947cfb31b9d767588d69c468a..5bbe08a8c3afb3a08efbff6511072a3dbcef6263 100644 (file)
@@ -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)
-
index 1276e95c98a614ccc41f4aeb6531f39e3479ccc0..48e6a9250d81ebe8e5ef9e59408dc4e9e4eb21f6 100644 (file)
@@ -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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\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 ""
 
index 27cf848e9f66e928add9b568a65d6524374136a1..b5063f463021b43570161f375566e4b1312a1aee 100755 (executable)
@@ -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 (symlink)
index 0000000..83bb50a
--- /dev/null
@@ -0,0 +1 @@
+pakfire
\ No newline at end of file
index 2a139ce5419cc2c8cefc18511acc85dfdad7e99a..4dce1c11735917b3b0235872b5de1239a040d75a 100644 (file)
--- 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 },
 )