mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-26 06:46:13 +01: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:
parent
889a2d5710
commit
bb6e27db24
13
NEWS
13
NEWS
@ -1,4 +1,17 @@
|
|||||||
0.124
|
0.124
|
||||||
|
- 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.
|
||||||
|
|
||||||
0.123
|
0.123
|
||||||
- IMPORTANT: ssl certificate checks are actually performed now to
|
- IMPORTANT: ssl certificate checks are actually performed now to
|
||||||
|
92
PROJ_PACK.txt
Normal file
92
PROJ_PACK.txt
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
jw, Tue Oct 20 22:09:16 CEST 2009
|
||||||
|
|
||||||
|
This is a feature suggestion for easier osc commandline handling.
|
||||||
|
Many commands require specifying Project and/or Package names.
|
||||||
|
|
||||||
|
The current situation is not satisfying for the following reasons:
|
||||||
|
- inconsistent defaults. Some osc subcommands can take project
|
||||||
|
and/or package names from the current directory, if run inside a checkout
|
||||||
|
tree. If both project and package can use this default or only one, and if
|
||||||
|
one, which, depends on the command. Users have a hard time memorizing
|
||||||
|
which is which.
|
||||||
|
Examples as of osc version 0.123:
|
||||||
|
osc maintainer PRJ [PKG]
|
||||||
|
- does not look in the current directory.
|
||||||
|
- need at least PRJ.
|
||||||
|
osc list [PRJ [PKG]]
|
||||||
|
- Never looks at the current directory.
|
||||||
|
- lists all projects, if run without parameters.
|
||||||
|
osc checkout [PRJ] PKG
|
||||||
|
osc checkout PRJ
|
||||||
|
- takes project from current directory, if inside a checkout tree
|
||||||
|
- else operates on an entire project.
|
||||||
|
osc checkin [ARG]
|
||||||
|
- defaults to current project and package,
|
||||||
|
- if arg is a subdirectory, project is taken from current directory
|
||||||
|
- if arg is a file, both project and package are taken from current
|
||||||
|
directory.
|
||||||
|
osc results [PRJ PKG]
|
||||||
|
- takes either both or none from current directory.
|
||||||
|
- many commands do not look into the current directory,
|
||||||
|
they are cumbersome to use.
|
||||||
|
- sometimes PRJ/PKG can be used instead of PRJ PKG
|
||||||
|
|
||||||
|
|
||||||
|
Suggested solution
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Instead of tuning (maybe optional) positional parameters.
|
||||||
|
We suggest to deprecate this syntax over time and instead favour an alternate
|
||||||
|
syntax:
|
||||||
|
osc CMD ... [--prj PRJ] [--pkg PKG] ...
|
||||||
|
osc CMD ... [--proj PRJ] [--pack PKG] ...
|
||||||
|
osc CMD ... [--project PRJ] [--package PKG] ...
|
||||||
|
|
||||||
|
These six options are new to osc, currently no existing command uses
|
||||||
|
them. Thus the new syntax is conflict free wit the old syntax, both can be
|
||||||
|
used in parallel.
|
||||||
|
|
||||||
|
--prj, --proj, --project are synonyms.
|
||||||
|
--pkg, --pack, --package are synonyms.
|
||||||
|
|
||||||
|
osc shall support aliases, to save typing. Some implicit aliases exist,
|
||||||
|
with well defined magic effects. Aliases substitution is literal.
|
||||||
|
They can replace options including their parameters, or just the option, or
|
||||||
|
just the parameters.
|
||||||
|
- (a dash) expands to --prj openSUSE:Factory
|
||||||
|
(or --prj followed by any other project as defined in
|
||||||
|
~/.oscrc:default_project )
|
||||||
|
--prj - is synonymous to just -, for consistency.
|
||||||
|
|
||||||
|
. (a dot) evaluates the current working directory, searching for
|
||||||
|
.osc/_apiurl, .osc/_project, and .osc/_package
|
||||||
|
Implicit --apiurl, --prj, or --pkg options are constructed as far
|
||||||
|
as available from the current directory and as far as not already
|
||||||
|
present in the command line.
|
||||||
|
If a dot is used as parameter to an option, it has a more
|
||||||
|
deterministic meaning.
|
||||||
|
--apiurl . Substitute only the current apiurl,
|
||||||
|
--prj . Substitute the current project name, and provides
|
||||||
|
a default for --apiurl unless given.
|
||||||
|
--pkg . Substitures current package name likewise.
|
||||||
|
|
||||||
|
./. expands to --prj . --pkg .
|
||||||
|
./PKG expands to --prj . --pkg PKG
|
||||||
|
|
||||||
|
Unless otherwise noted in the online help, magic aliases are only attempted onceper commandline, and will only apply to their respective options.
|
||||||
|
E.g. osc ci -m - will use a simple '-' as check in messages, and the absence of any project or package will default to the current project or package, just as
|
||||||
|
osc ci . -m - would do.
|
||||||
|
|
||||||
|
Additionally, user defined aliases can be added to ~/.oscrc
|
||||||
|
If an alias expansion has effect on the command line, the expanded line is
|
||||||
|
printed as debug output.
|
||||||
|
|
||||||
|
online help of osc commands shall refer to the above syntax like this:
|
||||||
|
|
||||||
|
osc CMD ... PROJ/PACK
|
||||||
|
|
||||||
|
An additional help entry
|
||||||
|
|
||||||
|
osc help 'PROJ/PACK'
|
||||||
|
|
||||||
|
shall explain the relevant details as presented herein.
|
4
TODO
4
TODO
@ -1,3 +1,7 @@
|
|||||||
|
JW:
|
||||||
|
- german umlaut characters äöü do not work in the message for osc submitpac.
|
||||||
|
404 not found, and no request sent.
|
||||||
|
|
||||||
CRITICAL:
|
CRITICAL:
|
||||||
- webpage can create a _link in a fully populated package.
|
- webpage can create a _link in a fully populated package.
|
||||||
Need to prevent his somehow.
|
Need to prevent his somehow.
|
||||||
|
@ -3370,9 +3370,44 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
out = r.read()
|
out = r.read()
|
||||||
sys.stdout.write(out)
|
sys.stdout.write(out)
|
||||||
|
|
||||||
|
@cmdln.option('-v', '--verbose', action='store_true',
|
||||||
|
help='show more information')
|
||||||
|
@cmdln.option('--nodevelproject', action='store_true',
|
||||||
|
help='do not follow a defined devel project ' \
|
||||||
|
'(primary project where a package is developed)')
|
||||||
|
@cmdln.option('-e', '--email', action='store_true',
|
||||||
|
help='show email addresses instead of user names')
|
||||||
|
def do_bugowner(self, subcmd, opts, *args):
|
||||||
|
"""${cmd_name}: Show bugowners of a project/package
|
||||||
|
|
||||||
@cmdln.option('-b', '--bugowner', action='store_true',
|
osc bugowner PRJ
|
||||||
|
osc bugowner PRJ PKG
|
||||||
|
|
||||||
|
Shortcut for osc maintainer -B [PRJ] PKG
|
||||||
|
|
||||||
|
PRJ defaults to '%(getpac_default_project)s'.
|
||||||
|
Prints bugowner if defined, or maintainer otherwise.
|
||||||
|
|
||||||
|
${cmd_option_list}
|
||||||
|
"""
|
||||||
|
opts.role = None
|
||||||
|
opts.bugowner = True
|
||||||
|
opts.bugowner_only = None
|
||||||
|
opts.add = None
|
||||||
|
opts.delete = None
|
||||||
|
opts.devel_project = None
|
||||||
|
|
||||||
|
if len(args) == 1:
|
||||||
|
print >>sys.stderr, 'defaulting to %s/%s' % (conf.config['getpac_default_project'], args[0])
|
||||||
|
# python has no args.unshift ???
|
||||||
|
args = [ conf.config['getpac_default_project'] , args[0] ]
|
||||||
|
return self.do_maintainer(subcmd, opts, *args)
|
||||||
|
|
||||||
|
|
||||||
|
@cmdln.option('-b', '--bugowner_only', action='store_true',
|
||||||
help='Show only the bugowner')
|
help='Show only the bugowner')
|
||||||
|
@cmdln.option('-B', '--bugowner', action='store_true',
|
||||||
|
help='Show only the bugowner if defined, or maintainer otherwise')
|
||||||
@cmdln.option('-e', '--email', action='store_true',
|
@cmdln.option('-e', '--email', action='store_true',
|
||||||
help='show email addresses instead of user names')
|
help='show email addresses instead of user names')
|
||||||
@cmdln.option('--nodevelproject', action='store_true',
|
@cmdln.option('--nodevelproject', action='store_true',
|
||||||
@ -3408,7 +3443,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
roles = [ 'bugowner', 'maintainer' ]
|
roles = [ 'bugowner', 'maintainer' ]
|
||||||
else:
|
else:
|
||||||
roles = [opts.role]
|
roles = [opts.role]
|
||||||
if opts.bugowner:
|
if opts.bugowner_only:
|
||||||
roles = [ 'bugowner' ]
|
roles = [ 'bugowner' ]
|
||||||
|
|
||||||
if len(args) == 1:
|
if len(args) == 1:
|
||||||
@ -3445,12 +3480,21 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
setDevelProject(conf.config['apiurl'], prj, pac, opts.devel_project)
|
setDevelProject(conf.config['apiurl'], prj, pac, opts.devel_project)
|
||||||
else:
|
else:
|
||||||
# showing the maintainers
|
# showing the maintainers
|
||||||
|
seen=0
|
||||||
for role in roles:
|
for role in roles:
|
||||||
print ""
|
if opts.bugowner:
|
||||||
print role, ":"
|
if seen:
|
||||||
|
break;
|
||||||
for person in tree.findall('person'):
|
for person in tree.findall('person'):
|
||||||
if person.get('role') == role:
|
if person.get('role') == role:
|
||||||
|
seen += 1
|
||||||
maintainers.append(person.get('userid'))
|
maintainers.append(person.get('userid'))
|
||||||
|
if opts.bugowner:
|
||||||
|
if seen:
|
||||||
|
print role+":",
|
||||||
|
else:
|
||||||
|
print ""
|
||||||
|
print role, ":"
|
||||||
|
|
||||||
if opts.email:
|
if opts.email:
|
||||||
emails = []
|
emails = []
|
||||||
@ -3836,7 +3880,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
if conf.config['api_host_options'][apiurl].has_key('email'):
|
if conf.config['api_host_options'][apiurl].has_key('email'):
|
||||||
os.environ['mailaddr'] = conf.config['api_host_options'][apiurl]['email']
|
os.environ['mailaddr'] = conf.config['api_host_options'][apiurl]['email']
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
os.environ['mailaddr'] = get_user_data(apiurl, user, 'email')[0]
|
os.environ['mailaddr'] = get_user_data(apiurl, user, 'email')[0]
|
||||||
|
except Exception, e:
|
||||||
|
sys.exit('%s\nget_user_data(email) failed. Try env mailaddr=....\n' % e)
|
||||||
|
|
||||||
if opts.message:
|
if opts.message:
|
||||||
cmd_list.append("-m")
|
cmd_list.append("-m")
|
||||||
|
23
osc/fetch.py
23
osc/fetch.py
@ -63,7 +63,7 @@ class Fetcher:
|
|||||||
raise errobj.exception
|
raise errobj.exception
|
||||||
|
|
||||||
|
|
||||||
def fetch(self, pac):
|
def fetch(self, pac, prefix=''):
|
||||||
# for use by the failure callback
|
# for use by the failure callback
|
||||||
self.curpac = pac
|
self.curpac = pac
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ class Fetcher:
|
|||||||
# it returns the filename
|
# it returns the filename
|
||||||
ret = mg.urlgrab(pac.filename,
|
ret = mg.urlgrab(pac.filename,
|
||||||
filename = pac.fullpartname,
|
filename = pac.fullpartname,
|
||||||
text = '(%s) %s' %(pac.project, pac.filename))
|
text = '%s(%s) %s' %(prefix, pac.project, pac.filename))
|
||||||
|
|
||||||
except URLGrabError, e:
|
except URLGrabError, e:
|
||||||
print
|
print
|
||||||
@ -123,6 +123,20 @@ class Fetcher:
|
|||||||
|
|
||||||
|
|
||||||
def run(self, buildinfo):
|
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:
|
for i in buildinfo.deps:
|
||||||
i.makeurls(self.cachedir, self.urllist)
|
i.makeurls(self.cachedir, self.urllist)
|
||||||
if not os.path.exists(i.fullfilename):
|
if not os.path.exists(i.fullfilename):
|
||||||
@ -130,8 +144,8 @@ class Fetcher:
|
|||||||
try:
|
try:
|
||||||
# if there isn't a progress bar, there is no output at all
|
# if there isn't a progress bar, there is no output at all
|
||||||
if not self.progress_obj:
|
if not self.progress_obj:
|
||||||
print '(%s) %s' % (i.project, i.filename)
|
print '%d/%d (%s) %s' % (done, needed, i.project, i.filename)
|
||||||
self.fetch(i)
|
self.fetch(i, "%d/%d " % (done,needed))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print 'Cancelled by user (ctrl-c)'
|
print 'Cancelled by user (ctrl-c)'
|
||||||
print 'Exiting.'
|
print 'Exiting.'
|
||||||
@ -139,6 +153,7 @@ class Fetcher:
|
|||||||
print 'Cleaning up incomplete file', i.fullpartname
|
print 'Cleaning up incomplete file', i.fullpartname
|
||||||
os.unlink(i.fullpartname)
|
os.unlink(i.fullpartname)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
done += 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
# 2006-12-15, jw, v0.2 -- {files}{error} gets printed if present.
|
# 2006-12-15, jw, v0.2 -- {files}{error} gets printed if present.
|
||||||
# 2008-03-25, jw, v0.3 -- go via api using iChains and ~/.oscrc
|
# 2008-03-25, jw, v0.3 -- go via api using iChains and ~/.oscrc
|
||||||
# 2008-03-26, jw, v0.4 -- added linked file retrieval and usage.
|
# 2008-03-26, jw, v0.4 -- added linked file retrieval and usage.
|
||||||
|
# 2009-10-21, jw, added obsolete warning, in favour of osc co -e
|
||||||
|
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use LWP::UserAgent;
|
use LWP::UserAgent;
|
||||||
@ -16,6 +17,9 @@ use Digest::MD5;
|
|||||||
my $version = '0.4';
|
my $version = '0.4';
|
||||||
my $verbose = 1;
|
my $verbose = 1;
|
||||||
|
|
||||||
|
print "This $0 is obsolete. Please use instead: osc co -e\n";
|
||||||
|
sleep 5;
|
||||||
|
|
||||||
# curl buildservice:5352/source/home:jnweiger/vim
|
# curl buildservice:5352/source/home:jnweiger/vim
|
||||||
# curl 'buildservice:5352/source/home:jnweiger/vim?rev=d90bfab4301f758e0d82cf09aa263d37'
|
# curl 'buildservice:5352/source/home:jnweiger/vim?rev=d90bfab4301f758e0d82cf09aa263d37'
|
||||||
# curl 'buildservice:5352/source/home:jnweiger/vim/vim.spec?rev=d90bfab4301f758e0d82cf09aa263d37'
|
# curl 'buildservice:5352/source/home:jnweiger/vim/vim.spec?rev=d90bfab4301f758e0d82cf09aa263d37'
|
||||||
|
Loading…
Reference in New Issue
Block a user