diff options
author | Helmut Grohne <helmut@subdivi.de> | 2016-05-23 15:33:40 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2016-05-23 15:33:40 +0200 |
commit | 2f12a6e2f42673cc2b9cceec33821ce589204fd1 (patch) | |
tree | 12cd693bfbca0224b1602cc6782ccab776d81b04 | |
parent | b1466bc8ac804d3ba90f671ec8431c147a397e4f (diff) | |
download | debian-dedup-2f12a6e2f42673cc2b9cceec33821ce589204fd1.tar.gz |
autoimport: add option to skip hash checking
For variations of dedup, that do not consume the data.tar member, this
option can save significant bandwidth.
-rwxr-xr-x | autoimport.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/autoimport.py b/autoimport.py index 94358b6..132e671 100755 --- a/autoimport.py +++ b/autoimport.py @@ -28,7 +28,7 @@ from dedup.compression import decompress from readyaml import readyaml -def process_http(pkgs, url): +def process_http(pkgs, url, addhash=True): pkglist = urlopen(url + "/dists/sid/main/binary-amd64/Packages.gz") pkglist = decompress(pkglist, ".gz") pkglist = deb822.Packages.iter_paragraphs(pkglist) @@ -37,9 +37,11 @@ def process_http(pkgs, url): if name in pkgs and \ version_compare(pkgs[name]["version"], pkg["Version"]) > 0: continue - pkgs[name] = dict(version=pkg["Version"], - filename="%s/%s" % (url, pkg["Filename"]), - sha256hash=pkg["SHA256"]) + inst = dict(version=pkg["Version"], + filename="%s/%s" % (url, pkg["Filename"])) + if addhash: + inst["sharing"] = pkg["SHA256"] + pkgs[name] = inst def process_file(pkgs, filename): base = os.path.basename(filename) @@ -93,6 +95,8 @@ def main(): parser.add_argument("-d", "--database", action="store", default="test.sqlite3", help="path to the sqlite3 database file") + parser.add_argument("--noverify", action="store_true", + help="do not verify binary package hashes") parser.add_argument("files", nargs='+', help="files or directories or repository urls") args = parser.parse_args() @@ -105,7 +109,7 @@ def main(): for d in args.files: print("processing %s" % d) if d.startswith(("http://", "https://", "ftp://", "file://")): - process_http(pkgs, d) + process_http(pkgs, d, not args.noverify) elif os.path.isdir(d): process_dir(pkgs, d) else: |