import base
import client
import config
+import daemon
import logger
import packages
import repository
help=_("Run a shell after a successful build."))
sub_build.add_argument("--no-install-test", action="store_true",
help=_("Do not perform the install test."))
+ sub_build.add_argument("--private-network", action="store_true",
+ help=_("Disable network in container."))
def parse_command_shell(self):
# Implement the "shell" command.
sub_shell.add_argument("-m", "--mode", nargs="?", default="development",
help=_("Mode to run in. Is either 'release' or 'development' (default)."))
+ sub_shell.add_argument("--private-network", action="store_true",
+ help=_("Disable network in container."))
def parse_command_dist(self):
# Implement the "dist" command.
else:
raise FileNotFoundError, pkg
- # Check whether to enable the install test.
- install_test = not self.args.no_install_test
+ # Build argument list.
+ kwargs = {
+ "after_shell" : self.args.after_shell,
+ # Check whether to enable the install test.
+ "install_test" : not self.args.no_install_test,
+ "result_dir" : [self.args.resultdir,],
+ "shell" : True,
+ }
if self.args.mode == "release":
- release_build = True
+ kwargs["release_build"] = True
else:
- release_build = False
+ kwargs["release_build"] = False
+
+ if self.args.private_network:
+ kwargs["private_network"] = True
p = self.create_pakfire()
- p.build(pkg,
- install_test=install_test,
- resultdirs=[self.args.resultdir,],
- shell=True,
- after_shell=self.args.after_shell,
- release_build=release_build,
- )
+ p.build(pkg, **kwargs)
def handle_shell(self):
pkg = None
release_build = False
p = self.create_pakfire()
- p.shell(pkg, release_build=release_build)
+
+ kwargs = {
+ "release_build" : release_build,
+ }
+
+ # Private network
+ if self.args.private_network:
+ kwargs["private_network"] = True
+
+ p.shell(pkg, **kwargs)
def handle_dist(self):
# Get the packages from the command line options
# Finally parse all arguments from the command line and save them.
self.args = self.parser.parse_args()
- self.server = server.Server(**self.pakfire_args)
+ #self.server = server.Server(**self.pakfire_args)
self.action2func = {
"build" : self.handle_build,
"test" : self.handle_test,
}
- # Read configuration for the pakfire client.
+ # Read configuration.
self.config = config.ConfigClient()
# Create connection to pakfire hub.
- self.client = client.PakfireUserClient(
- self.config.get("client", "server"),
- self.config.get("client", "username"),
- self.config.get("client", "password"),
- )
+ self.client = client.PakfireClient(self.config)
@property
def pakfire_args(self):
# Format arches.
if self.args.arch:
- arches = self.args.arch.replace(",", " ")
+ arches = self.args.arch.split(",")
else:
arches = None
# Create a new build on the server.
- build = self.client.build_create(package, arches=arches)
-
- # XXX Print the resulting build.
- print build
+ build_id = self.client.build_create(package, build_type="scratch",
+ arches=arches)
finally:
# Cleanup the temporary directory and all files.
if os.path.exists(temp_dir):
shutil.rmtree(temp_dir, ignore_errors=True)
+ # Monitor the build.
+ if build_id:
+ self.watch_build(build_id)
+
def handle_info(self):
ret = []
res = self.client.test_code(error_code)
print _("Reponse from the server: %s") % res
+ def watch_build(self, build_id):
+ print self.client.build_get(build_id)
+ # XXX TODO
+ print build_id
+
class CliDaemon(Cli):
def __init__(self):
Runs the pakfire daemon with provided settings.
"""
# Read the configuration file for the daemon.
- conf = config.ConfigDaemon()
+ self.config = config.ConfigDaemon()
+ logger.setup_logging(self.config)
# Create daemon instance.
- d = pakfire.client.PakfireDaemon()
+ d = daemon.PakfireDaemon(self.config)
try:
d.run()