[Uludag-commits] r15266 - trunk/staj-projeleri/buildfarm
uludag-commits at pardus.org.tr
uludag-commits at pardus.org.tr
3 Eyl 2007 Pzt 13:42:41 EEST
Author: ozan.caglayan
Date: Mon Sep 3 13:42:40 2007
New Revision: 15266
Modified:
trunk/staj-projeleri/buildfarm/client.py
Log:
more improvements over cli. added a dictionary of server return codes and their meanings.
Modified: trunk/staj-projeleri/buildfarm/client.py
=================================================================
--- trunk/staj-projeleri/buildfarm/client.py (original)
+++ trunk/staj-projeleri/buildfarm/client.py Mon Sep 3 13:42:40 2007
@@ -98,6 +98,19 @@
def client(op, **kwargs):
+ # Used for identifying server return codes in a user friendly manner
+ returnStrings = {'build' : [_("Build process is successfully finished!"),
+ _("Buildfarm is busy!"),
+ _("Work Queue is empty!"),
+ _("Queue finished with problems :(")],
+ 'add' : [_("%s successfully added to the work queue!"),
+ _("The package '%s' doesn't exist!"),
+ _("The package '%s' is already in the work queue!")]
+ }
+
+
+
+
# TODO : I can build a list of all formatted strings and select them
# with the return values provided by the server to minimize the code.
funcString = None
@@ -127,9 +140,6 @@
else:
print_("The repositories are already synchronized.")
- elif op == "status":
- pass
-
# 2 Parameters
elif op == "send":
@@ -153,24 +163,13 @@
funcString = "build" + cmd.capitalize()
print _("Building %s..." % cmd)
retval = server.__getattr__(funcString)()
- if retval == 0:
- print _("Packages are successfully builded!")
- elif retval == 1:
- print _("Work Queue is empty!")
- elif retval == 2:
- print _("Queue finished with problems and those packages couldn't be compiled:\n\n%s\n")\
- % "\n".join(server.getWaitQueue())
+ print returnStrings['build'][retval]
# 3 or more Parameters
elif op == "add":
for pspec in pspecList:
retval = server.appendToWorkQueue(pspec, True)
- if retval == 0:
- print _("%s successfully added to the work queue!" % pspec)
- elif retval == -1:
- print _("The package '%s' doesn't exist!" % pspec)
- elif retval == 1:
- print _("The package '%s' is already in the work queue!" % pspec)
+ print (returnStrings['add'][retval] % pspec)
elif op == "remove":
funcString = "removeFrom" + cmd.capitalize() + "Queue"
@@ -197,7 +196,7 @@
args = sys.argv[1:]
# dummy trick to facilitate parsing of 'add' in the next blocks..
- if args[0] == "add":
+ if args.__contains__("add"):
args.insert(1, "work")
if args == []:
@@ -207,7 +206,7 @@
usage()
elif len(args) == 1:
- if args[0] in ("update","sync","status"):
+ if args[0] in ("update","sync"):
client(args[0])
else:
usage()
Uludag-commits mesaj listesiyle ilgili
daha fazla bilgi