summaryrefslogtreecommitdiff
path: root/autoimport.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2013-08-02 08:40:49 +0200
committerHelmut Grohne <helmut@subdivi.de>2013-08-02 08:40:49 +0200
commitcb3708825bf7ea32314040575cef35980dad0cd8 (patch)
tree31575a8525dc90ba6904268d94f47e1604bf0557 /autoimport.py
parenta4bbbb6e664e605634cb3f9e0564c7e4a93697be (diff)
parent2712edb550968ce7ec8cd9800241d7944666631a (diff)
downloaddebian-dedup-cb3708825bf7ea32314040575cef35980dad0cd8.tar.gz
Merge branch master into sqlalchemy
This makes the sqlalchemy branch schema-compatible with master again. The biggest change on master was the introduction of the function table. It caused most of the conflicts. Note that webapp had one conflict not detected by git: The selecting of issues in show_package needed sqlalchemy conversion. Conflicts: README update_sharing.py webapp.py
Diffstat (limited to 'autoimport.py')
-rwxr-xr-xautoimport.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/autoimport.py b/autoimport.py
index 694ffeb..481a3f8 100755
--- a/autoimport.py
+++ b/autoimport.py
@@ -29,7 +29,8 @@ def process_http(pkgs, url):
version_compare(pkgs[name]["version"], pkg["Version"]) > 0:
continue
pkgs[name] = dict(version=pkg["Version"],
- filename="%s/%s" % (url, pkg["Filename"]))
+ filename="%s/%s" % (url, pkg["Filename"]),
+ sha256hash=pkg["SHA256"])
def process_file(pkgs, filename):
base = os.path.basename(filename)
@@ -51,14 +52,18 @@ def process_dir(pkgs, d):
except ValueError:
pass
-def process_pkg(name, filename):
+def process_pkg(name, pkgdict):
+ filename = pkgdict["filename"]
print("importing %s" % filename)
+ importcmd = ["python", "importpkg.py"]
+ if "sha256hash" in pkgdict:
+ importcmd.extend(["-H", pkgdict["sha256hash"]])
if filename.startswith("http://"):
with open(os.path.join("tmp", name), "w") as outp:
dl = subprocess.Popen(["curl", "-s", filename],
stdout=subprocess.PIPE, close_fds=True)
- imp = subprocess.Popen(["python", "importpkg.py"], stdin=dl.stdout,
- stdout=outp, close_fds=True)
+ imp = subprocess.Popen(importcmd, stdin=dl.stdout, stdout=outp,
+ close_fds=True)
if imp.wait():
raise ValueError("importpkg failed")
if dl.wait():
@@ -66,8 +71,8 @@ def process_pkg(name, filename):
else:
with open(filename) as inp:
with open(os.path.join("tmp", name), "w") as outp:
- subprocess.check_call(["python", "importpkg.py"], stdin=inp,
- stdout=outp, close_fds=True)
+ subprocess.check_call(importcmd, stdin=inp, stdout=outp,
+ close_fds=True)
print("preprocessed %s" % name)
def main():
@@ -106,7 +111,7 @@ def main():
with e:
fs = {}
for name, pkg in pkgs.items():
- fs[e.submit(process_pkg, name, pkg["filename"])] = name
+ fs[e.submit(process_pkg, name, pkg)] = name
for f in concurrent.futures.as_completed(fs.keys()):
name = fs[f]