aboutsummaryrefslogtreecommitdiffstats
path: root/RepSys/binrepo.py
diff options
context:
space:
mode:
authorBogdano Arendartchuk <bogdano@mandriva.org>2008-06-24 00:20:53 +0000
committerBogdano Arendartchuk <bogdano@mandriva.org>2008-06-24 00:20:53 +0000
commit18847945d23b9b8acdb14eb27ac2de865c7dac34 (patch)
tree66b6b4d8cd56a819f41a1d091b842c9abcee13a0 /RepSys/binrepo.py
parent8f0f626970aa1eacafece10875bae78c55d29ad3 (diff)
downloadmgarepo-18847945d23b9b8acdb14eb27ac2de865c7dac34.tar
mgarepo-18847945d23b9b8acdb14eb27ac2de865c7dac34.tar.gz
mgarepo-18847945d23b9b8acdb14eb27ac2de865c7dac34.tar.bz2
mgarepo-18847945d23b9b8acdb14eb27ac2de865c7dac34.tar.xz
mgarepo-18847945d23b9b8acdb14eb27ac2de865c7dac34.zip
Support using the binrepo even when packages don't have 'sources' files
For the sake of simplicity, removed from "up" the support of specifying binary from the binaries repository. Now in order to update the binaries it is needed to update the package checkout.
Diffstat (limited to 'RepSys/binrepo.py')
-rw-r--r--RepSys/binrepo.py45
1 files changed, 26 insertions, 19 deletions
diff --git a/RepSys/binrepo.py b/RepSys/binrepo.py
index 2f80b82..12e394a 100644
--- a/RepSys/binrepo.py
+++ b/RepSys/binrepo.py
@@ -118,11 +118,10 @@ def svn_root(target):
return info["Repository Root"]
def enabled(url):
+ #TODO use information from url to find out whether we have a binrepo
+ # available for this url
use = config.getbool("global", "use-binaries-repository", False)
- default_parent = config.get("global", "default_parent", None)
- if url and use and default_parent and same_base(url, default_parent):
- return True
- return False
+ return use
def target_url(path=None):
from RepSys.rpmutil import get_submit_info
@@ -391,35 +390,43 @@ def markrelease(srcurl, desturl, version, release, revision):
finally:
shutil.rmtree(tmpdir)
-def download(target, url=None, check=True):
+def download(target, url=None, files=None, check=True):
+ """Tries to download files from binrepo, based on a svn directory
+
+ @target: directory where downloaded files will be placed.
+ @url: the url of the destination directory (in case it is not available
+ from target, as in a svn export'ed directory).
+ @files: names of files to be downloaded (in case the 'sources' file is
+ not available)
+ @check: check the integrity of the files against the hashes in the
+ 'sources' file
+ """
targeturl = target_url(url or target)
spath = sources_path(target)
- if not os.path.exists(spath):
- # we don't have external sources
+ if not os.path.exists(spath) and not files:
+ # we don't have anything to download
return
entries = parse_sources(spath)
+ for file in files:
+ # setdefault because the 'sources' file has precedence over the
+ # 'files' list, as we have hashes
+ entries.setdefault(file, None)
try:
host, path = targeturl.split(":", 1)
except ValueError:
host = None
path = targeturl
- if os.path.isdir(target):
- paths = [os.path.join(path, name) for name, sum in entries.iteritems()]
- targetdir = target
- else:
- paths = [os.path.join(path, os.path.basename(target))]
- name = os.path.basename(target)
- targetdir = os.path.dirname(target)
- if name not in entries:
- raise Error, "file not uploaded yet (not found in "\
- "sources file): %s" % target
- copy(sources=paths, sourcehost=host, dest=targetdir)
+ paths = [os.path.join(path, name) for name, sum in entries.iteritems()]
+ copy(sources=paths, sourcehost=host, dest=target)
if check:
yield "Checking files"
for path in paths:
name = os.path.basename(path)
- bpath = os.path.join(targetdir, name)
+ bpath = os.path.join(target, name)
sum = entries[name]
+ if sum is None:
+ # should we warn the user about it?
+ continue
check_hash(bpath, sum)
yield "Done"