aboutsummaryrefslogtreecommitdiffstats
path: root/MgaRepo/binrepo.py
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2011-01-25 18:14:00 +0000
committerNicolas Vigier <boklm@mageia.org>2011-01-25 18:14:00 +0000
commitdcfc80655d393f99a03d966af92b15c853f2d71a (patch)
treeef8d9f233d8447bca1c7f26ecad4287e083e6cd6 /MgaRepo/binrepo.py
parent4f9a8fc5b69a342cff98726552184c8a33a57acd (diff)
downloadmgarepo-dcfc80655d393f99a03d966af92b15c853f2d71a.tar
mgarepo-dcfc80655d393f99a03d966af92b15c853f2d71a.tar.gz
mgarepo-dcfc80655d393f99a03d966af92b15c853f2d71a.tar.bz2
mgarepo-dcfc80655d393f99a03d966af92b15c853f2d71a.tar.xz
mgarepo-dcfc80655d393f99a03d966af92b15c853f2d71a.zip
add binrepo remove function
Diffstat (limited to 'MgaRepo/binrepo.py')
-rw-r--r--MgaRepo/binrepo.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/MgaRepo/binrepo.py b/MgaRepo/binrepo.py
index 9186980..1af5d6b 100644
--- a/MgaRepo/binrepo.py
+++ b/MgaRepo/binrepo.py
@@ -287,7 +287,8 @@ def update_sources(topdir, added=[], removed=[]):
entries = parse_sources(path)
f = open(path, "w") # open before calculating hashes
for name in removed:
- entries.pop(removed)
+ if name in entries:
+ del entries[name]
for added_path in added:
name = os.path.basename(added_path)
entries[name] = file_hash(added_path)
@@ -301,6 +302,29 @@ def update_sources_threaded(*args, **kwargs):
t.join()
return t
+def remove(path, message=None, commit=True):
+ from MgaRepo.rpmutil import getpkgtopdir
+ svn = SVN()
+ if not os.path.exists(path):
+ raise Error, "not found: %s" % path
+ bpath = os.path.basename(path)
+ topdir = getpkgtopdir()
+ bintopdir = translate_topdir(topdir)
+ update = update_sources_threaded(topdir, removed=[bpath])
+ sources = sources_path(topdir)
+ silent = config.get("log", "ignore-string", "SILENT")
+ if not message:
+ message = "%s: delete binary file %s" % (silent, bpath)
+ if commit:
+ svn.commit(topdir + " " + sources, log=message, nonrecursive=True)
+ binlink = os.path.join(topdir, "SOURCES", bpath)
+ if os.path.islink(binlink):
+ os.unlink(binlink)
+ binpath = os.path.join(topdir, BINARIES_CHECKOUT_NAME, bpath)
+ svn.remove(binpath)
+ if commit:
+ svn.commit(binpath, log=message)
+
def upload(path, message=None):
from MgaRepo.rpmutil import getpkgtopdir
svn = SVN()