From 854d8ccf218744471f4d56a21cae2be671f9fa72 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 28 Feb 2012 15:49:54 +0100 Subject: [PATCH] Improve selection of distribution for which to build. --- po/pakfire.pot | 326 ++++++++++++++-------------- python/pakfire/base.py | 14 +- python/pakfire/builder.py | 55 ++++- python/pakfire/cli.py | 11 +- python/pakfire/config.py | 21 +- python/pakfire/constants.py | 1 + python/pakfire/distro.py | 43 +++- python/pakfire/repository/base.py | 7 + python/pakfire/repository/remote.py | 18 ++ 9 files changed, 319 insertions(+), 177 deletions(-) diff --git a/po/pakfire.pot b/po/pakfire.pot index 99c89f55c..c0c3fbbb4 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: 2012-02-26 12:39+0100\n" +"POT-Creation-Date: 2012-02-28 17:29+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -78,135 +78,147 @@ msgstr "" msgid "Ignored arguments:" msgstr "" -#: ../python/pakfire/base.py:213 ../python/pakfire/base.py:243 -#: ../python/pakfire/base.py:289 ../python/pakfire/base.py:340 -#: ../python/pakfire/base.py:406 ../python/pakfire/base.py:443 -#: ../python/pakfire/base.py:496 ../python/pakfire/base.py:516 +#: ../python/pakfire/base.py:215 ../python/pakfire/base.py:245 +#: ../python/pakfire/base.py:291 ../python/pakfire/base.py:342 +#: ../python/pakfire/base.py:408 ../python/pakfire/base.py:445 +#: ../python/pakfire/base.py:498 ../python/pakfire/base.py:518 msgid "Nothing to do" msgstr "" -#: ../python/pakfire/base.py:275 +#: ../python/pakfire/base.py:277 msgid "There are no packages to install." msgstr "" -#: ../python/pakfire/base.py:330 +#: ../python/pakfire/base.py:332 #, python-format msgid "Could not find any installed package providing \"%s\"." msgstr "" -#: ../python/pakfire/base.py:336 +#: ../python/pakfire/base.py:338 #, python-format msgid "Multiple reinstall candidates for \"%(pattern)s\": %(pkgs)s" msgstr "" -#: ../python/pakfire/base.py:365 +#: ../python/pakfire/base.py:367 #, python-format msgid "Could not find package %s in a remote repository." msgstr "" -#: ../python/pakfire/base.py:434 +#: ../python/pakfire/base.py:436 #, python-format msgid "Excluding %s." msgstr "" -#: ../python/pakfire/base.py:484 +#: ../python/pakfire/base.py:486 #, python-format msgid "\"%s\" package does not seem to be installed." msgstr "" -#: ../python/pakfire/base.py:628 +#: ../python/pakfire/base.py:630 msgid "Build command has failed." msgstr "" -#: ../python/pakfire/base.py:705 +#: ../python/pakfire/base.py:707 msgid "Everything is fine." msgstr "" -#: ../python/pakfire/builder.py:135 +#: ../python/pakfire/builder.py:132 +msgid "You have not set the distribution for which you want to build." +msgstr "" + +#: ../python/pakfire/builder.py:133 +msgid "Please do so in builder.conf or on the CLI." +msgstr "" + +#: ../python/pakfire/builder.py:134 +msgid "Distribution configuration is missing." +msgstr "" + +#: ../python/pakfire/builder.py:148 #, python-format msgid "Cannot build for %s on this host." msgstr "" #. Log the package information. -#: ../python/pakfire/builder.py:165 +#: ../python/pakfire/builder.py:178 msgid "Package information:" msgstr "" #. Install all packages. -#: ../python/pakfire/builder.py:336 +#: ../python/pakfire/builder.py:349 msgid "Install packages needed for build..." msgstr "" -#: ../python/pakfire/builder.py:341 +#: ../python/pakfire/builder.py:354 msgid "Extracting" msgstr "" -#: ../python/pakfire/builder.py:610 +#: ../python/pakfire/builder.py:653 msgid "You cannot run a build when no package was given." msgstr "" -#: ../python/pakfire/builder.py:615 +#: ../python/pakfire/builder.py:658 #, python-format msgid "Could not find makefile in build root: %s" msgstr "" -#: ../python/pakfire/builder.py:640 +#: ../python/pakfire/builder.py:679 msgid "The build command failed. See logfile for details." msgstr "" #. Walk through the whole tree and collect all files #. that are on the same disk (not crossing mountpoints). -#: ../python/pakfire/builder.py:695 +#: ../python/pakfire/builder.py:734 msgid "Creating filelist..." msgstr "" #. Create a nice progressbar. -#: ../python/pakfire/builder.py:714 +#: ../python/pakfire/builder.py:753 msgid "Compressing files..." msgstr "" -#: ../python/pakfire/builder.py:733 +#: ../python/pakfire/builder.py:772 #, python-format msgid "Cache file was successfully created at %s." msgstr "" -#: ../python/pakfire/builder.py:734 +#: ../python/pakfire/builder.py:773 #, python-format msgid " Containing %(files)s files, it has a size of %(size)s." msgstr "" #. Make a nice progress bar as always. -#: ../python/pakfire/builder.py:745 +#: ../python/pakfire/builder.py:784 msgid "Extracting files..." msgstr "" #. Update all packages. -#: ../python/pakfire/builder.py:765 +#: ../python/pakfire/builder.py:804 msgid "Updating packages from cache..." msgstr "" #. Package the result. #. Make all these little package from the build environment. -#: ../python/pakfire/builder.py:893 +#: ../python/pakfire/builder.py:932 msgid "Creating packages:" msgstr "" #. Execute the buildscript of this stage. -#: ../python/pakfire/builder.py:913 +#: ../python/pakfire/builder.py:952 #, python-format msgid "Running stage %s:" msgstr "" -#: ../python/pakfire/builder.py:931 +#: ../python/pakfire/builder.py:970 #, python-format msgid "Could not remove static libraries: %s" msgstr "" -#: ../python/pakfire/builder.py:937 +#: ../python/pakfire/builder.py:976 msgid "Compressing man pages did not complete successfully." msgstr "" -#: ../python/pakfire/builder.py:957 +#: ../python/pakfire/builder.py:996 msgid "Extracting debuginfo did not complete with success. Aborting build." msgstr "" @@ -218,487 +230,487 @@ msgstr "" msgid "The path where pakfire should operate in." msgstr "" -#: ../python/pakfire/cli.py:123 +#: ../python/pakfire/cli.py:128 msgid "Enable verbose output." msgstr "" -#: ../python/pakfire/cli.py:126 +#: ../python/pakfire/cli.py:131 msgid "Path to a configuration file to load." msgstr "" -#: ../python/pakfire/cli.py:130 +#: ../python/pakfire/cli.py:135 msgid "Disable a repository temporarily." msgstr "" -#: ../python/pakfire/cli.py:133 +#: ../python/pakfire/cli.py:138 msgid "Enable a repository temporarily." msgstr "" -#: ../python/pakfire/cli.py:137 +#: ../python/pakfire/cli.py:142 msgid "Run pakfire in offline mode." msgstr "" -#: ../python/pakfire/cli.py:142 +#: ../python/pakfire/cli.py:147 msgid "Install one or more packages to the system." msgstr "" -#: ../python/pakfire/cli.py:144 +#: ../python/pakfire/cli.py:149 msgid "Give name of at least one package to install." msgstr "" -#: ../python/pakfire/cli.py:150 +#: ../python/pakfire/cli.py:155 msgid "Install one or more packages from the filesystem." msgstr "" -#: ../python/pakfire/cli.py:152 +#: ../python/pakfire/cli.py:157 msgid "Give filename of at least one package." msgstr "" -#: ../python/pakfire/cli.py:158 +#: ../python/pakfire/cli.py:163 msgid "Reinstall one or more packages." msgstr "" -#: ../python/pakfire/cli.py:160 +#: ../python/pakfire/cli.py:165 msgid "Give name of at least one package to reinstall." msgstr "" -#: ../python/pakfire/cli.py:166 +#: ../python/pakfire/cli.py:171 msgid "Remove one or more packages from the system." msgstr "" -#: ../python/pakfire/cli.py:168 +#: ../python/pakfire/cli.py:173 msgid "Give name of at least one package to remove." msgstr "" -#: ../python/pakfire/cli.py:174 +#: ../python/pakfire/cli.py:179 msgid "Give a name of a package to update or leave emtpy for all." msgstr "" -#: ../python/pakfire/cli.py:176 +#: ../python/pakfire/cli.py:181 msgid "Exclude package from update." msgstr "" -#: ../python/pakfire/cli.py:178 ../python/pakfire/cli.py:203 +#: ../python/pakfire/cli.py:183 ../python/pakfire/cli.py:208 msgid "Allow changing the vendor of packages." msgstr "" -#: ../python/pakfire/cli.py:180 ../python/pakfire/cli.py:205 +#: ../python/pakfire/cli.py:185 ../python/pakfire/cli.py:210 msgid "Allow changing the architecture of packages." msgstr "" -#: ../python/pakfire/cli.py:185 +#: ../python/pakfire/cli.py:190 msgid "Update the whole system or one specific package." msgstr "" -#: ../python/pakfire/cli.py:192 +#: ../python/pakfire/cli.py:197 msgid "Check, if there are any updates available." msgstr "" -#: ../python/pakfire/cli.py:199 +#: ../python/pakfire/cli.py:204 msgid "Downgrade one or more packages." msgstr "" -#: ../python/pakfire/cli.py:201 +#: ../python/pakfire/cli.py:206 msgid "Give a name of a package to downgrade." msgstr "" -#: ../python/pakfire/cli.py:211 +#: ../python/pakfire/cli.py:216 msgid "Print some information about the given package(s)." msgstr "" -#: ../python/pakfire/cli.py:213 +#: ../python/pakfire/cli.py:218 msgid "Give at least the name of one package." msgstr "" -#: ../python/pakfire/cli.py:219 +#: ../python/pakfire/cli.py:224 msgid "Search for a given pattern." msgstr "" -#: ../python/pakfire/cli.py:221 +#: ../python/pakfire/cli.py:226 msgid "A pattern to search for." msgstr "" -#: ../python/pakfire/cli.py:227 +#: ../python/pakfire/cli.py:232 msgid "Get a list of packages that provide a given file or feature." msgstr "" -#: ../python/pakfire/cli.py:229 +#: ../python/pakfire/cli.py:234 msgid "File or feature to search for." msgstr "" -#: ../python/pakfire/cli.py:235 +#: ../python/pakfire/cli.py:240 msgid "Get list of packages that belong to the given group." msgstr "" -#: ../python/pakfire/cli.py:237 +#: ../python/pakfire/cli.py:242 msgid "Group name to search for." msgstr "" -#: ../python/pakfire/cli.py:243 +#: ../python/pakfire/cli.py:248 msgid "Install all packages that belong to the given group." msgstr "" -#: ../python/pakfire/cli.py:245 +#: ../python/pakfire/cli.py:250 msgid "Group name." msgstr "" -#: ../python/pakfire/cli.py:251 +#: ../python/pakfire/cli.py:256 msgid "List all currently enabled repositories." msgstr "" -#: ../python/pakfire/cli.py:255 +#: ../python/pakfire/cli.py:260 msgid "Cleanup commands." msgstr "" -#: ../python/pakfire/cli.py:263 +#: ../python/pakfire/cli.py:268 msgid "Cleanup all temporary files." msgstr "" -#: ../python/pakfire/cli.py:269 +#: ../python/pakfire/cli.py:274 msgid "Check the system for any errors." msgstr "" -#: ../python/pakfire/cli.py:275 +#: ../python/pakfire/cli.py:280 msgid "Check the dependencies for a particular package." msgstr "" -#: ../python/pakfire/cli.py:277 +#: ../python/pakfire/cli.py:282 msgid "Give name of at least one package to check." msgstr "" -#: ../python/pakfire/cli.py:353 ../python/pakfire/transaction.py:352 +#: ../python/pakfire/cli.py:358 ../python/pakfire/transaction.py:352 msgid "Repository" msgstr "" -#: ../python/pakfire/cli.py:353 +#: ../python/pakfire/cli.py:358 msgid "Enabled" msgstr "" -#: ../python/pakfire/cli.py:353 ../python/pakfire/cli.py:1014 +#: ../python/pakfire/cli.py:358 ../python/pakfire/cli.py:1022 msgid "Priority" msgstr "" -#: ../python/pakfire/cli.py:353 ../python/pakfire/cli.py:1059 +#: ../python/pakfire/cli.py:358 ../python/pakfire/cli.py:1067 msgid "Packages" msgstr "" -#: ../python/pakfire/cli.py:365 +#: ../python/pakfire/cli.py:370 msgid "Cleaning up everything..." msgstr "" -#: ../python/pakfire/cli.py:381 +#: ../python/pakfire/cli.py:386 msgid "You cannot run pakfire-builder in a pakfire chroot." msgstr "" -#: ../python/pakfire/cli.py:384 ../python/pakfire/cli.py:720 +#: ../python/pakfire/cli.py:389 ../python/pakfire/cli.py:725 msgid "Pakfire builder command line interface." msgstr "" -#: ../python/pakfire/cli.py:442 +#: ../python/pakfire/cli.py:447 msgid "Update the package indexes." msgstr "" -#: ../python/pakfire/cli.py:448 ../python/pakfire/cli.py:740 +#: ../python/pakfire/cli.py:453 ../python/pakfire/cli.py:745 msgid "Build one or more packages." msgstr "" -#: ../python/pakfire/cli.py:450 ../python/pakfire/cli.py:634 -#: ../python/pakfire/cli.py:742 +#: ../python/pakfire/cli.py:455 ../python/pakfire/cli.py:639 +#: ../python/pakfire/cli.py:747 msgid "Give name of at least one package to build." msgstr "" -#: ../python/pakfire/cli.py:454 ../python/pakfire/cli.py:746 -#: ../python/pakfire/cli.py:817 +#: ../python/pakfire/cli.py:459 ../python/pakfire/cli.py:751 +#: ../python/pakfire/cli.py:825 msgid "Build the package for the given architecture." msgstr "" -#: ../python/pakfire/cli.py:456 ../python/pakfire/cli.py:484 -#: ../python/pakfire/cli.py:748 +#: ../python/pakfire/cli.py:461 ../python/pakfire/cli.py:489 +#: ../python/pakfire/cli.py:753 msgid "Path were the output files should be copied to." msgstr "" -#: ../python/pakfire/cli.py:458 ../python/pakfire/cli.py:473 -#: ../python/pakfire/cli.py:750 +#: ../python/pakfire/cli.py:463 ../python/pakfire/cli.py:478 +#: ../python/pakfire/cli.py:755 msgid "Mode to run in. Is either 'release' or 'development' (default)." msgstr "" -#: ../python/pakfire/cli.py:460 +#: ../python/pakfire/cli.py:465 msgid "Run a shell after a successful build." msgstr "" -#: ../python/pakfire/cli.py:465 +#: ../python/pakfire/cli.py:470 msgid "Go into a shell." msgstr "" -#: ../python/pakfire/cli.py:467 +#: ../python/pakfire/cli.py:472 msgid "Give name of a package." msgstr "" -#: ../python/pakfire/cli.py:471 +#: ../python/pakfire/cli.py:476 msgid "Emulated architecture in the shell." msgstr "" -#: ../python/pakfire/cli.py:478 +#: ../python/pakfire/cli.py:483 msgid "Generate a source package." msgstr "" -#: ../python/pakfire/cli.py:480 +#: ../python/pakfire/cli.py:485 msgid "Give name(s) of a package(s)." msgstr "" -#: ../python/pakfire/cli.py:489 +#: ../python/pakfire/cli.py:494 msgid "Create a build environment cache." msgstr "" -#: ../python/pakfire/cli.py:499 +#: ../python/pakfire/cli.py:504 msgid "Create a new build environment cache." msgstr "" -#: ../python/pakfire/cli.py:504 +#: ../python/pakfire/cli.py:509 msgid "Remove all cached build environments." msgstr "" -#: ../python/pakfire/cli.py:581 +#: ../python/pakfire/cli.py:586 #, python-format msgid "Removing environment cache file: %s..." msgstr "" -#: ../python/pakfire/cli.py:587 +#: ../python/pakfire/cli.py:592 #, python-format msgid "Could not remove file: %s" msgstr "" -#: ../python/pakfire/cli.py:593 +#: ../python/pakfire/cli.py:598 msgid "Pakfire server command line interface." msgstr "" -#: ../python/pakfire/cli.py:632 +#: ../python/pakfire/cli.py:637 msgid "Send a scrach build job to the server." msgstr "" -#: ../python/pakfire/cli.py:636 +#: ../python/pakfire/cli.py:641 msgid "Limit build to only these architecture(s)." msgstr "" -#: ../python/pakfire/cli.py:642 +#: ../python/pakfire/cli.py:647 msgid "Send a keepalive to the server." msgstr "" -#: ../python/pakfire/cli.py:649 +#: ../python/pakfire/cli.py:654 msgid "Update all repositories." msgstr "" -#: ../python/pakfire/cli.py:655 +#: ../python/pakfire/cli.py:660 msgid "Repository management commands." msgstr "" -#: ../python/pakfire/cli.py:663 +#: ../python/pakfire/cli.py:668 msgid "Create a new repository index." msgstr "" -#: ../python/pakfire/cli.py:664 +#: ../python/pakfire/cli.py:669 msgid "Path to the packages." msgstr "" -#: ../python/pakfire/cli.py:665 +#: ../python/pakfire/cli.py:670 msgid "Path to input packages." msgstr "" -#: ../python/pakfire/cli.py:670 +#: ../python/pakfire/cli.py:675 msgid "Dump some information about this machine." msgstr "" -#: ../python/pakfire/cli.py:752 +#: ../python/pakfire/cli.py:757 msgid "Do not verify build dependencies." msgstr "" -#: ../python/pakfire/cli.py:771 +#: ../python/pakfire/cli.py:779 msgid "Pakfire client command line interface." msgstr "" -#: ../python/pakfire/cli.py:811 +#: ../python/pakfire/cli.py:819 msgid "Build a package remotely." msgstr "" -#: ../python/pakfire/cli.py:813 +#: ../python/pakfire/cli.py:821 msgid "Give name of a package to build." msgstr "" -#: ../python/pakfire/cli.py:822 +#: ../python/pakfire/cli.py:830 msgid "Print some information about this host." msgstr "" -#: ../python/pakfire/cli.py:828 +#: ../python/pakfire/cli.py:836 msgid "Check the connection to the hub." msgstr "" -#: ../python/pakfire/cli.py:833 +#: ../python/pakfire/cli.py:841 msgid "Show information about build jobs." msgstr "" -#: ../python/pakfire/cli.py:843 +#: ../python/pakfire/cli.py:851 msgid "Show a list of all active jobs." msgstr "" -#: ../python/pakfire/cli.py:848 +#: ../python/pakfire/cli.py:856 msgid "Show a list of all recently finished of failed build jobs." msgstr "" -#: ../python/pakfire/cli.py:853 +#: ../python/pakfire/cli.py:861 msgid "Show details about given build job." msgstr "" -#: ../python/pakfire/cli.py:854 +#: ../python/pakfire/cli.py:862 msgid "The ID of the build job." msgstr "" -#: ../python/pakfire/cli.py:859 +#: ../python/pakfire/cli.py:867 msgid "Show information about builds." msgstr "" -#: ../python/pakfire/cli.py:867 +#: ../python/pakfire/cli.py:875 msgid "Show details about the given build." msgstr "" -#: ../python/pakfire/cli.py:868 +#: ../python/pakfire/cli.py:876 msgid "The ID of the build." msgstr "" -#: ../python/pakfire/cli.py:916 ../python/pakfire/server.py:303 +#: ../python/pakfire/cli.py:924 ../python/pakfire/server.py:303 msgid "Hostname" msgstr "" -#: ../python/pakfire/cli.py:917 +#: ../python/pakfire/cli.py:925 msgid "Pakfire hub" msgstr "" -#: ../python/pakfire/cli.py:920 +#: ../python/pakfire/cli.py:928 msgid "Username" msgstr "" #. Hardware information -#: ../python/pakfire/cli.py:924 ../python/pakfire/server.py:307 +#: ../python/pakfire/cli.py:932 ../python/pakfire/server.py:307 msgid "Hardware information" msgstr "" -#: ../python/pakfire/cli.py:925 ../python/pakfire/server.py:308 +#: ../python/pakfire/cli.py:933 ../python/pakfire/server.py:308 msgid "CPU model" msgstr "" -#: ../python/pakfire/cli.py:926 ../python/pakfire/server.py:309 +#: ../python/pakfire/cli.py:934 ../python/pakfire/server.py:309 msgid "Memory" msgstr "" -#: ../python/pakfire/cli.py:928 ../python/pakfire/server.py:311 +#: ../python/pakfire/cli.py:936 ../python/pakfire/server.py:311 msgid "Native arch" msgstr "" -#: ../python/pakfire/cli.py:930 +#: ../python/pakfire/cli.py:938 msgid "Default arch" msgstr "" -#: ../python/pakfire/cli.py:932 ../python/pakfire/server.py:313 +#: ../python/pakfire/cli.py:940 ../python/pakfire/server.py:313 msgid "Supported arches" msgstr "" -#: ../python/pakfire/cli.py:945 +#: ../python/pakfire/cli.py:953 msgid "Your IP address" msgstr "" -#: ../python/pakfire/cli.py:950 +#: ../python/pakfire/cli.py:958 msgid "You are authenticated to the build service:" msgstr "" -#: ../python/pakfire/cli.py:956 +#: ../python/pakfire/cli.py:964 msgid "User name" msgstr "" -#: ../python/pakfire/cli.py:957 +#: ../python/pakfire/cli.py:965 msgid "Real name" msgstr "" -#: ../python/pakfire/cli.py:958 +#: ../python/pakfire/cli.py:966 msgid "Email address" msgstr "" -#: ../python/pakfire/cli.py:959 +#: ../python/pakfire/cli.py:967 msgid "Registered" msgstr "" -#: ../python/pakfire/cli.py:966 +#: ../python/pakfire/cli.py:974 msgid "You could not be authenticated to the build service." msgstr "" -#: ../python/pakfire/cli.py:987 +#: ../python/pakfire/cli.py:995 msgid "No ongoing jobs found." msgstr "" -#: ../python/pakfire/cli.py:990 +#: ../python/pakfire/cli.py:998 msgid "Active build jobs" msgstr "" -#: ../python/pakfire/cli.py:996 +#: ../python/pakfire/cli.py:1004 msgid "No jobs found." msgstr "" -#: ../python/pakfire/cli.py:999 +#: ../python/pakfire/cli.py:1007 msgid "Recently processed build jobs" msgstr "" -#: ../python/pakfire/cli.py:1006 +#: ../python/pakfire/cli.py:1014 #, python-format msgid "A build with ID %s could not be found." msgstr "" -#: ../python/pakfire/cli.py:1009 +#: ../python/pakfire/cli.py:1017 #, python-format msgid "Build: %(name)s" msgstr "" -#: ../python/pakfire/cli.py:1013 ../python/pakfire/cli.py:1041 +#: ../python/pakfire/cli.py:1021 ../python/pakfire/cli.py:1049 msgid "State" msgstr "" -#: ../python/pakfire/cli.py:1017 +#: ../python/pakfire/cli.py:1025 msgid "Jobs" msgstr "" -#: ../python/pakfire/cli.py:1030 +#: ../python/pakfire/cli.py:1038 #, python-format msgid "A job with ID %s could not be found." msgstr "" -#: ../python/pakfire/cli.py:1037 +#: ../python/pakfire/cli.py:1045 #, python-format msgid "Job: %(name)s" msgstr "" -#: ../python/pakfire/cli.py:1042 ../python/pakfire/packages/base.py:107 +#: ../python/pakfire/cli.py:1050 ../python/pakfire/packages/base.py:107 #: ../python/pakfire/transaction.py:351 msgid "Arch" msgstr "" -#: ../python/pakfire/cli.py:1047 ../python/pakfire/packages/base.py:142 +#: ../python/pakfire/cli.py:1055 ../python/pakfire/packages/base.py:142 msgid "Build host" msgstr "" -#: ../python/pakfire/cli.py:1052 +#: ../python/pakfire/cli.py:1060 msgid "Time created" msgstr "" -#: ../python/pakfire/cli.py:1053 +#: ../python/pakfire/cli.py:1061 msgid "Time started" msgstr "" -#: ../python/pakfire/cli.py:1054 +#: ../python/pakfire/cli.py:1062 msgid "Time finished" msgstr "" -#: ../python/pakfire/cli.py:1055 +#: ../python/pakfire/cli.py:1063 msgid "Duration" msgstr "" -#: ../python/pakfire/cli.py:1078 +#: ../python/pakfire/cli.py:1086 msgid "Pakfire daemon command line interface." msgstr "" @@ -717,20 +729,20 @@ msgstr "" msgid "Given algorithm '%s' is not supported." msgstr "" -#: ../python/pakfire/config.py:192 +#: ../python/pakfire/config.py:196 msgid "Configuration:" msgstr "" -#: ../python/pakfire/config.py:194 +#: ../python/pakfire/config.py:198 #, python-format msgid "Section: %s" msgstr "" -#: ../python/pakfire/config.py:199 +#: ../python/pakfire/config.py:203 msgid "No settings in this section." msgstr "" -#: ../python/pakfire/config.py:201 +#: ../python/pakfire/config.py:205 msgid "Loaded from files:" msgstr "" diff --git a/python/pakfire/base.py b/python/pakfire/base.py index 2c02c4996..2a7d2263c 100644 --- a/python/pakfire/base.py +++ b/python/pakfire/base.py @@ -25,7 +25,6 @@ import string import actions import builder -import config import distro import filelist import logger @@ -38,6 +37,7 @@ import util import logging log = logging.getLogger("pakfire") +from config import Config from constants import * from i18n import _ @@ -50,7 +50,7 @@ class Pakfire(object): (">" , satsolver.REL_GT,), ) - def __init__(self, mode=None, path="/", configs=None, arch=None, + def __init__(self, mode=None, path="/", config=None, configs=None, arch=None, enable_repos=None, disable_repos=None, **kwargs): if kwargs: @@ -75,11 +75,13 @@ class Pakfire(object): if self.path == "/": self.check_is_ipfire() - # Read configuration file(s). - if mode == "builder": - self.config = config.ConfigBuilder(files=configs) + # Get the configuration. + if config: + assert configs is None, "You cannot pass configs and config." + self.config = config else: - self.config = config.Config(files=configs) + # Read configuration file(s). + self.config = Config(files=configs) # Dump the configuration. self.config.dump() diff --git a/python/pakfire/builder.py b/python/pakfire/builder.py index e95874c43..517ff27e5 100644 --- a/python/pakfire/builder.py +++ b/python/pakfire/builder.py @@ -42,6 +42,7 @@ import _pakfire import logging log = logging.getLogger("pakfire") +from config import ConfigBuilder from system import system from constants import * from i18n import _ @@ -65,7 +66,7 @@ class BuildEnviron(object): # The version of the kernel this machine is running. kernel_version = os.uname()[2] - def __init__(self, filename=None, configs=None, arch=None, build_id=None, logfile=None, + def __init__(self, filename=None, distro_name=None, configs=None, arch=None, build_id=None, logfile=None, builder_mode="release", use_cache=None, **pakfire_args): # Set mode. assert builder_mode in ("development", "release",) @@ -120,9 +121,21 @@ class BuildEnviron(object): if pakfire_args.has_key("mode"): del pakfire_args["mode"] + config = ConfigBuilder(files=configs) + if not configs: + if distro_name is None: + distro_name = config.get("builder", "distro", None) + + config.load_distro_config(distro_name) + + if not config.has_distro(): + log.error(_("You have not set the distribution for which you want to build.")) + log.error(_("Please do so in builder.conf or on the CLI.")) + raise ConfigError, _("Distribution configuration is missing.") + self.pakfire = base.Pakfire( mode="builder", - configs=configs, + config=config, arch=arch, **pakfire_args ) @@ -568,6 +581,36 @@ class BuildEnviron(object): # Return an iterator over the packages. return iter(repo) + def write_config(self): + # Cleanup everything in /etc/pakfire. + util.rm(self.chrootPath(CONFIG_DIR)) + + for i in (CONFIG_DIR, CONFIG_REPOS_DIR): + i = self.chrootPath(i) + if not os.path.exists(i): + os.makedirs(i) + + # Write general.conf. + f = open(self.chrootPath(CONFIG_DIR, "general.conf"), "w") + f.close() + + # Write builder.conf. + f = open(self.chrootPath(CONFIG_DIR, "builder.conf"), "w") + f.write(self.distro.get_config()) + f.close() + + # Create pakfire configuration files. + for repo in self.pakfire.repos: + conf = repo.get_config() + + if not conf: + continue + + filename = self.chrootPath(CONFIG_REPOS_DIR, "%s.repo" % repo.name) + f = open(filename, "w") + f.write("\n".join(conf)) + f.close() + def do(self, command, shell=True, personality=None, logger=None, *args, **kwargs): ret = None @@ -615,11 +658,8 @@ class BuildEnviron(object): raise BuildError, _("Could not find makefile in build root: %s") % pkgfile pkgfile = "/%s" % os.path.relpath(pkgfile, self.chrootPath()) - # Create pakfire configuration file. - cfgfile = "/tmp/pakfire.conf" - f = open(self.chrootPath(cfgfile), "w") - f.write(self.distro.get_config()) - f.close() + # Write pakfire configuration into the chroot. + self.write_config() # Create the build command, that is executed in the chroot. build_command = [ @@ -629,7 +669,6 @@ class BuildEnviron(object): pkgfile, "--arch", self.arch, "--nodeps", - "--config=%s" % cfgfile, "--resultdir=/result", ] diff --git a/python/pakfire/cli.py b/python/pakfire/cli.py index 6f702a62f..8bab886fd 100644 --- a/python/pakfire/cli.py +++ b/python/pakfire/cli.py @@ -113,6 +113,11 @@ class Cli(object): if hasattr(self.args, "offline"): ret["offline"] = self.args.offline + if hasattr(self.args, "config"): + ret["configs"] = self.args.config + else: + ret["configs"] = None + return ret def parse_common_arguments(self, repo_manage_switches=True, offline_switch=True): @@ -761,8 +766,10 @@ class CliBuilderIntern(Cli): else: raise FileNotFoundError, pkg - pakfire._build(pkg, builder_mode=self.args.mode, - arch=self.args.arch, resultdir=self.args.resultdir,) + conf = config.ConfigBuilder() + + pakfire._build(pkg, builder_mode=self.args.mode, config=conf, + arch=self.args.arch, resultdir=self.args.resultdir) class CliClient(Cli): diff --git a/python/pakfire/config.py b/python/pakfire/config.py index 467b36aa9..c7ab14301 100644 --- a/python/pakfire/config.py +++ b/python/pakfire/config.py @@ -66,6 +66,10 @@ class _Config(object): if repo_path: self.read_dir(repo_path, ext=".repo") + # Always read overwrite.conf. + # This is a undocumented feature to make bootstrapping easier. + self.read("overwrite.conf") + def get_repos(self): repos = [] @@ -202,13 +206,28 @@ class _Config(object): for f in self._files: log.debug(" %s" % f) + def has_distro(self): + return self._config.has_key("distro") + class Config(_Config): files = ["general.conf"] class ConfigBuilder(_Config): - files = ["general.conf", "builder.conf", "default.conf"] + files = ["general.conf", "builder.conf"] + + def load_distro_config(self, distro_name): + if distro_name is None: + return False + + filename = os.path.join(CONFIG_DISTRO_DIR, "%s.conf" % distro_name) + + if not os.path.exists(filename): + return False + + self.read(filename) + return True class ConfigClient(_Config): diff --git a/python/pakfire/constants.py b/python/pakfire/constants.py index 10d4b5c75..725c8aa05 100644 --- a/python/pakfire/constants.py +++ b/python/pakfire/constants.py @@ -32,6 +32,7 @@ SCRIPT_DIR = "/usr/lib/pakfire" CONFIG_DIR = os.path.join(SYSCONFDIR, "pakfire") CONFIG_REPOS_DIR = os.path.join(CONFIG_DIR, "repos") +CONFIG_DISTRO_DIR = os.path.join(CONFIG_DIR, "distros") CACHE_DIR = "/var/cache/pakfire" CCACHE_CACHE_DIR = os.path.join(CACHE_DIR, "ccache") diff --git a/python/pakfire/distro.py b/python/pakfire/distro.py index 70a004235..1f78cc089 100644 --- a/python/pakfire/distro.py +++ b/python/pakfire/distro.py @@ -20,6 +20,7 @@ ############################################################################### import os +import re import logging log = logging.getLogger("pakfire") @@ -29,16 +30,52 @@ from repository import Repositories from system import system class Distribution(object): - def __init__(self, pakfire): + def __init__(self, pakfire, data=None): self.pakfire = pakfire self._data = {} - # Inherit configuration from Pakfire configuration. - self.update(self.pakfire.config.get_section("distro")) + if data is None: + # Inherit configuration from Pakfire configuration. + self.update(self.pakfire.config.get_section("distro")) + else: + self._data = data # Dump all data self.dump() + @classmethod + def from_osrelease(cls, pakfire, path="/"): + filename = os.path.join(path, "etc", "os-release") + + if not os.path.exists(filename): + raise Exception, "Could not find %s." % filename + + keymap = { + "NAME" : "name", + "VERSION_ID" : "release", + } + + data = {} + + f = open(filename) + for line in f.readlines(): + m = re.match(r"^(.*)=(.*)$", line) + if m: + k, v = m.groups() + + v = v.replace("\"", "") + v = v.strip() + + try: + k = keymap[k] + except KeyError: + continue + + data[k] = v + f.close() + + return cls(pakfire, data) + @property def config(self): return self.pakfire.config diff --git a/python/pakfire/repository/base.py b/python/pakfire/repository/base.py index e606826c1..7fb836207 100644 --- a/python/pakfire/repository/base.py +++ b/python/pakfire/repository/base.py @@ -142,6 +142,13 @@ class RepositoryFactory(object): return "\n\n".join(dumps) + def get_config(self): + """ + Return the configuration as a list of string which + can be written to a configuration file. + """ + pass + class RepositoryDummy(RepositoryFactory): """ diff --git a/python/pakfire/repository/remote.py b/python/pakfire/repository/remote.py index a261320f7..5118cc42b 100644 --- a/python/pakfire/repository/remote.py +++ b/python/pakfire/repository/remote.py @@ -137,3 +137,21 @@ class RepositorySolv(base.RepositoryFactory): raise Exception, "XXX this should never happen..." return os.path.join(self.cache.path, cache_filename) + + def get_config(self): + if self.enabled: + enabled = "1" + else: + enabled = "0" + + lines = [ + "[repo:%s]" % self.name, + "description = %s" % self.description, + "enabled = %s" % enabled, + "baseurl = %s" % self.baseurl, + "mirrors = %s" % self._mirrors, + #"gpgkey = %s" % self.gpgkey, + "priority = %s" % self._priority, + ] + + return lines -- 2.39.5