summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Boyer <jwboyer@redhat.com>2012-05-09 12:12:40 -0400
committerJosh Boyer <jwboyer@redhat.com>2012-05-09 12:12:40 -0400
commit7df6781f1d0e86c3499279c793ce3835bbbcc0a6 (patch)
tree36d8588ed39675f1d5c4d446ca8993fec0825559
parent66b43bc86a19f60b5cee892de52b8b704fdc8787 (diff)
downloadkoji-bisect-7df6781f1d0e86c3499279c793ce3835bbbcc0a6.zip
koji-bisect-7df6781f1d0e86c3499279c793ce3835bbbcc0a6.tar.gz
koji-bisect-7df6781f1d0e86c3499279c793ce3835bbbcc0a6.tar.xz
Save downloads in a directory
At least try and be nice and organized. This will vomit if the directory already exits or something else goes wrong in creating it, but error checking is left for later
-rwxr-xr-xkoji-bisect.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/koji-bisect.py b/koji-bisect.py
index 99ca318..2f79891 100755
--- a/koji-bisect.py
+++ b/koji-bisect.py
@@ -10,6 +10,7 @@ from functools import cmp_to_key
import cPickle
import urlgrabber.grabber as grabber
import urlgrabber.progress as progress
+import shutil
class Options:
debug = True
@@ -117,7 +118,7 @@ def activate_session(session):
print "successfully connected to hub"
# This is copied almost directly from koji. Sigh again.
-def download_build(session, build):
+def download_build(session, build, arch):
activate_session(session)
info = session.getBuild(build)
@@ -126,7 +127,7 @@ def download_build(session, build):
print "Email Josh because he messed up somewhere."
sys.exit(1)
- rpms = session.listRPMs(buildID=info['id'], arches='x86_64')
+ rpms = session.listRPMs(buildID=info['id'], arches=arch)
if not rpms:
print "No packages available for %s" % koji.buildLabel(info)
sys.exit(1)
@@ -139,7 +140,7 @@ def download_build(session, build):
fname = koji.pathinfo.rpm(rpm)
url = '%s/%s/%s/%s/%s' % (options.pkgurl, info['name'], info['version'], info['release'], fname)
- urls.append((url, os.path.basename(fname)))
+ urls.append((url, 'downloads/%s/%s' % (build,os.path.basename(fname))))
pg = progress.TextMeter()
@@ -287,6 +288,8 @@ if __name__ == "__main__":
os.remove('.koji-bisect.data')
except:
pass
+ # remove any existing downloads
+ shutil.rmtree('downloads', ignore_errors=True)
sys.exit(0)
bisect_data = bisect_load()
@@ -369,7 +372,8 @@ if __name__ == "__main__":
bisect_data['builds_left'] = builds_left
bisect_data['current'] = builds_left[len(builds_left)/2]
- download_build(session, builds_left[len(builds_left)/2])
+ os.makedirs('downloads/%s' % bisect_data['current'])
+ download_build(session, builds_left[len(builds_left)/2], 'x86_64')
bisect_save(bisect_data)