]> git.ipfire.org Git - pakfire.git/commitdiff
Fix pakfire-client CLI.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Dec 2012 11:25:32 +0000 (12:25 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Dec 2012 11:25:32 +0000 (12:25 +0100)
python/pakfire/base.py
python/pakfire/cli.py

index 75ec5e8ac654409161c46678b7d23cdb3291d74d..6cc06d58edf6a3eafb130b4c9082127f50a2293f 100644 (file)
@@ -604,6 +604,10 @@ class Pakfire(object):
                        # If the build was successful, cleanup all temporary files.
                        b.cleanup()
 
+       def dist(self, pkg, resultdir):
+               pkg = packages.Makefile(self, pkg)
+
+               return pkg.dist(resultdir=resultdir)
 
 
 class PakfireBuilder(Pakfire):
@@ -637,11 +641,6 @@ class PakfireBuilder(Pakfire):
 
                return c
 
-       def dist(self, pkg, resultdir):
-               pkg = packages.Makefile(self, pkg)
-
-               return pkg.dist(resultdir=resultdir)
-
        def build(self, pkg, resultdirs=None, shell=False, install_test=True, after_shell=False, **kwargs):
                # As the BuildEnviron is only able to handle source packages, we must package makefiles.
                if pkg.endswith(".%s" % MAKEFILE_EXTENSION):
@@ -708,6 +707,10 @@ class PakfireBuilder(Pakfire):
                        b.stop()
 
 
+class PakfireClient(Pakfire):
+       mode = "client"
+
+
 class PakfireServer(Pakfire):
        mode = "server"
 
index eadb99b144e7e6bdbd33a21d57ce92646d5abe95..0773196f4b74b17e437287b740820393a829763a 100644 (file)
@@ -846,6 +846,8 @@ class CliBuilderIntern(Cli):
 
 
 class CliClient(Cli):
+       pakfire = base.PakfireClient
+
        def __init__(self):
                self.parser = argparse.ArgumentParser(
                        description = _("Pakfire client command line interface."),
@@ -878,15 +880,21 @@ class CliClient(Cli):
                }
 
                # Read configuration for the pakfire client.
-               self.conf = conf = config.ConfigClient()
+               self.config = config.ConfigClient()
 
                # Create connection to pakfire hub.
                self.client = client.PakfireUserClient(
-                       conf.get("client", "server"),
-                       conf.get("client", "username"),
-                       conf.get("client", "password"),
+                       self.config.get("client", "server"),
+                       self.config.get("client", "username"),
+                       self.config.get("client", "password"),
                )
 
+       @property
+       def pakfire_args(self):
+               return {
+                       "config" : self.config,
+               }
+
        def parse_command_build(self):
                # Parse "build" command.
                sub_build = self.sub_commands.add_parser("build",
@@ -1003,10 +1011,10 @@ class CliClient(Cli):
                ret.append("  PAKFIRE %s" % PAKFIRE_VERSION)
                ret.append("")
                ret.append("  %-20s: %s" % (_("Hostname"), system.hostname))
-               ret.append("  %-20s: %s" % (_("Pakfire hub"), self.conf.get("client", "server")))
-               if self.conf.get("client", "username") and self.conf.get("client", "password"):
+               ret.append("  %-20s: %s" % (_("Pakfire hub"), self.config.get("client", "server")))
+               if self.config.get("client", "username") and self.config.get("client", "password"):
                        ret.append("  %-20s: %s" % \
-                               (_("Username"), self.conf.get("client", "username")))
+                               (_("Username"), self.config.get("client", "username")))
                ret.append("")
 
                # Hardware information