[Mageia-sysadm] [360] make upload and binrepo_delete functions work on text files too

root at mageia.org root at mageia.org
Thu Jan 27 23:04:38 CET 2011


Revision: 360
Author:   boklm
Date:     2011-01-27 23:04:38 +0100 (Thu, 27 Jan 2011)
Log Message:
-----------
make upload and binrepo_delete functions work on text files too

Modified Paths:
--------------
    build_system/mgarepo/trunk/MgaRepo/rpmutil.py

Modified: build_system/mgarepo/trunk/MgaRepo/rpmutil.py
===================================================================
--- build_system/mgarepo/trunk/MgaRepo/rpmutil.py	2011-01-27 21:26:04 UTC (rev 359)
+++ build_system/mgarepo/trunk/MgaRepo/rpmutil.py	2011-01-27 22:04:38 UTC (rev 360)
@@ -661,16 +661,32 @@
         url = info["URL"]
         download_binaries(br_target, url)
 
-def upload(paths):
+def upload(paths, commit=True):
     for path in paths:
-        binrepo.upload(path)
+        if os.path.isdir(path) or binrepo.is_binary(path):
+            binrepo.upload(path, commit=commit)
+        else:
+            svn = SVN()
+            svn.add(path, local=True)
+            if commit:
+                silent = config.get("log", "ignore-string", "SILENT")
+                message = "%s: new file %s" % (silent, path)
+                svn.commit(path, log=message)
 
-def binrepo_delete(paths, commit=False):
+def binrepo_delete(paths, commit=True):
     refurl = binrepo.svn_root(paths[0])
     if not binrepo.enabled(refurl):
         raise Error, "binary repository is not enabled for %s" % refurl
     for path in paths:
-        binrepo.remove(path)
+        if binrepo.is_binary(path):
+            binrepo.remove(path, commit=commit)
+        else:
+            svn = SVN()
+            svn.remove(path, local=True)
+            if commit:
+                silent = config.get("log", "ignore-string", "SILENT")
+                message = "%s: delete file %s" % (silent, path)
+                svn.commit(path, log=message)
 
 def switch(mirrorurl=None):
     svn  = SVN()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20110127/9bbf7de0/attachment.html>


More information about the Mageia-sysadm mailing list