From 7af1fde478c91029e27251bed9f07fe20373ec3b Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 6 Dec 2012 12:25:32 +0100 Subject: [PATCH] Fix pakfire-client CLI. --- python/pakfire/base.py | 13 ++++++++----- python/pakfire/cli.py | 22 +++++++++++++++------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/python/pakfire/base.py b/python/pakfire/base.py index 75ec5e8ac..6cc06d58e 100644 --- a/python/pakfire/base.py +++ b/python/pakfire/base.py @@ -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" diff --git a/python/pakfire/cli.py b/python/pakfire/cli.py index eadb99b14..0773196f4 100644 --- a/python/pakfire/cli.py +++ b/python/pakfire/cli.py @@ -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 -- 2.39.5