mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-29 17:34:12 +02:00
- added 'osc bugowner' as a more intelligent version of 'osc maintainer -B'
- added option '-B' to osc maintainer, prints bugowner OR maintainer. - added 'osc req help' as convenience alias to 'osc help req'. - 'osc in' to be done. Its usage just prints a suggested zypper command line. - Incompatible change: osc se now prints Project Package, instead of Package Project for easier copy&paste. - give better hint how to use osc vc without network connectivity. - added printing of cache statistices to osc build - implemented 'osc ls .' to take proj/pack name from current directory. * Incompatible change: 'osc ls' now defaults to 'osc ls .', * Use 'osc ls /' if you really want to list all projects. * This is meant as a proof of concept. I intend to generalize this usage of '.' for all osc commands. Feedback welcome.
This commit is contained in:
23
osc/fetch.py
23
osc/fetch.py
@@ -63,7 +63,7 @@ class Fetcher:
|
||||
raise errobj.exception
|
||||
|
||||
|
||||
def fetch(self, pac):
|
||||
def fetch(self, pac, prefix=''):
|
||||
# for use by the failure callback
|
||||
self.curpac = pac
|
||||
|
||||
@@ -83,7 +83,7 @@ class Fetcher:
|
||||
# it returns the filename
|
||||
ret = mg.urlgrab(pac.filename,
|
||||
filename = pac.fullpartname,
|
||||
text = '(%s) %s' %(pac.project, pac.filename))
|
||||
text = '%s(%s) %s' %(prefix, pac.project, pac.filename))
|
||||
|
||||
except URLGrabError, e:
|
||||
print
|
||||
@@ -123,6 +123,20 @@ class Fetcher:
|
||||
|
||||
|
||||
def run(self, buildinfo):
|
||||
all = 0
|
||||
cached = 0
|
||||
for i in buildinfo.deps:
|
||||
i.makeurls(self.cachedir, self.urllist)
|
||||
all += 1
|
||||
if os.path.exists(i.fullfilename):
|
||||
cached += 1
|
||||
miss = 0
|
||||
if all:
|
||||
miss = 100.0*(all-cached)/all
|
||||
print "%.1f%% cache miss. %d/%d dependencies cached.\n" % (miss,cached,all)
|
||||
needed = all-cached
|
||||
|
||||
done = 1
|
||||
for i in buildinfo.deps:
|
||||
i.makeurls(self.cachedir, self.urllist)
|
||||
if not os.path.exists(i.fullfilename):
|
||||
@@ -130,8 +144,8 @@ class Fetcher:
|
||||
try:
|
||||
# if there isn't a progress bar, there is no output at all
|
||||
if not self.progress_obj:
|
||||
print '(%s) %s' % (i.project, i.filename)
|
||||
self.fetch(i)
|
||||
print '%d/%d (%s) %s' % (done, needed, i.project, i.filename)
|
||||
self.fetch(i, "%d/%d " % (done,needed))
|
||||
except KeyboardInterrupt:
|
||||
print 'Cancelled by user (ctrl-c)'
|
||||
print 'Exiting.'
|
||||
@@ -139,6 +153,7 @@ class Fetcher:
|
||||
print 'Cleaning up incomplete file', i.fullpartname
|
||||
os.unlink(i.fullpartname)
|
||||
sys.exit(0)
|
||||
done += 1
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user