Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-tools.git;a=commitdiff;h=cbf58d3926469dba7a183e890cd30d552ddf717c

commit cbf58d3926469dba7a183e890cd30d552ddf717c
Author: Miklos Vajna <vmik...@frugalware.org>
Date:   Tue Oct 20 20:51:12 2009 +0200

syncpkgd: add cancel_build() to the xml-rpc interface

diff --git a/syncpkgd/syncpkgd.py b/syncpkgd/syncpkgd.py
index 7cb4b69..b98f808 100644
--- a/syncpkgd/syncpkgd.py
+++ b/syncpkgd/syncpkgd.py
@@ -42,7 +42,7 @@ class Actions:

def __request_build(self, pkg):
# this regex is not too nice, but at least works
-               if not 
re.search("^(git|darcs)://[A-Za-z][A-Za-z0-9_,]+/.+-[^-]+-[^-]+-[^-]+/.+ 
<.+>$", pkg):
+               if not 
re.search("^(git|darcs)://[^/]+/[^/]+-[^-]+-[^-]+-[^-]+/[^/]+ <[^/]+>$", pkg):
raise Exception("invalid uri")
if pkg in self.tobuild:
return False
@@ -51,7 +51,7 @@ class Actions:
return True

def request_build(self, login, password, pkg):
-               """add a package to build. be careful, currently no way to undo 
it"""
+               """add a package to build"""
if not self.__login(login, password):
return
if self.__request_build(pkg):
@@ -61,6 +61,24 @@ class Actions:
self.__log(login, pkg, "package rejected by the server")
return False

+       def __cancel_build(self, pkg):
+               if pkg not in self.tobuild:
+                       return False
+               else:
+                       self.tobuild.remove(pkg)
+                       return True
+
+       def cancel_build(self, login, password, pkg):
+               """delete a package from the build queue, if it's there yet (ie 
the build is not yet started)"""
+               if not self.__login(login, password):
+                       return
+               if self.__cancel_build(pkg):
+                       self.__log(login, pkg, "package deletion request was 
accepted by the server")
+                       return True
+               else:
+                       self.__log(login, pkg, "package deletion request was 
rejected by the server")
+                       return False
+
def __get_conf_list(self):
"""build a list of conf files to transfer"""
confs = ['.repoman.conf', '.pacman-g2/repos/*']
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to