Hello community,
here is the log from the commit of package osc
checked in at Mon Sep 3 18:38:43 CEST 2007.
--------
--- osc/osc.changes 2007-08-09 00:55:04.000000000 +0200
+++ /mounts/work_src_done/STABLE/osc/osc.changes 2007-09-03 14:32:12.000000000 +0200
@@ -1,0 +2,44 @@
+Mon Sep 3 12:47:31 CEST 2007 - poeml@suse.de
+
+- update to r2075:
+ - new 'maintainer' command, to list the maintainers of a project
+ or package
+ - make osc call build with --changelog option, by default [#298436]
+ - make osc library simpler to use from external scripts, by
+ simply calling conf.get_config(), with possibility to override
+ conf file, http debugging, api server). It is no longer
+ required to set up the api url in the config dict, and call
+ conf.init_basicauth().
+ - allow to specify a different config file via the environmental
+ variable OSC_CONFIG, or via -c|--config on the commandline
+
+-------------------------------------------------------------------
+Fri Aug 17 08:18:34 CEST 2007 - poeml@suse.de
+
+- update to r2001:
+ - contributions from James Oakley and Marcus Huewe
+ - ls: add -b option to list binaries
+ - req: show error response for 404 responses
+ - core: add get_binarylist(); works per project and per package
+ - core: add get_binarylist_published(); works per project
+ - core: add get_binary_file()
+ - build: "osc build" if $BUILD_DIST is set
+
+-------------------------------------------------------------------
+Tue Aug 14 13:55:00 CEST 2007 - poeml@suse.de
+
+- update to r1974:
+ - version 0.98
+ - commit: use the documented commit method by default now
+ - build: add --changelog option to force update of the package
+ changelog from a changes file
+
+-------------------------------------------------------------------
+Thu Aug 9 18:15:53 CEST 2007 - poeml@suse.de
+
+- update to r1961:
+ - meta: remove notion of non-implemented --create switch. give
+ example for meta pkg usage
+ - search: add --repos-baseurl option
+
+-------------------------------------------------------------------
Old:
----
osc-0.97.tar.gz
New:
----
osc-0.98.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ osc.spec ++++++
--- /var/tmp/diff_new_pack.jr6131/_old 2007-09-03 18:38:06.000000000 +0200
+++ /var/tmp/diff_new_pack.jr6131/_new 2007-09-03 18:38:06.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package osc (Version 0.97)
+# spec file for package osc (Version 0.98)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -12,13 +12,13 @@
Name: osc
BuildRequires: python-devel
-Version: 0.97
-Release: 13
+Version: 0.98
+Release: 1
Group: Development/Tools/Other
License: GPL v2 or later
BuildRoot: %{_tmppath}/%{name}-%{version}-build
URL: https://forgesvn1.novell.com/svn/opensuse/trunk/buildservice/src/clientlib/p...
-# v=0.97; svn export https://forgesvn1.novell.com/svn/opensuse/trunk/buildservice/src/clientlib/p... osc-$v; tar czf osc-$v.tar.gz osc-$v
+# v=0.98; svn export https://forgesvn1.novell.com/svn/opensuse/trunk/buildservice/src/clientlib/p... osc-$v; tar czf osc-$v.tar.gz osc-$v
Source: osc-%{version}.tar.gz
Summary: openSUSE (build service) commander
Requires: python-urlgrabber
@@ -78,6 +78,38 @@
%doc README TODO NEWS
%changelog
+* Mon Sep 03 2007 - poeml@suse.de
+- update to r2075:
+ - new 'maintainer' command, to list the maintainers of a project
+ or package
+ - make osc call build with --changelog option, by default [#298436]
+ - make osc library simpler to use from external scripts, by
+ simply calling conf.get_config(), with possibility to override
+ conf file, http debugging, api server). It is no longer
+ required to set up the api url in the config dict, and call
+ conf.init_basicauth().
+ - allow to specify a different config file via the environmental
+ variable OSC_CONFIG, or via -c|--config on the commandline
+* Fri Aug 17 2007 - poeml@suse.de
+- update to r2001:
+ - contributions from James Oakley and Marcus Huewe
+ - ls: add -b option to list binaries
+ - req: show error response for 404 responses
+ - core: add get_binarylist(); works per project and per package
+ - core: add get_binarylist_published(); works per project
+ - core: add get_binary_file()
+ - build: "osc build" if $BUILD_DIST is set
+* Tue Aug 14 2007 - poeml@suse.de
+- update to r1974:
+ - version 0.98
+ - commit: use the documented commit method by default now
+ - build: add --changelog option to force update of the package
+ changelog from a changes file
+* Thu Aug 09 2007 - poeml@suse.de
+- update to r1961:
+ - meta: remove notion of non-implemented --create switch. give
+ example for meta pkg usage
+ - search: add --repos-baseurl option
* Thu Aug 09 2007 - poeml@suse.de
- update to r1947:
- commit: fixed possible "UnboundLocalError" with -m. Thanks to
++++++ debian.changelog ++++++
--- osc/debian.changelog 2007-08-09 00:55:39.000000000 +0200
+++ /mounts/work_src_done/STABLE/osc/debian.changelog 2007-09-03 12:50:23.000000000 +0200
@@ -1,3 +1,51 @@
+osc (0.98-3) unstable; urgency=high
+
+ - update to r2075:
+ - new 'maintainer' command, to list the maintainers of a project or
+ package
+ - make osc call build with --changelog option, by default [#298436]
+ - make osc library simpler to use from external scripts, by
+ simply calling conf.get_config(), with possibility to override
+ conf file, http debugging, api server). It is no longer
+ required to set up the api url in the config dict, and call
+ conf.init_basicauth().
+ - allow to specify a different config file via the environmental
+ variable OSC_CONFIG, or via -c|--config on the commandline
+
+ -- Peter Poeml Mon, 3 Sep 2007 00:00:00 +0200
+
+osc (0.98-2) unstable; urgency=high
+
+ - update to r2001:
+ - contributions from James Oakley and Marcus Huewe
+ - ls: add -b option to list binaries
+ - req: show error response for 404 responses
+ - core: add get_binarylist(); works per project and per package
+ - core: add get_binarylist_published(); works per project
+ - core: add get_binary_file()
+ - build: "osc build" if $BUILD_DIST is set
+
+ -- Peter Poeml Fri, 17 Aug 2007 00:00:00 +0200
+
+osc (0.98-1) unstable; urgency=high
+
+ - update to r1974:
+ - version 0.98
+ - commit: use the documented commit method by default now
+ - build: add --changelog option to force update of the package
+ changelog from a changes file
+
+ -- Peter Poeml Tue, 14 Aug 2007 00:00:00 +0200
+
+osc (0.97-8) unstable; urgency=high
+
+ * update to r1961:
+ - meta: remove notion of non-implemented --create switch. give
+ example for meta pkg usage
+ - search: add --repos-baseurl option
+
+ -- Peter Poeml Thu, 9 Aug 2007 00:00:00 +0200
+
osc (0.97-7) unstable; urgency=high
* update to r1947:
++++++ osc-0.97.tar.gz -> osc-0.98.tar.gz ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/osc-0.97/NEWS new/osc-0.98/NEWS
--- old/osc-0.97/NEWS 2007-07-23 11:28:15.000000000 +0200
+++ new/osc-0.98/NEWS 2007-09-03 12:50:02.000000000 +0200
@@ -1,19 +1,17 @@
-since 0.97:
+0.98:
-- added initial search support
-- new meta command, replacing editmeta, editprj, createprj,
- editpac, createpac, edituser
-- allow editing patterns (osc meta pattern -e)
-- show helpful xml error messages if broken metadata is uploaded
+- new maintainer command, to list the maintainers of a project or package
+- ls: add -b option to list binaries
+- make osc library simpler to use from external scripts
+- new importfromsrcpkg command, to import a package src.rpm from file or URL
+- new req command, to issue arbitrary requests to the API
+- initial support for commit messages (ci -m/-F)
- implementing a log command to review the commit log
- renamed previous "log" command to "buildlog" (short: bl)
-- initial support for commit messages (ci -m/-F)
- NOTE: if -m is used, osc uses a different mode of uploading
- files and commit them, namely the way which is currently
- documented in the api. So far, osc was uploading each file
- separately through the old backward compatible way. This way
- of committing can also be forced with do_commits = 1 in
- .oscrc.
+- new meta command, replacing editmeta, editprj, createprj,
+ editpac, createpac, edituser, pattern
+- added search support
+- show helpful xml error messages if broken metadata is uploaded
0.97:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/osc-0.97/osc/build.py new/osc-0.98/osc/build.py
--- old/osc-0.97/osc/build.py 2007-07-16 19:30:48.000000000 +0200
+++ new/osc-0.98/osc/build.py 2007-09-03 12:25:18.000000000 +0200
@@ -217,6 +217,8 @@
buildargs.append('--clean')
if opts.noinit:
buildargs.append('--noinit')
+ if not opts.no_changelog:
+ buildargs.append('--changelog')
buildargs = ' '.join(buildargs)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/osc-0.97/osc/commandline.py new/osc-0.98/osc/commandline.py
--- old/osc-0.97/osc/commandline.py 2007-08-08 21:48:38.000000000 +0200
+++ new/osc-0.98/osc/commandline.py 2007-09-03 12:25:18.000000000 +0200
@@ -32,37 +32,28 @@
cmdln.Cmdln.__init__(self, *args, **kwargs)
cmdln.Cmdln.do_help.aliases.append('h')
- conf.get_config()
-
def get_optparser(self):
"""this is the parser for "global" options (not specific to subcommand)"""
optparser = cmdln.CmdlnOptionParser(self, version=get_osc_version())
optparser.add_option('-H', '--http-debug', action='store_true',
- default=conf.config['http_debug'],
help='debug HTTP traffic')
optparser.add_option('-A', '--apisrv', dest='apisrv',
metavar='URL',
help='specify URL to access API server at')
+ optparser.add_option('-c', '--config', dest='conffile',
+ metavar='FILE',
+ help='specify alternate configuration file')
return optparser
def postoptparse(self):
"""merge commandline options into the config"""
- conf.config['http_debug'] = self.options.http_debug
- if self.options.apisrv:
- conf.config['scheme'], conf.config['apisrv'] = \
- conf.parse_apisrv_url(conf.config['scheme'], self.options.apisrv)
- conf.config['apiurl'] = conf.config['scheme'] + '://' + conf.config['apisrv']
-
- # XXX unless config['user'] goes away (and is replaced with a handy function, or
- # config becomes an object, even better), set the global 'user' here as well:
- conf.config['user'] = conf.config['auth_dict'][conf.config['apisrv']]['user']
-
- # finally, initialize urllib2 for to use the credentials for Basic Authentication
- conf.init_basicauth(conf.config)
+ conf.get_config(override_conffile = self.options.conffile,
+ override_http_debug = self.options.http_debug,
+ override_apisrv = self.options.apisrv)
def do_init(self, subcmd, opts, project, package):
@@ -85,16 +76,27 @@
@cmdln.alias('ls')
+ @cmdln.option('-a', '--arch', metavar='ARCH',
+ help='specify architecture')
+ @cmdln.option('-r', '--repo', metavar='REPO',
+ help='specify repository')
+ @cmdln.option('-b', '--binaries', action='store_true',
+ help='list built binaries, instead of sources')
@cmdln.option('-v', '--verbose', action='store_true',
help='print extra information')
def do_list(self, subcmd, opts, *args):
"""${cmd_name}: List existing content on the server
+ This command is used to list sources, or binaries (when used with the
+ --binaries option). To use the --binary option, --repo and --arch are
+ also required.
+
Examples:
ls # list all projects
ls Apache # list packages in a project
- ls Apache apache2 # list files of package of a project
- ls -v Apache apache2 # verbosely list files of package of a project
+ ls -b Apache # list all binaries of a project
+ ls Apache apache2 # list source files of package of a project
+ ls -v Apache apache2 # verbosely list source files of package
With --verbose, the following fields will be shown for each item:
MD5 hash of file
@@ -108,28 +110,55 @@
args = slash_split(args)
- if not args:
- print '\n'.join(meta_get_project_list(conf.config['apiurl']))
-
- elif len(args) == 1:
+ if len(args) == 1:
project = args[0]
- if opts.verbose:
- sys.exit('The verbose option is not implemented for projects.')
- print '\n'.join(meta_get_packagelist(conf.config['apiurl'], project))
-
elif len(args) == 2:
project = args[0]
package = args[1]
- l = meta_get_filelist(conf.config['apiurl'],
- project,
- package,
- verbose=opts.verbose)
- if opts.verbose:
- for i in l:
- print '%s %7d %9d %s %s' \
- % (i.md5, i.rev, i.size, shorttime(i.mtime), i.name)
- else:
- print '\n'.join(l)
+
+ if opts.binaries and (not opts.repo or not opts.arch):
+ sys.exit('missing options:\n'
+ '-r <repo> -a <arch>\n'
+ 'list repositories with:\n'
+ '\'osc platforms %s\'' %project)
+
+ # list binaries
+ if opts.binaries:
+ if not args:
+ sys.exit('there are no binaries to list above project level.')
+
+ elif len(args) == 1:
+ #if opts.verbose:
+ # sys.exit('The verbose option is not implemented for projects.')
+ r = get_binarylist(conf.config['apiurl'], project, opts.repo, opts.arch)
+ print '\n'.join(r)
+
+ elif len(args) == 2:
+ r = get_binarylist(conf.config['apiurl'], project, opts.repo, opts.arch, package=package)
+ print '\n'.join(r)
+
+ # list sources
+ elif not opts.binaries:
+ if not args:
+ print '\n'.join(meta_get_project_list(conf.config['apiurl']))
+
+ elif len(args) == 1:
+ if opts.verbose:
+ sys.exit('The verbose option is not implemented for projects.')
+
+ print '\n'.join(meta_get_packagelist(conf.config['apiurl'], project))
+
+ elif len(args) == 2:
+ l = meta_get_filelist(conf.config['apiurl'],
+ project,
+ package,
+ verbose=opts.verbose)
+ if opts.verbose:
+ for i in l:
+ print '%s %7d %9d %s %s' \
+ % (i.md5, i.rev, i.size, shorttime(i.mtime), i.name)
+ else:
+ print '\n'.join(l)
@cmdln.option('-F', '--file', metavar='FILE',
@@ -163,13 +192,17 @@
the --file switch. If the argument is '-', input is taken from stdin:
osc meta prjconf home:poeml | sed ... | osc meta prjconf home:poeml -F -
- The --create switch is subject to discussion and not implemented. The
- current behaviour is to create a non-existing resource implicitely, if
- while it is edited.
+ When trying to edit a non-existing resource, it is created implicitely.
- usage:
+
+ Examples:
+ osc meta prj PRJ
+ osc meta pkg PRJ PKG
+ osc meta pkg PRJ PKG -e
+
+ Usage:
osc meta ARGS...
- osc meta -e|--edit [-c|--create] ARGS...
+ osc meta -e|--edit ARGS...
osc meta -F|--file ARGS...
osc meta pattern --delete PRJ PATTERN
${cmd_option_list}
@@ -861,22 +894,15 @@
args = parseargs(args)
pacs = findpacs(args)
- # this is experimental in that it enables a different way of uploading files
- # see osc.core.Package.put_source_file()
- # I assume that if -m is used, we want to commit this way.
- if opts.message or opts.file:
- conf.config['do_commits'] = True
-
for p in pacs:
msg = ''
- if conf.config['do_commits']:
- if opts.message:
- msg = opts.message
- elif opts.file:
- try:
- msg = open(opts.file).read()
- except:
- sys.exit('could not open file \'%s\'.' % opts.file)
+ if opts.message:
+ msg = opts.message
+ elif opts.file:
+ try:
+ msg = open(opts.file).read()
+ except:
+ sys.exit('could not open file \'%s\'.' % opts.file)
p.commit(msg)
@@ -1092,7 +1118,7 @@
pacs = findpacs(args)
for pac in pacs:
- print ''.join(show_results_meta(pac.apiurl, pac.prjname, pac.name))
+ print ''.join(show_results_meta(pac.apiurl, pac.prjname, package=pac.name))
def do_results(self, subcmd, opts, *args):
@@ -1290,6 +1316,8 @@
@cmdln.option('--clean', action='store_true',
help='Delete old build root before initializing it')
+ @cmdln.option('--no-changelog', action='store_true',
+ help='don\'t update the package changelog from a changes file')
@cmdln.option('--noinit', '--no-init', action='store_true',
help='Skip initialization of build root and start with build immediately.')
@cmdln.option('-p', '--prefer-pkgs', metavar='DIR', action='append',
@@ -1342,11 +1370,16 @@
builddist = os.getenv('BUILD_DIST')
if builddist:
- #args[3] = args[0]
hyphen = builddist.rfind('-')
- args.insert(1, builddist[hyphen+1:])
- args.insert(1, builddist[:hyphen])
- print sys.argv
+ if len(args) == 1:
+ args = (builddist[:hyphen], builddist[hyphen+1:], args[0])
+ elif len(args) == 0:
+ print >>sys.stderr, 'Missing argument: build description (spec of dsc file)'
+ return 2
+ else:
+ print >>sys.stderr, 'Too many arguments'
+ return 2
+ # print sys.argv
elif len(args) >= 2 and len(args) < 3:
print >>sys.stderr, 'Missing argument: build description (spec of dsc file)'
@@ -1549,6 +1582,8 @@
print wipebinaries(conf.config['apiurl'], args[0], package, opts.arch, opts.repo, opts.build_disabled)
+ @cmdln.option('--repos-baseurl', action='store_true',
+ help='show base URLs of download repositories')
@cmdln.option('-e', '--enable-exact', action='store_true',
help='show only exact matches')
@cmdln.option('--package', action='store_true',
@@ -1598,7 +1633,7 @@
if not search_for:
search_for = [ 'project', 'package' ]
for kind in search_for:
- result = search(conf.config['apiurl'], set(search_list), kind, args[0], opts.verbose, opts.enable_exact)
+ result = search(conf.config['apiurl'], set(search_list), kind, args[0], opts.verbose, opts.enable_exact, opts.repos_baseurl)
if result:
if kind == 'package':
headline = [ '# Package', '# Project' ]
@@ -1606,6 +1641,8 @@
headline = [ '# Project' ]
if opts.verbose:
headline.append('# Title')
+ if opts.repos_baseurl:
+ headline.append('# URL')
if len(search_for) > 1:
print '#' * 68
print 'matches for \'%s\' in %ss:\n' % (args[0], kind)
@@ -1662,7 +1699,7 @@
project_dir = os.getcwd()
if not is_project_dir(project_dir):
- print >>sys.stderr, 'project dir \'%s\' does not exist' % project
+ print >>sys.stderr, 'project dir \'%s\' does not exist' % opts.project
sys.exit(1)
else:
project = store_read_project(project_dir)
@@ -1770,11 +1807,11 @@
file=opts.file)
except urllib2.HTTPError, e:
- if e.code == 400:
+ if e.code in [400, 404]:
print >>sys.stderr, e
print >>sys.stderr, e.read()
sys.exit(1)
- if e.code == 500:
+ elif e.code == 500:
print >>sys.stderr, e
# this may be unhelpful... because it may just print a big blob of uninteresting
# ichain html and javascript... however it could potentially be useful if the orign
@@ -1793,6 +1830,43 @@
sys.stdout.write(out)
+ @cmdln.option('-e', '--email', action='store_true',
+ help='show email addresses instead of user names')
+ def do_maintainer(self, subcmd, opts, *args):
+ """${cmd_name}: Show maintainers of a project/package
+
+ To be used like this:
+
+ osc maintainer PRJ
+ or
+ osc maintainer PRJ PKG
+
+ ${cmd_usage}
+ ${cmd_option_list}
+ """
+
+ if len(args) == 1:
+ m = show_project_meta(conf.config['apiurl'], args[0])
+ elif len(args) == 2:
+ m = show_package_meta(conf.config['apiurl'], args[0], args[1])
+ else:
+ sys.exit('wrong argument count')
+
+ maintainers = []
+
+ tree = ET.parse(StringIO(''.join(m)))
+ for person in tree.findall('person'):
+ maintainers.append(person.get('userid'))
+
+ if not opts.email:
+ print ', '.join(maintainers)
+ else:
+ emails = []
+ for maintainer in maintainers:
+ emails.append(get_user_email(conf.config['apiurl'], maintainer))
+ print ', '.join(emails)
+
+
# fini!
###############################################################################
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/osc-0.97/osc/conf.py new/osc-0.98/osc/conf.py
--- old/osc-0.97/osc/conf.py 2007-08-08 15:24:52.000000000 +0200
+++ new/osc-0.98/osc/conf.py 2007-08-22 12:18:25.000000000 +0200
@@ -56,11 +56,8 @@
'http_debug': '0',
'cookiejar': '~/.osc_cookiejar',
-
- # switched off for now (testing)
- 'do_commits': '0',
}
-boolean_opts = ['http_debug', 'do_commits']
+boolean_opts = ['http_debug']
new_conf_template = """
[general]
@@ -163,13 +160,16 @@
authhandler.add_password(None, host, auth['user'], auth['pass'])
-def get_config():
+def get_config(override_conffile = None,
+ override_http_debug = None,
+ override_apisrv = None):
"""do the actual work (see module documentation)"""
import os
import sys
global config
- conffile = os.path.expanduser('~/.oscrc')
+ conffile = override_conffile or os.environ.get('OSC_CONFIG', '~/.oscrc')
+ conffile = os.path.expanduser(conffile)
if not os.path.exists(conffile):
@@ -251,3 +251,20 @@
# add the auth data we collected to the config dict
config['auth_dict'] = auth_dict
+ # override values which we were called with
+ if override_http_debug:
+ config['http_debug'] = override_http_debug
+ if override_apisrv:
+ config['scheme'], config['apisrv'] = \
+ parse_apisrv_url(config['scheme'], override_apisrv)
+
+ # to make the mess complete, set up the more convenient api url which we'll rather use
+ config['apiurl'] = config['scheme'] + '://' + config['apisrv']
+
+ # XXX unless config['user'] goes away (and is replaced with a handy function, or
+ # config becomes an object, even better), set the global 'user' here as well:
+ config['user'] = config['auth_dict'][config['apisrv']]['user']
+
+ # finally, initialize urllib2 for to use the credentials for Basic Authentication
+ init_basicauth(config)
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/osc-0.97/osc/core.py new/osc-0.98/osc/core.py
--- old/osc-0.97/osc/core.py 2007-08-04 23:11:31.000000000 +0200
+++ new/osc-0.98/osc/core.py 2007-09-03 12:17:04.000000000 +0200
@@ -5,7 +5,7 @@
# and distributed under the terms of the GNU General Public Licence,
# either version 2, or (at your option) any later version.
-__version__ = '0.97'
+__version__ = '0.98'
import os
import sys
@@ -288,9 +288,7 @@
# escaping '+' in the URL path (note: not in the URL query string) is
# only a workaround for ruby on rails, which swallows it otherwise
- query = []
- if conf.config['do_commits']:
- query.append('rev=upload')
+ query = ['rev=upload']
u = makeurl(self.apiurl, ['source', self.prjname, self.name, pathname2url(n)], query=query)
http_PUT(u, file = os.path.join(self.dir, n))
@@ -330,21 +328,18 @@
sys.stdout.flush()
self.put_source_file(filename)
# all source files are committed - now comes the log
- if conf.config['do_commits']:
- query = []
- query.append('cmd=commit')
- query.append('rev=upload')
- query.append('user=%s' % conf.config['user'])
- query.append('comment=%s' % quote_plus(msg))
- u = makeurl(self.apiurl, ['source', self.prjname, self.name], query=query)
- #print u
- f = http_POST(u)
- root = ET.parse(f).getroot()
- self.rev = int(root.get('rev'))
- print
- print 'Committed revision %s.' % self.rev
- else:
- print
+ query = []
+ query.append('cmd=commit')
+ query.append('rev=upload')
+ query.append('user=%s' % conf.config['user'])
+ query.append('comment=%s' % quote_plus(msg))
+ u = makeurl(self.apiurl, ['source', self.prjname, self.name], query=query)
+ #print u
+ f = http_POST(u)
+ root = ET.parse(f).getroot()
+ self.rev = int(root.get('rev'))
+ print
+ print 'Committed revision %s.' % self.rev
self.update_local_filesmeta()
self.write_deletelist()
@@ -628,7 +623,6 @@
tree.find('description').text = ''.join(self.descr)
tree.write(filename)
- # FIXME: escape stuff for xml
print '*' * 36, 'old', '*' * 36
print m
print '*' * 36, 'new', '*' * 36
@@ -873,7 +867,7 @@
sys.exit(1)
if v != __version__:
- if v in ['0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '0.95', '0.96']:
+ if v in ['0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '0.95', '0.96', '0.97']:
# version is fine, no migration needed
f = open(versionfile, 'w')
f.write(__version__ + '\n')
@@ -1188,6 +1182,17 @@
return None
+def get_user_email(apiurl, user):
+ u = makeurl(apiurl, ['person', quote_plus(user)])
+ try:
+ f = http_GET(u)
+ root = ET.parse(f).getroot()
+ return root.find('email').text
+ except urllib2.HTTPError:
+ print 'user \'%s\' not found' % user
+ return None
+
+
def get_source_file(apiurl, prj, package, filename, targetfilename=None, revision = None):
query = []
if revision:
@@ -1205,6 +1210,45 @@
o.close()
+def get_binary_file(apiurl, prj, repo, arch,
+ filename, targetfilename=None,
+ package=None,
+ progress_meter=False):
+
+ where = package or '_repository'
+ u = makeurl(apiurl, ['build', prj, repo, arch, where, filename])
+
+ if progress_meter:
+ sys.stdout.write("Downloading %s [ 0%%]" % filename)
+ sys.stdout.flush()
+
+ f = http_GET(u)
+ binsize = int(f.headers['content-length'])
+
+ import tempfile
+ (fd, tmpfilename) = tempfile.mkstemp(prefix = filename + '.', suffix = '.osc', dir = '/tmp')
+
+ o = os.fdopen(fd, 'w')
+
+ downloaded = 0
+ while 1:
+ #buf = f.read(BUFSIZE)
+ buf = f.read(16384)
+ if not buf: break
+ o.write(buf)
+ downloaded += len(buf)
+ if progress_meter:
+ completion = str(int((float(downloaded)/binsize)*100))
+ sys.stdout.write('%s%*s%%]' % ('\b'*5, 3, completion))
+ sys.stdout.flush()
+ o.close()
+
+ if progress_meter:
+ sys.stdout.write('\n')
+
+ shutil.move(tmpfilename, targetfilename or filename)
+
+
def dgst(file):
#if not os.path.exists(file):
@@ -1459,8 +1503,28 @@
return r
-def show_results_meta(apiurl, prj, package):
- u = makeurl(apiurl, ['build', prj, '_result?package=%s' % pathname2url(package)])
+def get_binarylist(apiurl, prj, repo, arch, package=None):
+ what = package or '_repository'
+ u = makeurl(apiurl, ['build', prj, repo, arch, what])
+ f = http_GET(u)
+ tree = ET.parse(f)
+ r = [ node.get('filename') for node in tree.findall('binary')]
+ return r
+
+
+def get_binarylist_published(apiurl, prj, repo, arch):
+ u = makeurl(apiurl, ['published', prj, repo, arch])
+ f = http_GET(u)
+ tree = ET.parse(f)
+ r = [ node.get('name') for node in tree.findall('entry')]
+ return r
+
+
+def show_results_meta(apiurl, prj, package=None):
+ query = []
+ if package:
+ query.append('package=%s' % pathname2url(package))
+ u = makeurl(apiurl, ['build', prj, '_result'], query=query)
f = http_GET(u)
return f.readlines()
@@ -1475,7 +1539,7 @@
r = []
result_line_templ = '%(rep)-15s %(arch)-10s %(status)s'
- f = show_results_meta(apiurl, prj, package)
+ f = show_results_meta(apiurl, prj, package=package)
tree = ET.parse(StringIO(''.join(f)))
root = tree.getroot()
@@ -1872,7 +1936,7 @@
table.append(''.join(row))
return table
-def search(apiurl, search_list, kind, search_term, verbose = False, exact_matches = False):
+def search(apiurl, search_list, kind, search_term, verbose = False, exact_matches = False, repos_baseurl = False):
"""
Perform a search for 'search_term'. A list which contains the
results will be returned on success otherwise 'None'. If 'verbose' is true
@@ -1900,6 +1964,8 @@
if len(title) > 60:
title = title[:61] + '...'
result.append(title)
+ if repos_baseurl:
+ result.append('http://download.opensuse.org/repositories/%s/' % project.replace(':', ':/'))
if result:
return result
else:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/osc-0.97/tests.py new/osc-0.98/tests.py
--- old/osc-0.97/tests.py 2007-07-16 12:11:40.000000000 +0200
+++ new/osc-0.98/tests.py 2007-08-14 12:30:39.000000000 +0200
@@ -27,7 +27,7 @@
def checkout_and_clean(self):
- """check out the package and delete all files
+ """check out the package and delete all files.
leave behind the empty package dir"""
runosc('co %s %s' % (PRJ, PAC))
chdir(TESTPACDIR)
@@ -134,6 +134,60 @@
#####################################################################
+ def testCommitMsg(self):
+ """also tests the info and log commands"""
+
+ checkout_and_clean(self)
+
+ # ci -F
+
+ touch('foo')
+ runosc('add foo')
+ open('msgfile', 'w').write('message from file')
+
+ self.out, self.err = runosc('ci -F msgfile')
+ self.assertEqual(self.err, '')
+
+ self.out, self.err = runosc('info')
+ self.assertEqual(self.err, '')
+ self.assert_('Path: .\n' in self.out)
+ self.assert_('Repository UUID' in self.out)
+ self.assert_('Revision' in self.out)
+
+ lastrev = self.out[self.out.find('Revision') + 10 :].strip()
+
+ self.out, self.err = runosc('log -r %s' % lastrev)
+ self.assertEqual(self.err, '')
+ cl = self.out.splitlines()
+ self.assertEqual(len(cl), 5)
+ self.assert_(cl[1].startswith('r%s | poeml | ' % lastrev))
+ self.assertEqual(cl[2], '')
+ self.assertEqual(cl[3], 'message from file')
+
+ # ci -m
+
+ touch('bar')
+ runosc('add bar')
+ self.out, self.err = runosc('ci -m "message from commandline"')
+ self.assertEqual(self.err, '')
+
+ self.out, self.err = runosc('info')
+ self.assertEqual(self.err, '')
+ lastrev = self.out[self.out.find('Revision') + 10 :].strip()
+
+ self.out, self.err = runosc('log -r %s' % lastrev)
+ self.assertEqual(self.err, '')
+ cl = self.out.splitlines()
+ self.assertEqual(len(cl), 5)
+ self.assert_(cl[1].startswith('r%s | poeml | ' % lastrev))
+ self.assertEqual(cl[2], '')
+ self.assertEqual(cl[3], 'message from commandline')
+
+
+
+
+ #####################################################################
+
def testMerge(self):
wc1 = os.path.join(BASEDIR, TESTPACDIR)
@@ -271,7 +325,7 @@
self.assertEqual(self.err, '')
self.assertEqual(self.out, 'A foo1\n')
- self.out, self.err = runosc('ci')
+ self.out, self.err = runosc('ci -m msg')
self.assertEqual(self.err, '')
self.assertEqual(remove_revid(self.out), """Sending foo1
Transmitting file data .
@@ -284,7 +338,7 @@
self.assertEqual(self.err, '')
self.assertEqual(self.out, 'D foo1\n')
- self.out, self.err = runosc('ci')
+ self.out, self.err = runosc('ci -m msg')
self.assertEqual(self.err, '')
self.assertEqual(remove_revid(self.out), """Deleting foo1
Transmitting file data
@@ -321,7 +375,7 @@
self.assertEqual(self.out, 'A foo2\n')
# check in a single argument
- self.out, self.err = runosc('ci foo2')
+ self.out, self.err = runosc('ci -m msg foo2')
self.assertEqual(self.err, '')
self.assertEqual(remove_revid(self.out), """Sending foo2
Transmitting file data .
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/osc-0.97/TODO new/osc-0.98/TODO
--- old/osc-0.97/TODO 2007-07-16 18:20:09.000000000 +0200
+++ new/osc-0.98/TODO 2007-09-03 12:49:44.000000000 +0200
@@ -1,24 +1,9 @@
MAJOR:
- - commit message handling, and source revision handling. This affects the commands
- co, up, log, ci, diff. (Checking out or diffing against old revivions,
- committing with commit messages, and reviewing the commit log)
-
- - Extending the diff command to take an -rREV argument and show the diff
- of the working copy to that revision
- - and take -rREV:REV as argument and show the diff between those two
- (server-side) revisions
-
- - Extending the checkout command to accept -rREV to check out a specific
- revision
- - possibly extend the update command to accept -rREV as well
-
- - rename "log" subcommand to e.g. "buildlog", and make new "log"
- subcommand for commit logs
-
- changelog handling (equivalent of Novell-internal 'vc' tool, I guess)
(should also work with multiple spec files <package-name>-<repository-name>.spec, and with <package-name>-<version>.spec)
+ see http://lists.opensuse.org/opensuse-buildservice/2007-08/msg00170.html
- think about how to locally build "linked" packages
http://lists4.opensuse.org/opensuse-buildservice/2007-07/msg00043.html
@@ -27,11 +12,13 @@
NORMAL:
+ - Extending the diff command to take -rREV:REV as argument and show the
+ diff between those two (server-side) revisions
- add support for local build of packages which do not exist / have not been
created yet in the buildservice
- add switches to the meta command for easy adding of other maintainers
(like 'osc meta prj --add-maintainer foo')
- - write howto for plugin-izing subcommand implementation
+ - write howto for plugin-izing subcommand implementation (see examples on mailing list)
- split functionality that needs prj/pac as commandline arguments into a seperate tool (oscremote? osc -r?)
- status: implement -u option as in svn [3]
- implement (svn-like) switch command
@@ -39,35 +26,32 @@
- use urllib.urlencode for parameter encoding (or check if this is the case already?)
- _real_ SSL support, with certificate verification
- copypac: put the current release number into the spec file before sending it
- - kill BUILD_ROOT/BUILD_DIST support (or make it configurable? It tends to
- cause confusion if accidentally set. Only useful inside Novell anyway.)
- - show request body of 400 responses (bad request)
- commit: check if errors during PUT are handled sensibly, so the change is
not committed to localmeta
- store password base64 hashed, so it is not directly visible in plaintext
when opening .oscrc and someone is looking over the shoulder
- use http://code.google.com/p/iniparse/ instead of ConfigParser, with
write capability, for the change
-
+ - add switch to commit to change repository options, like to e.g. disable publishing?
MINOR:
- new command: osc listbinaries [<project>] [<package>]
listing the built package, either as URLs or just the filenames? [1]
+ there is ls -b:
+ % osc ls -b home:poeml scapy -r openSUSE_Factory -a x86_64
+ scapy-1.0.4-12.13.noarch.rpm
+ scapy-1.0.4-12.13.src.rpm
+ but it works packagewise. A project wide binary listing would also be cool
- new command: osc getbinaries [<project>] [<package>] [<rpm>]+ [1]
+ -> see incarnations of obs_mirror_project, in particular James Oakleys
+ obs_mirror_project.py
+ this can peruse the new get_binarylist() and get_binary_file() functions
- add option to disable gpg key checking?
- adjust zsh completion to work with cmdln.py implementation
+ - add support for adding tags to packages?
-OPTIONAL:
-
- - add support for importing a src.rpm, extracting it and make it a package
- Something similar can be done by
- osc createpac foo-project foo123
- followed by
- cd foo123; osc init foo-project foo123
- - add support for adding tags to packages?
- - add support for package search
@@ -108,24 +92,6 @@
-
-[2]
-
-editmeta:
-Ah, or rather osc _thought_ it was unmodified because it uses a simple
-timestamp to compare the file with. This is basically suitable for
-humans editing, because they need more than a second... I can change
-that to a real comparison. Meanwhile, you can add a small sleep ;)
-
-On the other hand, it would be even nicer if there would be a facility
-that wouldn't require you to work around with an EDITOR script at all.
-Noted in the todo.
-
-
-
-
-
-
[3]
19:08 < Beineri> DuDE: can you add an option to "up" which moves instead overwriting a file if it has changed in the repository?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org