From f22069bb9e82bbb9d883c9881aecc7d6182d6a15 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 23 Jul 2011 13:13:21 +0200 Subject: [PATCH] Add --mode switch for "pakfire-build build ..." command. --mode=release will only build with official repositories and disable the build repository which is also enabled when running with --mode=development. --mode=development is the default for pakfire-build. --mode=release is the default for pakfire-server. --- pakfire/builder.py | 13 ++++++++++++- pakfire/cli.py | 6 ++++-- po/pakfire.pot | 40 ++++++++++++++++++++++------------------ 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/pakfire/builder.py b/pakfire/builder.py index a0d69162c..b530364d0 100644 --- a/pakfire/builder.py +++ b/pakfire/builder.py @@ -42,7 +42,18 @@ class Builder(object): kernel_version = os.uname()[2] def __init__(self, pkg=None, distro_config=None, build_id=None, logfile=None, - **pakfire_args): + builder_mode="release", **pakfire_args): + # Set mode. + assert builder_mode in ("development", "release",) + self.mode = builder_mode + + # Disable the build repository in release mode. + if self.mode == "release": + if pakfire_args.has_key("disable_repos") and pakfire_args["disable_repos"]: + pakfire_args["disable_repos"] += ["build",] + else: + pakfire_args["disable_repos"] = ["build",] + # Save the build id and generate one if no build id was provided. if not build_id: build_id = "%s" % uuid.uuid4() diff --git a/pakfire/cli.py b/pakfire/cli.py index 49c60701a..a70d8747e 100644 --- a/pakfire/cli.py +++ b/pakfire/cli.py @@ -316,6 +316,8 @@ class CliBuilder(Cli): help=_("Build the package for the given architecture.")) sub_build.add_argument("--resultdir", nargs="?", help=_("Path were the output files should be copied to.")) + sub_build.add_argument("-m", "--mode", nargs="?", default="development", + help=_("Mode to run in. Is either 'release' or 'development' (default).")) def parse_command_shell(self): # Implement the "shell" command. @@ -358,8 +360,8 @@ class CliBuilder(Cli): "arch" : self.args.arch, } - pakfire.build(pkg, distro_config=distro_config, resultdirs=[self.args.resultdir,], - shell=True, **self.pakfire_args) + pakfire.build(pkg, builder_mode=self.args.mode, distro_config=distro_config, + resultdirs=[self.args.resultdir,], shell=True, **self.pakfire_args) def handle_shell(self): pkg = None diff --git a/po/pakfire.pot b/po/pakfire.pot index bea417d2e..958dee78d 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-07-21 16:26+0200\n" +"POT-Creation-Date: 2011-07-22 17:04+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -34,7 +34,7 @@ msgstr "" msgid "Downgrading" msgstr "" -#: ../pakfire/builder.py:246 +#: ../pakfire/builder.py:259 #, python-format msgid "Extracting: %s (source)" msgstr "" @@ -187,67 +187,71 @@ msgstr "" msgid "Build the package for the given architecture." msgstr "" -#: ../pakfire/cli.py:318 ../pakfire/cli.py:340 +#: ../pakfire/cli.py:318 ../pakfire/cli.py:342 msgid "Path were the output files should be copied to." msgstr "" -#: ../pakfire/cli.py:323 -msgid "Go into a shell." +#: ../pakfire/cli.py:320 +msgid "Mode to run in. Is either 'release' or 'development' (default)." msgstr "" #: ../pakfire/cli.py:325 +msgid "Go into a shell." +msgstr "" + +#: ../pakfire/cli.py:327 msgid "Give name of a package." msgstr "" -#: ../pakfire/cli.py:329 +#: ../pakfire/cli.py:331 msgid "Emulated architecture in the shell." msgstr "" -#: ../pakfire/cli.py:334 +#: ../pakfire/cli.py:336 msgid "Generate a source package." msgstr "" -#: ../pakfire/cli.py:336 +#: ../pakfire/cli.py:338 msgid "Give name(s) of a package(s)." msgstr "" -#: ../pakfire/cli.py:411 +#: ../pakfire/cli.py:413 msgid "Pakfire repo command line interface." msgstr "" -#: ../pakfire/cli.py:436 +#: ../pakfire/cli.py:438 msgid "Repository management commands." msgstr "" -#: ../pakfire/cli.py:444 +#: ../pakfire/cli.py:446 msgid "Create a new repository index." msgstr "" -#: ../pakfire/cli.py:445 +#: ../pakfire/cli.py:447 msgid "Path to the packages." msgstr "" -#: ../pakfire/cli.py:446 +#: ../pakfire/cli.py:448 msgid "Path to input packages." msgstr "" -#: ../pakfire/cli.py:458 +#: ../pakfire/cli.py:460 msgid "Pakfire master command line interface." msgstr "" -#: ../pakfire/cli.py:486 +#: ../pakfire/cli.py:488 msgid "Update the sources." msgstr "" -#: ../pakfire/cli.py:496 +#: ../pakfire/cli.py:498 msgid "Pakfire server command line interface." msgstr "" -#: ../pakfire/cli.py:526 +#: ../pakfire/cli.py:528 msgid "Request a build job from the server." msgstr "" -#: ../pakfire/cli.py:532 +#: ../pakfire/cli.py:534 msgid "Send a keepalive to the server." msgstr "" -- 2.39.5