aboutsummaryrefslogtreecommitdiffstats
path: root/MgaRepo/binrepo.py
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2011-08-17 12:23:48 +0000
committerNicolas Vigier <boklm@mageia.org>2011-08-17 12:23:48 +0000
commitd8a6cc7ef7ec79d9eaa26e18dcc7dea74ad7b985 (patch)
treed6f85b7d4862df4b37f1423959e6672026a1122b /MgaRepo/binrepo.py
parentc59618c129333beac82c7b227bd928073cf799c5 (diff)
downloadmgarepo-d8a6cc7ef7ec79d9eaa26e18dcc7dea74ad7b985.tar
mgarepo-d8a6cc7ef7ec79d9eaa26e18dcc7dea74ad7b985.tar.gz
mgarepo-d8a6cc7ef7ec79d9eaa26e18dcc7dea74ad7b985.tar.bz2
mgarepo-d8a6cc7ef7ec79d9eaa26e18dcc7dea74ad7b985.tar.xz
mgarepo-d8a6cc7ef7ec79d9eaa26e18dcc7dea74ad7b985.zip
add functions to download from new binrepo
Diffstat (limited to 'MgaRepo/binrepo.py')
-rw-r--r--MgaRepo/binrepo.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/MgaRepo/binrepo.py b/MgaRepo/binrepo.py
index 2a6f437..8480fd3 100644
--- a/MgaRepo/binrepo.py
+++ b/MgaRepo/binrepo.py
@@ -127,6 +127,34 @@ def find_binaries(paths):
new.append(path)
return new
+def download_binary(topdir, sha1, filename):
+ fmt = config.get("global", "download-command",
+ "wget -c -O '$dest' $url")
+ url = config.get("global", "binrepo",
+ "http://binrepo.mageia.org/")
+ url = mirror.normalize_path(url + "/" + sha1)
+ dest = os.path.join(topdir, 'SOURCES', filename)
+ if os.path.exists(dest):
+ return 1
+ context = {"dest": dest, "url": url}
+ try:
+ cmd = string.Template(fmt).substitute(context)
+ except KeyError, e:
+ raise Error, "invalid variable %r in download-command "\
+ "configuration option" % e
+ try:
+ status, output = execcmd(cmd, show=True)
+ except Error, e:
+ raise Error, "Could not download file %s\n" % url
+
+def download_binaries(topdir):
+ spath = sources_path(topdir)
+ if not os.path.exists(spath):
+ raise Error, "'%s' was not found" % spath
+ entries = parse_sources(spath)
+ for name, sha1 in entries.iteritems():
+ download_binary(topdir, sha1, name)
+
def make_symlinks(source, dest):
todo = []
tomove = []