]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
pakfire-client: Add some very basic functions to query PBS.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 22 Feb 2012 14:10:49 +0000 (15:10 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 22 Feb 2012 14:10:49 +0000 (15:10 +0100)
po/pakfire.pot
python/pakfire/cli.py
python/pakfire/client/base.py

index b3a31ba1c605d27f6e09f5ff56c708982861364c..358d3be2b3bf2b57e4038488c16b3ccc0854370a 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-02-11 16:41+0100\n"
+"POT-Creation-Date: 2012-02-22 15:10+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -124,476 +124,577 @@ msgid "Cannot build for %s on this host."
 msgstr ""
 
 #. Log the package information.
-#: ../python/pakfire/builder.py:159
+#: ../python/pakfire/builder.py:158
 msgid "Package information:"
 msgstr ""
 
 #. Install all packages.
-#: ../python/pakfire/builder.py:330
+#: ../python/pakfire/builder.py:329
 msgid "Install packages needed for build..."
 msgstr ""
 
-#: ../python/pakfire/builder.py:335
+#: ../python/pakfire/builder.py:334
 msgid "Extracting"
 msgstr ""
 
-#: ../python/pakfire/builder.py:604
+#: ../python/pakfire/builder.py:603
 msgid "You cannot run a build when no package was given."
 msgstr ""
 
-#: ../python/pakfire/builder.py:609
+#: ../python/pakfire/builder.py:608
 #, python-format
 msgid "Could not find makefile in build root: %s"
 msgstr ""
 
-#: ../python/pakfire/builder.py:623
+#: ../python/pakfire/builder.py:622
 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:681
+#: ../python/pakfire/builder.py:680
 msgid "Creating filelist..."
 msgstr ""
 
 #. Create a nice progressbar.
-#: ../python/pakfire/builder.py:700
+#: ../python/pakfire/builder.py:699
 msgid "Compressing files..."
 msgstr ""
 
-#: ../python/pakfire/builder.py:719
+#: ../python/pakfire/builder.py:718
 #, python-format
 msgid "Cache file was successfully created at %s."
 msgstr ""
 
-#: ../python/pakfire/builder.py:720
+#: ../python/pakfire/builder.py:719
 #, 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:731
+#: ../python/pakfire/builder.py:730
 msgid "Extracting files..."
 msgstr ""
 
 #. Update all packages.
-#: ../python/pakfire/builder.py:751
+#: ../python/pakfire/builder.py:750
 msgid "Updating packages from cache..."
 msgstr ""
 
 #. Package the result.
 #. Make all these little package from the build environment.
-#: ../python/pakfire/builder.py:879
+#: ../python/pakfire/builder.py:878
 msgid "Creating packages:"
 msgstr ""
 
 #. Execute the buildscript of this stage.
-#: ../python/pakfire/builder.py:899
+#: ../python/pakfire/builder.py:898
 #, python-format
 msgid "Running stage %s:"
 msgstr ""
 
-#: ../python/pakfire/builder.py:917
+#: ../python/pakfire/builder.py:916
 #, python-format
 msgid "Could not remove static libraries: %s"
 msgstr ""
 
-#: ../python/pakfire/builder.py:923
+#: ../python/pakfire/builder.py:922
 msgid "Compressing man pages did not complete successfully."
 msgstr ""
 
-#: ../python/pakfire/builder.py:943
+#: ../python/pakfire/builder.py:942
 msgid "Extracting debuginfo did not complete with success. Aborting build."
 msgstr ""
 
-#: ../python/pakfire/cli.py:47
+#: ../python/pakfire/cli.py:49
 msgid "Pakfire command line interface."
 msgstr ""
 
-#: ../python/pakfire/cli.py:54
+#: ../python/pakfire/cli.py:56
 msgid "The path where pakfire should operate in."
 msgstr ""
 
-#: ../python/pakfire/cli.py:121
+#: ../python/pakfire/cli.py:123
 msgid "Enable verbose output."
 msgstr ""
 
-#: ../python/pakfire/cli.py:124
+#: ../python/pakfire/cli.py:126
 msgid "Path to a configuration file to load."
 msgstr ""
 
-#: ../python/pakfire/cli.py:128
+#: ../python/pakfire/cli.py:130
 msgid "Disable a repository temporarily."
 msgstr ""
 
-#: ../python/pakfire/cli.py:131
+#: ../python/pakfire/cli.py:133
 msgid "Enable a repository temporarily."
 msgstr ""
 
-#: ../python/pakfire/cli.py:135
+#: ../python/pakfire/cli.py:137
 msgid "Run pakfire in offline mode."
 msgstr ""
 
-#: ../python/pakfire/cli.py:140
+#: ../python/pakfire/cli.py:142
 msgid "Install one or more packages to the system."
 msgstr ""
 
-#: ../python/pakfire/cli.py:142
+#: ../python/pakfire/cli.py:144
 msgid "Give name of at least one package to install."
 msgstr ""
 
-#: ../python/pakfire/cli.py:148
+#: ../python/pakfire/cli.py:150
 msgid "Install one or more packages from the filesystem."
 msgstr ""
 
-#: ../python/pakfire/cli.py:150
+#: ../python/pakfire/cli.py:152
 msgid "Give filename of at least one package."
 msgstr ""
 
-#: ../python/pakfire/cli.py:156
+#: ../python/pakfire/cli.py:158
 msgid "Reinstall one or more packages."
 msgstr ""
 
-#: ../python/pakfire/cli.py:158
+#: ../python/pakfire/cli.py:160
 msgid "Give name of at least one package to reinstall."
 msgstr ""
 
-#: ../python/pakfire/cli.py:164
+#: ../python/pakfire/cli.py:166
 msgid "Remove one or more packages from the system."
 msgstr ""
 
-#: ../python/pakfire/cli.py:166
+#: ../python/pakfire/cli.py:168
 msgid "Give name of at least one package to remove."
 msgstr ""
 
-#: ../python/pakfire/cli.py:172
+#: ../python/pakfire/cli.py:174
 msgid "Give a name of a package to update or leave emtpy for all."
 msgstr ""
 
-#: ../python/pakfire/cli.py:174
+#: ../python/pakfire/cli.py:176
 msgid "Exclude package from update."
 msgstr ""
 
-#: ../python/pakfire/cli.py:176 ../python/pakfire/cli.py:201
+#: ../python/pakfire/cli.py:178 ../python/pakfire/cli.py:203
 msgid "Allow changing the vendor of packages."
 msgstr ""
 
-#: ../python/pakfire/cli.py:178 ../python/pakfire/cli.py:203
+#: ../python/pakfire/cli.py:180 ../python/pakfire/cli.py:205
 msgid "Allow changing the architecture of packages."
 msgstr ""
 
-#: ../python/pakfire/cli.py:183
+#: ../python/pakfire/cli.py:185
 msgid "Update the whole system or one specific package."
 msgstr ""
 
-#: ../python/pakfire/cli.py:190
+#: ../python/pakfire/cli.py:192
 msgid "Check, if there are any updates available."
 msgstr ""
 
-#: ../python/pakfire/cli.py:197
+#: ../python/pakfire/cli.py:199
 msgid "Downgrade one or more packages."
 msgstr ""
 
-#: ../python/pakfire/cli.py:199
+#: ../python/pakfire/cli.py:201
 msgid "Give a name of a package to downgrade."
 msgstr ""
 
-#: ../python/pakfire/cli.py:209
+#: ../python/pakfire/cli.py:211
 msgid "Print some information about the given package(s)."
 msgstr ""
 
-#: ../python/pakfire/cli.py:211
+#: ../python/pakfire/cli.py:213
 msgid "Give at least the name of one package."
 msgstr ""
 
-#: ../python/pakfire/cli.py:217
+#: ../python/pakfire/cli.py:219
 msgid "Search for a given pattern."
 msgstr ""
 
-#: ../python/pakfire/cli.py:219
+#: ../python/pakfire/cli.py:221
 msgid "A pattern to search for."
 msgstr ""
 
-#: ../python/pakfire/cli.py:225
+#: ../python/pakfire/cli.py:227
 msgid "Get a list of packages that provide a given file or feature."
 msgstr ""
 
-#: ../python/pakfire/cli.py:227
+#: ../python/pakfire/cli.py:229
 msgid "File or feature to search for."
 msgstr ""
 
-#: ../python/pakfire/cli.py:233
+#: ../python/pakfire/cli.py:235
 msgid "Get list of packages that belong to the given group."
 msgstr ""
 
-#: ../python/pakfire/cli.py:235
+#: ../python/pakfire/cli.py:237
 msgid "Group name to search for."
 msgstr ""
 
-#: ../python/pakfire/cli.py:241
+#: ../python/pakfire/cli.py:243
 msgid "Install all packages that belong to the given group."
 msgstr ""
 
-#: ../python/pakfire/cli.py:243
+#: ../python/pakfire/cli.py:245
 msgid "Group name."
 msgstr ""
 
-#: ../python/pakfire/cli.py:249
+#: ../python/pakfire/cli.py:251
 msgid "List all currently enabled repositories."
 msgstr ""
 
-#: ../python/pakfire/cli.py:253
+#: ../python/pakfire/cli.py:255
 msgid "Cleanup commands."
 msgstr ""
 
-#: ../python/pakfire/cli.py:261
+#: ../python/pakfire/cli.py:263
 msgid "Cleanup all temporary files."
 msgstr ""
 
-#: ../python/pakfire/cli.py:267
+#: ../python/pakfire/cli.py:269
 msgid "Check the system for any errors."
 msgstr ""
 
-#: ../python/pakfire/cli.py:273
+#: ../python/pakfire/cli.py:275
 msgid "Check the dependencies for a particular package."
 msgstr ""
 
-#: ../python/pakfire/cli.py:275
+#: ../python/pakfire/cli.py:277
 msgid "Give name of at least one package to check."
 msgstr ""
 
-#: ../python/pakfire/cli.py:351 ../python/pakfire/transaction.py:352
+#: ../python/pakfire/cli.py:353 ../python/pakfire/transaction.py:352
 msgid "Repository"
 msgstr ""
 
-#: ../python/pakfire/cli.py:351
+#: ../python/pakfire/cli.py:353
 msgid "Enabled"
 msgstr ""
 
-#: ../python/pakfire/cli.py:351
+#: ../python/pakfire/cli.py:353 ../python/pakfire/cli.py:1029
 msgid "Priority"
 msgstr ""
 
-#: ../python/pakfire/cli.py:351
+#: ../python/pakfire/cli.py:353 ../python/pakfire/cli.py:1074
 msgid "Packages"
 msgstr ""
 
-#: ../python/pakfire/cli.py:363
+#: ../python/pakfire/cli.py:365
 msgid "Cleaning up everything..."
 msgstr ""
 
-#: ../python/pakfire/cli.py:379
+#: ../python/pakfire/cli.py:381
 msgid "You cannot run pakfire-builder in a pakfire chroot."
 msgstr ""
 
-#: ../python/pakfire/cli.py:382 ../python/pakfire/cli.py:728
+#: ../python/pakfire/cli.py:384 ../python/pakfire/cli.py:730
 msgid "Pakfire builder command line interface."
 msgstr ""
 
-#: ../python/pakfire/cli.py:440
+#: ../python/pakfire/cli.py:442
 msgid "Update the package indexes."
 msgstr ""
 
-#: ../python/pakfire/cli.py:446 ../python/pakfire/cli.py:748
+#: ../python/pakfire/cli.py:448 ../python/pakfire/cli.py:750
 msgid "Build one or more packages."
 msgstr ""
 
-#: ../python/pakfire/cli.py:448 ../python/pakfire/cli.py:642
-#: ../python/pakfire/cli.py:750
+#: ../python/pakfire/cli.py:450 ../python/pakfire/cli.py:644
+#: ../python/pakfire/cli.py:752
 msgid "Give name of at least one package to build."
 msgstr ""
 
-#: ../python/pakfire/cli.py:452 ../python/pakfire/cli.py:754
-#: ../python/pakfire/cli.py:824
+#: ../python/pakfire/cli.py:454 ../python/pakfire/cli.py:756
+#: ../python/pakfire/cli.py:832
 msgid "Build the package for the given architecture."
 msgstr ""
 
-#: ../python/pakfire/cli.py:454 ../python/pakfire/cli.py:482
-#: ../python/pakfire/cli.py:756
+#: ../python/pakfire/cli.py:456 ../python/pakfire/cli.py:484
+#: ../python/pakfire/cli.py:758
 msgid "Path were the output files should be copied to."
 msgstr ""
 
-#: ../python/pakfire/cli.py:456 ../python/pakfire/cli.py:471
-#: ../python/pakfire/cli.py:758
+#: ../python/pakfire/cli.py:458 ../python/pakfire/cli.py:473
+#: ../python/pakfire/cli.py:760
 msgid "Mode to run in. Is either 'release' or 'development' (default)."
 msgstr ""
 
-#: ../python/pakfire/cli.py:458
+#: ../python/pakfire/cli.py:460
 msgid "Run a shell after a successful build."
 msgstr ""
 
-#: ../python/pakfire/cli.py:463
+#: ../python/pakfire/cli.py:465
 msgid "Go into a shell."
 msgstr ""
 
-#: ../python/pakfire/cli.py:465
+#: ../python/pakfire/cli.py:467
 msgid "Give name of a package."
 msgstr ""
 
-#: ../python/pakfire/cli.py:469
+#: ../python/pakfire/cli.py:471
 msgid "Emulated architecture in the shell."
 msgstr ""
 
-#: ../python/pakfire/cli.py:476
+#: ../python/pakfire/cli.py:478
 msgid "Generate a source package."
 msgstr ""
 
-#: ../python/pakfire/cli.py:478
+#: ../python/pakfire/cli.py:480
 msgid "Give name(s) of a package(s)."
 msgstr ""
 
-#: ../python/pakfire/cli.py:487
+#: ../python/pakfire/cli.py:489
 msgid "Create a build environment cache."
 msgstr ""
 
-#: ../python/pakfire/cli.py:497
+#: ../python/pakfire/cli.py:499
 msgid "Create a new build environment cache."
 msgstr ""
 
-#: ../python/pakfire/cli.py:502
+#: ../python/pakfire/cli.py:504
 msgid "Remove all cached build environments."
 msgstr ""
 
-#: ../python/pakfire/cli.py:589
+#: ../python/pakfire/cli.py:591
 #, python-format
 msgid "Removing environment cache file: %s..."
 msgstr ""
 
-#: ../python/pakfire/cli.py:595
+#: ../python/pakfire/cli.py:597
 #, python-format
 msgid "Could not remove file: %s"
 msgstr ""
 
-#: ../python/pakfire/cli.py:601
+#: ../python/pakfire/cli.py:603
 msgid "Pakfire server command line interface."
 msgstr ""
 
-#: ../python/pakfire/cli.py:640
+#: ../python/pakfire/cli.py:642
 msgid "Send a scrach build job to the server."
 msgstr ""
 
-#: ../python/pakfire/cli.py:644
+#: ../python/pakfire/cli.py:646
 msgid "Limit build to only these architecture(s)."
 msgstr ""
 
-#: ../python/pakfire/cli.py:650
+#: ../python/pakfire/cli.py:652
 msgid "Send a keepalive to the server."
 msgstr ""
 
-#: ../python/pakfire/cli.py:657
+#: ../python/pakfire/cli.py:659
 msgid "Update all repositories."
 msgstr ""
 
-#: ../python/pakfire/cli.py:663
+#: ../python/pakfire/cli.py:665
 msgid "Repository management commands."
 msgstr ""
 
-#: ../python/pakfire/cli.py:671
+#: ../python/pakfire/cli.py:673
 msgid "Create a new repository index."
 msgstr ""
 
-#: ../python/pakfire/cli.py:672
+#: ../python/pakfire/cli.py:674
 msgid "Path to the packages."
 msgstr ""
 
-#: ../python/pakfire/cli.py:673
+#: ../python/pakfire/cli.py:675
 msgid "Path to input packages."
 msgstr ""
 
-#: ../python/pakfire/cli.py:678
+#: ../python/pakfire/cli.py:680
 msgid "Dump some information about this machine."
 msgstr ""
 
-#: ../python/pakfire/cli.py:760
+#: ../python/pakfire/cli.py:762
 msgid "Do not verify build dependencies."
 msgstr ""
 
-#: ../python/pakfire/cli.py:784
+#: ../python/pakfire/cli.py:786
 msgid "Pakfire client command line interface."
 msgstr ""
 
-#: ../python/pakfire/cli.py:818
+#: ../python/pakfire/cli.py:826
 msgid "Build a package remotely."
 msgstr ""
 
-#: ../python/pakfire/cli.py:820
+#: ../python/pakfire/cli.py:828
 msgid "Give name of a package to build."
 msgstr ""
 
-#: ../python/pakfire/cli.py:829
+#: ../python/pakfire/cli.py:837
 msgid "Print some information about this host."
 msgstr ""
 
-#: ../python/pakfire/cli.py:835
+#: ../python/pakfire/cli.py:843
 msgid "Check the connection to the hub."
 msgstr ""
 
-#: ../python/pakfire/cli.py:862 ../python/pakfire/server.py:302
-msgid "Hostname"
+#: ../python/pakfire/cli.py:848
+msgid "Show information about build jobs."
+msgstr ""
+
+#: ../python/pakfire/cli.py:858
+msgid "Show a list of all active jobs."
 msgstr ""
 
 #: ../python/pakfire/cli.py:863
+msgid "Show a list of all recently finished of failed build jobs."
+msgstr ""
+
+#: ../python/pakfire/cli.py:868
+msgid "Show details about given build job."
+msgstr ""
+
+#: ../python/pakfire/cli.py:869
+msgid "The ID of the build job."
+msgstr ""
+
+#: ../python/pakfire/cli.py:874
+msgid "Show information about builds."
+msgstr ""
+
+#: ../python/pakfire/cli.py:882
+msgid "Show details about the given build."
+msgstr ""
+
+#: ../python/pakfire/cli.py:883
+msgid "The ID of the build."
+msgstr ""
+
+#: ../python/pakfire/cli.py:931 ../python/pakfire/server.py:302
+msgid "Hostname"
+msgstr ""
+
+#: ../python/pakfire/cli.py:932
 msgid "Pakfire hub"
 msgstr ""
 
-#: ../python/pakfire/cli.py:866
+#: ../python/pakfire/cli.py:935
 msgid "Username"
 msgstr ""
 
 #. Hardware information
-#: ../python/pakfire/cli.py:870 ../python/pakfire/server.py:306
+#: ../python/pakfire/cli.py:939 ../python/pakfire/server.py:306
 msgid "Hardware information"
 msgstr ""
 
-#: ../python/pakfire/cli.py:871 ../python/pakfire/server.py:307
+#: ../python/pakfire/cli.py:940 ../python/pakfire/server.py:307
 msgid "CPU model"
 msgstr ""
 
-#: ../python/pakfire/cli.py:872 ../python/pakfire/server.py:308
+#: ../python/pakfire/cli.py:941 ../python/pakfire/server.py:308
 msgid "Memory"
 msgstr ""
 
-#: ../python/pakfire/cli.py:874 ../python/pakfire/server.py:310
+#: ../python/pakfire/cli.py:943 ../python/pakfire/server.py:310
 msgid "Native arch"
 msgstr ""
 
-#: ../python/pakfire/cli.py:876
+#: ../python/pakfire/cli.py:945
 msgid "Default arch"
 msgstr ""
 
-#: ../python/pakfire/cli.py:878 ../python/pakfire/server.py:312
+#: ../python/pakfire/cli.py:947 ../python/pakfire/server.py:312
 msgid "Supported arches"
 msgstr ""
 
-#: ../python/pakfire/cli.py:891
+#: ../python/pakfire/cli.py:960
 msgid "Your IP address"
 msgstr ""
 
-#: ../python/pakfire/cli.py:896
+#: ../python/pakfire/cli.py:965
 msgid "You are authenticated to the build service:"
 msgstr ""
 
-#: ../python/pakfire/cli.py:902
+#: ../python/pakfire/cli.py:971
 msgid "User name"
 msgstr ""
 
-#: ../python/pakfire/cli.py:903
+#: ../python/pakfire/cli.py:972
 msgid "Real name"
 msgstr ""
 
-#: ../python/pakfire/cli.py:904
+#: ../python/pakfire/cli.py:973
 msgid "Email address"
 msgstr ""
 
-#: ../python/pakfire/cli.py:905
+#: ../python/pakfire/cli.py:974
 msgid "Registered"
 msgstr ""
 
-#: ../python/pakfire/cli.py:912
+#: ../python/pakfire/cli.py:981
 msgid "You could not be authenticated to the build service."
 msgstr ""
 
-#: ../python/pakfire/cli.py:921
+#: ../python/pakfire/cli.py:1002
+msgid "No ongoing jobs found."
+msgstr ""
+
+#: ../python/pakfire/cli.py:1005
+msgid "Active build jobs"
+msgstr ""
+
+#: ../python/pakfire/cli.py:1011
+msgid "No jobs found."
+msgstr ""
+
+#: ../python/pakfire/cli.py:1014
+msgid "Recently processed build jobs"
+msgstr ""
+
+#: ../python/pakfire/cli.py:1021
+#, python-format
+msgid "A build with ID %s could not be found."
+msgstr ""
+
+#: ../python/pakfire/cli.py:1024
+#, python-format
+msgid "Build: %(name)s"
+msgstr ""
+
+#: ../python/pakfire/cli.py:1028 ../python/pakfire/cli.py:1056
+msgid "State"
+msgstr ""
+
+#: ../python/pakfire/cli.py:1032
+msgid "Jobs"
+msgstr ""
+
+#: ../python/pakfire/cli.py:1045
+#, python-format
+msgid "A job with ID %s could not be found."
+msgstr ""
+
+#: ../python/pakfire/cli.py:1052
+#, python-format
+msgid "Job: %(name)s"
+msgstr ""
+
+#: ../python/pakfire/cli.py:1057 ../python/pakfire/packages/base.py:107
+#: ../python/pakfire/transaction.py:351
+msgid "Arch"
+msgstr ""
+
+#: ../python/pakfire/cli.py:1062 ../python/pakfire/packages/base.py:142
+msgid "Build host"
+msgstr ""
+
+#: ../python/pakfire/cli.py:1067
+msgid "Time created"
+msgstr ""
+
+#: ../python/pakfire/cli.py:1068
+msgid "Time started"
+msgstr ""
+
+#: ../python/pakfire/cli.py:1069
+msgid "Time finished"
+msgstr ""
+
+#: ../python/pakfire/cli.py:1070
+msgid "Duration"
+msgstr ""
+
+#: ../python/pakfire/cli.py:1093
 msgid "Pakfire daemon command line interface."
 msgstr ""
 
@@ -680,10 +781,6 @@ msgstr ""
 msgid "Name"
 msgstr ""
 
-#: ../python/pakfire/packages/base.py:107 ../python/pakfire/transaction.py:351
-msgid "Arch"
-msgstr ""
-
 #: ../python/pakfire/packages/base.py:110 ../python/pakfire/transaction.py:351
 msgid "Version"
 msgstr ""
@@ -740,10 +837,6 @@ msgstr ""
 msgid "Build date"
 msgstr ""
 
-#: ../python/pakfire/packages/base.py:142
-msgid "Build host"
-msgstr ""
-
 #: ../python/pakfire/packages/base.py:144
 msgid "Provides"
 msgstr ""
index f47bad8cbfae670a41741c35f739dbf601b7e48f..c8602f0b1afca750a83f1d881f176ed093cc5261 100644 (file)
@@ -794,6 +794,8 @@ class CliClient(Cli):
                self.parse_command_build()
                self.parse_command_connection_check()
                self.parse_command_info()
+               self.parse_command_jobs()
+               self.parse_command_builds()
 
                # Finally parse all arguments from the command line and save them.
                self.args = self.parser.parse_args()
@@ -802,6 +804,10 @@ class CliClient(Cli):
                        "build"       : self.handle_build,
                        "conn-check"  : self.handle_connection_check,
                        "info"        : self.handle_info,
+                       "jobs_show"   : self.handle_jobs_show,
+                       "jobs_active" : self.handle_jobs_active,
+                       "jobs_latest" : self.handle_jobs_latest,
+                       "builds_show" : self.handle_builds_show,
                }
 
                # Read configuration for the pakfire client.
@@ -837,6 +843,46 @@ class CliClient(Cli):
                        help=_("Check the connection to the hub."))
                sub_conn_check.add_argument("action", action="store_const", const="conn-check")
 
+       def parse_command_jobs(self):
+               sub_jobs = self.sub_commands.add_parser("jobs",
+                       help=_("Show information about build jobs."))
+
+               sub_jobs_commands = sub_jobs.add_subparsers()
+
+               self.parse_command_jobs_active(sub_jobs_commands)
+               self.parse_command_jobs_latest(sub_jobs_commands)
+               self.parse_command_jobs_show(sub_jobs_commands)
+
+       def parse_command_jobs_active(self, sub_commands):
+               sub_active = sub_commands.add_parser("active",
+                       help=_("Show a list of all active jobs."))
+               sub_active.add_argument("action", action="store_const", const="jobs_active")
+
+       def parse_command_jobs_latest(self, sub_commands):
+               sub_latest = sub_commands.add_parser("latest",
+                       help=_("Show a list of all recently finished of failed build jobs."))
+               sub_latest.add_argument("action", action="store_const", const="jobs_latest")
+
+       def parse_command_jobs_show(self, sub_commands):
+               sub_show = sub_commands.add_parser("show",
+                       help=_("Show details about given build job."))
+               sub_show.add_argument("job_id", nargs=1, help=_("The ID of the build job."))
+               sub_show.add_argument("action", action="store_const", const="jobs_show")
+
+       def parse_command_builds(self):
+               sub_builds = self.sub_commands.add_parser("builds",
+                       help=_("Show information about builds."))
+
+               sub_builds_commands = sub_builds.add_subparsers()
+
+               self.parse_command_builds_show(sub_builds_commands)
+
+       def parse_command_builds_show(self, sub_commands):
+               sub_show = sub_commands.add_parser("show",
+                       help=_("Show details about the given build."))
+               sub_show.add_argument("build_id", nargs=1, help=_("The ID of the build."))
+               sub_show.add_argument("action", action="store_const", const="builds_show")
+
        def handle_build(self):
                (package,) = self.args.package
 
@@ -937,6 +983,109 @@ class CliClient(Cli):
                for line in ret:
                        print line
 
+       def _print_jobs(self, jobs, heading=None):
+               if heading:
+                       print "%s:" % heading
+                       print
+
+               for job in jobs:
+                       line = "  [%(type)8s] %(name)-30s: %(state)s"
+
+                       print line % job
+
+               print # Empty line at the end.
+
+       def handle_jobs_active(self):
+               jobs = self.client.get_active_jobs()
+
+               if not jobs:
+                       print _("No ongoing jobs found.")
+                       return
+
+               self._print_jobs(jobs, _("Active build jobs"))
+
+       def handle_jobs_latest(self):
+               jobs = self.client.get_latest_jobs()
+
+               if not jobs:
+                       print _("No jobs found.")
+                       return
+
+               self._print_jobs(jobs, _("Recently processed build jobs"))
+
+       def handle_builds_show(self):
+               (build_id,) = self.args.build_id
+
+               build = self.client.get_build(build_id)
+               if not build:
+                       print _("A build with ID %s could not be found.") % build_id
+                       return
+
+               print _("Build: %(name)s") % build
+
+               fmt = "%-14s: %s"
+               lines = [
+                       fmt % (_("State"), build["state"]),
+                       fmt % (_("Priority"), build["priority"]),
+               ]
+
+               lines.append("%s:" % _("Jobs"))
+               for job in build["jobs"]:
+                       lines.append("  * [%(uuid)s] %(name)-30s: %(state)s" % job)
+
+               for line in lines:
+                       print " ", line
+               print
+
+       def handle_jobs_show(self):
+               (job_id,) = self.args.job_id
+
+               job = self.client.get_job(job_id)
+               if not job:
+                       print _("A job with ID %s could not be found.") % job_id
+                       return
+
+               builder = None
+               if job["builder_id"]:
+                       builder = self.client.get_builder(job["builder_id"])
+
+               print _("Job: %(name)s") % job
+
+               fmt = "%-14s: %s"
+               lines = [
+                       fmt % (_("State"), job["state"]),
+                       fmt % (_("Arch"), job["arch"]),
+               ]
+
+               if builder:
+                       lines += [
+                               fmt % (_("Build host"), builder["name"]),
+                               "",
+                       ]
+
+               lines += [
+                       fmt % (_("Time created"), job["time_created"]),
+                       fmt % (_("Time started"), job["time_started"]),
+                       fmt % (_("Time finished"), job["time_finished"]),
+                       fmt % (_("Duration"), job["duration"]),
+               ]
+
+               if job["packages"]:
+                       lines += ["", "%s:" % _("Packages")]
+
+                       for pkg in job["packages"]:
+                               pkg_lines = [
+                                       "* %(friendly_name)s" % pkg,
+                                       "  %(uuid)s" % pkg,
+                                       "",
+                               ]
+
+                               lines += ["  %s" % line for line in pkg_lines]
+
+               for line in lines:
+                       print " ", line
+               print # New line.
+
 
 class CliDaemon(Cli):
        def __init__(self):
index c6adec5289e681b119c1c23c84f80e872d37b3f0..1886e2b4baf40fcc3cba36f1fd9bee63c3af8860 100644 (file)
@@ -166,6 +166,24 @@ class PakfireUserClient(BuildMixin, PakfireClient):
                """
                return self.conn.get_user_profile()
 
+       def get_builds(self, type=None, limit=10, offset=0):
+               return self.conn.get_builds(type=type, limit=limit, offset=offset)
+
+       def get_build(self, build_id):
+               return self.conn.get_build(build_id)
+
+       def get_builder(self, builder_id):
+               return self.conn.get_builder(builder_id)
+
+       def get_job(self, job_id):
+               return self.conn.get_job(job_id)
+
+       def get_latest_jobs(self):
+               return self.conn.get_latest_jobs()
+
+       def get_active_jobs(self):
+               return self.conn.get_active_jobs()
+
 
 class PakfireBuilderClient(BuildMixin, PakfireClient):
        type = "builder"