Hello community,
here is the log from the commit of package osc for openSUSE:Factory
checked in at Wed Jun 8 10:36:09 CEST 2011.
Login failed, 500 Can't connect to bugzilla.novell.com:443 (Connection timed out) at /work/abuild/lib/abuild/modules/SUSE/BugzillaClient.pm line 99.
Use of uninitialized value in numeric eq (==) at /usr/lib/perl5/vendor_perl/5.10.0/IO/Socket/SSL.pm line 1145 during global destruction.
--------
--- osc/osc.changes 2011-04-27 14:27:05.000000000 +0200
+++ /mounts/work_src_done/STABLE/osc/osc.changes 2011-06-07 16:45:33.000000000 +0200
@@ -1,0 +2,23 @@
+Tue Jun 7 14:43:40 UTC 2011 - adrian@suse.de
+
+- update to 0.132.0
+ - rdelete and undelete command requesting now a comment
+ - add 'requestbugownership' command for setting the bugowner via request
+#
+# Features which requires OBS 2.3
+#
+ - new command "createincident" to create maintenance incidents without a request
+ - support to create hidden project on "branch" and "createincident" commands
+ - osc waits and updates package after checkin when a source service is used
+ - support for the new service file mode for "update" and "checkout" command when
+ downloading server side generated files
+ - integration for local source services, they will replace the source_validator mechanism
+
+-------------------------------------------------------------------
+Fri Apr 29 08:14:52 UTC 2011 - adrian@suse.de
+
+- update to 0.131.1
+ - fixes runtime complaining about missing apiurl config.
+- fix wrong links in package description (bnc #690636)
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
osc-0.131.tar.gz
New:
----
osc-0.132.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ osc.spec ++++++
--- /var/tmp/diff_new_pack.BcERQq/_old 2011-06-08 10:35:38.000000000 +0200
+++ /var/tmp/diff_new_pack.BcERQq/_new 2011-06-08 10:35:38.000000000 +0200
@@ -18,7 +18,7 @@
Name: osc
-Version: 0.131
+Version: 0.132.0
Release: 1
Group: Development/Tools/Other
License: GPLv2+
@@ -84,8 +84,8 @@
%description
Commandline client for the openSUSE Build Service.
-See http://en.opensuse.org/Build_Service/CLI , as well as
-http://en.opensuse.org/Build_Service_Tutorial for a general
+See http://en.opensuse.org/openSUSE:OSC , as well as
+http://en.opensuse.org/openSUSE:Build_Service_Tutorial for a general
introduction.
++++++ debian.changelog ++++++
--- /var/tmp/diff_new_pack.BcERQq/_old 2011-06-08 10:35:38.000000000 +0200
+++ /var/tmp/diff_new_pack.BcERQq/_new 2011-06-08 10:35:38.000000000 +0200
@@ -1,3 +1,8 @@
+osc (0.132.0-1) unstable; urgency=low
+ - Update to 0.132.0
+
+ -- Adrian Schroeter Tue, 07 Jun 2011 10:00:00 +0200
+
osc (0.131-1) unstable; urgency=low
- Update to 0.131
++++++ osc-0.131.tar.gz -> osc-0.132.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.131/NEWS new/osc-0.132.0/NEWS
--- old/osc-0.131/NEWS 2011-04-27 14:39:10.000000000 +0200
+++ new/osc-0.132.0/NEWS 2011-06-07 16:42:28.000000000 +0200
@@ -1,5 +1,15 @@
0.132
- -
+ - rdelete and undelete command requesting now a comment
+ - add 'requestbugownership' command for setting the bugowner via request
+#
+# Features which requires OBS 2.3
+#
+ - new command "createincident" to create maintenance incidents without a request
+ - support to create hidden project on "branch" and "createincident" commands
+ - osc waits and updates package after checkin when a source service is used
+ - support for the new service file mode for "update" and "checkout" command when
+ downloading server side generated files
+ - integration for local source services, they will replace the source_validator mechanism
0.131
- new command 'develproject' to print the devel project from the package meta.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.131/osc/babysitter.py new/osc-0.132.0/osc/babysitter.py
--- old/osc-0.131/osc/babysitter.py 2011-04-27 14:22:54.000000000 +0200
+++ new/osc-0.132.0/osc/babysitter.py 2011-06-07 16:42:28.000000000 +0200
@@ -9,6 +9,7 @@
import errno
from osc import oscerr
from urllib2 import URLError, HTTPError
+from httplib import HTTPException, BadStatusLine
from oscsslexcp import NoSecureSSLError
from osc.util.cpio import CpioError
from osc.util.packagequery import PackageError
@@ -123,6 +124,15 @@
return 1
+ except BadStatusLine, e:
+ print >>sys.stderr, 'Server returned an invalid response:', e
+ print >>sys.stderr, e.line
+ return 1
+
+ except HTTPException, e:
+ print >>sys.stderr, e
+ return 1
+
except URLError, e:
print >>sys.stderr, 'Failed to reach a server:\n', e.reason
return 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.131/osc/build.py new/osc-0.132.0/osc/build.py
--- old/osc-0.131/osc/build.py 2011-04-27 14:22:54.000000000 +0200
+++ new/osc-0.132.0/osc/build.py 2011-06-07 16:42:28.000000000 +0200
@@ -463,8 +463,8 @@
opts.local_package = True
if opts.local_package:
pacname = os.path.splitext(build_descr)[0]
+ apihost = urlparse.urlsplit(apiurl)[1]
if not build_root:
- apihost = urlparse.urlsplit(apiurl)[1]
build_root = config['build-root'] % {'repo': repo, 'arch': arch,
'project': prj, 'package': pacname, 'apihost': apihost}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.131/osc/commandline.py new/osc-0.132.0/osc/commandline.py
--- old/osc-0.131/osc/commandline.py 2011-04-27 14:22:54.000000000 +0200
+++ new/osc-0.132.0/osc/commandline.py 2011-06-07 16:42:28.000000000 +0200
@@ -509,7 +509,7 @@
@cmdln.option('--attribute-project', action='store_true',
help='include project values, if missing in packages ')
@cmdln.option('-f', '--force', action='store_true',
- help='force the save operation, allows to ignores some errors like depending repositories. For prj meta only.')
+ help='force the save operation, allows one to ignores some errors like depending repositories. For prj meta only.')
@cmdln.option('-F', '--file', metavar='FILE',
help='read metadata from FILE, instead of opening an editor. '
'\'-\' denotes standard input. ')
@@ -893,6 +893,14 @@
print " Skipping package ", p
else:
print "Skipping package ", p, " since it is a source link pointing inside the project."
+ serviceinfo = root.find('serviceinfo')
+ if serviceinfo != None:
+ if serviceinfo.get('code') != "succeeded":
+ print "Package ", p, " has a ", serviceinfo.get('code'), " source service"
+ sys.exit("Please fix this first")
+ if serviceinfo.get('error'):
+ print "Package ", p, " contains a failed source service."
+ sys.exit("Please fix this first")
# was this project created by clone request ?
u = makeurl(apiurl, ['source', project, '_attribute', 'OBS:RequestCloned'])
@@ -946,7 +954,7 @@
print i,
repl = ''
- if len(myreqs) > 0:
+ if len(myreqs) > 0 and not opts.supersede:
print '\n\nThere are already following submit request: %s.' % \
', '.join([str(i) for i in myreqs ])
repl = raw_input('\nSupersede the old requests? (y/n) ')
@@ -993,6 +1001,19 @@
raise oscerr.WrongArgs('Incorrect number of arguments.\n\n' \
+ self.get_cmd_help('request'))
+ # check for running source service
+ u = makeurl(apiurl, ['source', src_project, src_package])
+ f = http_GET(u)
+ root = ET.parse(f).getroot()
+ serviceinfo = root.find('serviceinfo')
+ if serviceinfo != None:
+ if serviceinfo.get('code') != "succeeded":
+ print "Package ", src_package, " has a ", serviceinfo.get('code'), " source service"
+ sys.exit("Please fix this first")
+ if serviceinfo.get('error'):
+ print "Package ", src_package, " contains a failed source service."
+ sys.exit("Please fix this first")
+
if not opts.nodevelproject:
devloc = None
try:
@@ -1014,13 +1035,29 @@
if not opts.diff:
sys.exit(1)
+ rev=opts.revision
+ if not rev:
+ # get _link info from server, that knows about the local state ...
+ u = makeurl(apiurl, ['source', src_project, src_package])
+ f = http_GET(u)
+ root = ET.parse(f).getroot()
+ linkinfo = root.find('linkinfo')
+ if linkinfo != None:
+ if linkinfo.get('error'):
+ print "Package source is a broken source link."
+ sys.exit("Please fix this first")
+ if linkinfo.get('project') != dst_project or linkinfo.get('package') != dst_package:
+ # the submit target is not link target. use merged md5sum references to avoid not mergable
+ # sources when multiple request from same source get created.
+ rev=linkinfo.get('xsrcmd5')
+
rdiff = None
if opts.diff or not opts.message:
try:
- rdiff = 'old: %s/%s\nnew: %s/%s' %(dst_project, dst_package, src_project, src_package)
+ rdiff = 'old: %s/%s\nnew: %s/%s rev %s' %(dst_project, dst_package, src_project, src_package, rev)
rdiff += server_diff(apiurl,
- dst_project, dst_package, opts.revision,
- src_project, src_package, None, True)
+ dst_project, dst_package, None,
+ src_project, src_package, rev, True)
except:
rdiff = ''
@@ -1034,7 +1071,7 @@
myreqs = [ i for i in reqs if i.state.who == user ]
repl = ''
- if len(myreqs) > 0:
+ if len(myreqs) > 0 and not opts.supersede:
print 'There are already following submit request: %s.' % \
', '.join([i.reqid for i in myreqs ])
repl = raw_input('Supersede the old requests? (y/n/c) ')
@@ -1059,7 +1096,7 @@
result = create_submit_request(apiurl,
src_project, src_package,
dst_project, dst_package,
- opts.message, orev=opts.revision, src_update=src_update)
+ opts.message, orev=rev, src_update=src_update)
if repl.lower() == 'y':
for req in myreqs:
change_request_state(apiurl, req.reqid, 'superseded',
@@ -1496,18 +1533,23 @@
@cmdln.option('-m', '--message', metavar='TEXT',
help='specify message TEXT')
- @cmdln.option('-r', '--role', metavar='role', default='maintainer',
+ @cmdln.option('-r', '--role', metavar='role',
help='specify user role (default: maintainer)')
+ @cmdln.alias("reqbugownership")
+ @cmdln.alias("requestbugownership")
@cmdln.alias("reqmaintainership")
@cmdln.alias("reqms")
+ @cmdln.alias("reqbs")
def do_requestmaintainership(self, subcmd, opts, *args):
- """${cmd_name}: requests to add user as maintainer
+ """${cmd_name}: requests to add user as maintainer or bugowner
usage:
osc requestmaintainership # for current user in checked out package
osc requestmaintainership USER # for specified user in checked out package
osc requestmaintainership PROJECT PACKAGE # for current user
osc requestmaintainership PROJECT PACKAGE USER # request for specified user
+
+ osc requestbugownership ... # accepts same parameters but uses bugowner role
${cmd_option_list}
"""
@@ -1533,14 +1575,23 @@
else:
raise oscerr.WrongArgs('Wrong number of arguments.')
- if not opts.role in ('maintainer', 'bugowner'):
+ role = 'maintainer'
+ if subcmd in ( 'reqbugownership', 'requestbugownership', 'reqbs' ):
+ role = 'bugowner'
+ if opts.role:
+ role = opts.role
+ if not role in ('maintainer', 'bugowner'):
raise oscerr.WrongOptions('invalid \'--role\': either specify \'maintainer\' or \'bugowner\'')
if not opts.message:
opts.message = edit_message()
r = Request()
- r.add_action('add_role', tgt_project=project, tgt_package=package,
- person_name=user, person_role=opts.role)
+ if role == 'bugowner':
+ r.add_action('set_bugowner', tgt_project=project, tgt_package=package,
+ person_name=user)
+ else:
+ r.add_action('add_role', tgt_project=project, tgt_package=package,
+ person_name=user, person_role=role)
r.description = cgi.escape(opts.message or '')
r.create(apiurl)
print r.reqid
@@ -2016,13 +2067,13 @@
print r
except urllib2.HTTPError, e:
if review.by_user:
- print "No permission on review by user %s", review.by_user
+ print 'No permission on review by user %s' % review.by_user
if review.by_group:
- print "No permission on review by group %s", review.by_group
+ print 'No permission on review by group %s' % review.by_group
if review.by_package:
- print "No permission on review by package %s / %s", review.by_project, review.by_package
+ print 'No permission on review by package %s / %s' % (review.by_project, review.by_package)
elif review.by_project:
- print "No permission on review by project %s ", review.by_project
+ print 'No permission on review by project %s' % review.by_project
# Change state of entire request
elif cmd in ['reopen', 'accept', 'decline', 'wipe', 'revoke', 'supersede']:
rq = get_request(apiurl, reqid)
@@ -2118,7 +2169,7 @@
packages = meta_get_packagelist(apiurl, project)
for p in packages:
- print 'setting revision for package %s' % p
+ print 'setting revision to %s for package %s' % (rev, p)
set_link_rev(apiurl, project, p, revision=rev, expand=expand, baserev=baserev)
@@ -2406,13 +2457,14 @@
"""${cmd_name}: Create a request for releasing a maintenance update.
[See http://doc.opensuse.org/products/draft/OBS/obs-reference-guide/cha.obs.maint...
- for information on this topic.]
+ for information on this topic.]
This command is used by the maintence team to start the release process of a maintenance update.
This includes usually testing based on the defined reviewers of the update project.
usage:
osc releaserequest [ SOURCEPROJECT ]
+
${cmd_option_list}
"""
@@ -2443,6 +2495,59 @@
@cmdln.option('-a', '--attribute', metavar='ATTRIBUTE',
help='Use this attribute to find default maintenance project (default is OBS:MaintenanceProject)')
+ @cmdln.option('--noaccess', action='store_true',
+ help='Create a hidden project')
+ @cmdln.option('-m', '--message', metavar='TEXT',
+ help='specify message TEXT')
+ def do_createincident(self, subcmd, opts, *args):
+ """${cmd_name}: Create a maintenance incident
+
+ [See http://doc.opensuse.org/products/draft/OBS/obs-reference-guide/cha.obs.maint...
+ for information on this topic.]
+
+ This command is asking to open an empty maintence incident. This can usually only be done by a responsible
+ maintenance team.
+ Please see the "mbranch" command on how to full such a project content and
+ the "patchinfo" command how add the required maintenance update informations.
+
+ usage:
+ osc createincident [ MAINTENANCEPROJECT ]
+ ${cmd_option_list}
+ """
+
+ args = slash_split(args)
+ apiurl = self.get_api_url()
+ maintenance_attribute = conf.config['maintenance_attribute']
+ if opts.attribute:
+ maintenance_attribute = opts.attribute
+
+ source_project = target_project = None
+
+ if len(args) > 1:
+ raise oscerr.WrongArgs('Too many arguments.')
+
+ if len(args) == 1:
+ target_project = args[1]
+ else:
+ xpath = 'attribute/@name = \'%s\'' % maintenance_attribute
+ res = search(apiurl, project_id=xpath)
+ root = res['project_id']
+ project = root.find('project')
+ if project is None:
+ sys.exit('Unable to find defined OBS:MaintenanceProject project on server.')
+ target_project = project.get('name')
+ print 'Using target project \'%s\'' % target_project
+
+ query = { 'cmd': 'createmaintenanceincident' }
+ if opts.noaccess:
+ query["noaccess"] = 1
+ url = makeurl(apiurl, ['source', target_project], query=query)
+ r = http_POST(url, data=opts.message)
+ print ET.parse(r).getroot().get('code')
+
+
+ @cmdln.option('-a', '--attribute', metavar='ATTRIBUTE',
+ help='Use this attribute to find default maintenance project (default is OBS:MaintenanceProject)')
@cmdln.option('-m', '--message', metavar='TEXT',
help='specify message TEXT')
def do_maintenancerequest(self, subcmd, opts, *args):
@@ -2451,9 +2556,9 @@
[See http://doc.opensuse.org/products/draft/OBS/obs-reference-guide/cha.obs.maint...
for information on this topic.]
- This command is asking the maintence team to start a maintence incident based on a
+ This command is asking the maintence team to start a maintence incident based on a
created maintenance update. Please see the "mbranch" command on how to create such a project and
- the "patchinfo" command how add the required maintenance update informations.
+ the "patchinfo" command how add the required maintenance update information.
usage:
osc maintenancerequest [ SOURCEPROJECT [ TARGETPROJECT ] ]
@@ -2462,9 +2567,9 @@
args = slash_split(args)
apiurl = self.get_api_url()
- attribute = "OBS:MaintenanceProject" # default attribute as defined in api code.
+ maintenance_attribute = conf.config['maintenance_attribute']
if opts.attribute:
- attribute = opts.attribute
+ maintenance_attribute = opts.attribute
source_project = target_project = None
@@ -2481,7 +2586,7 @@
if len(args) > 1:
target_project = args[1]
else:
- xpath = 'attribute/@name = \'%s\'' % attribute
+ xpath = 'attribute/@name = \'%s\'' % maintenance_attribute
res = search(apiurl, project_id=xpath)
root = res['project_id']
project = root.find('project')
@@ -2502,6 +2607,8 @@
'(\'osc bco\' is a shorthand for this option)' )
@cmdln.option('-a', '--attribute', metavar='ATTRIBUTE',
help='Use this attribute to find affected packages (default is OBS:Maintained)')
+ @cmdln.option('--noaccess', action='store_true',
+ help='Create a hidden project')
@cmdln.option('-u', '--update-project-attribute', metavar='UPDATE_ATTRIBUTE',
help='Use this attribute to find update projects (default is OBS:UpdateProject) ')
def do_mbranch(self, subcmd, opts, *args):
@@ -2536,7 +2643,7 @@
tproject = args[1]
r = attribute_branch_pkg(apiurl, maintained_attribute, maintained_update_project_attribute, \
- package, tproject)
+ package, tproject, noaccess = opts.noaccess)
if r is None:
print >>sys.stderr, 'ERROR: Attribute branch call came not back with a project.'
@@ -2570,6 +2677,8 @@
'(\'osc bco\' is a shorthand for this option)' )
@cmdln.option('-f', '--force', default=False, action="store_true",
help='force branch, overwrite target')
+ @cmdln.option('--noaccess', action='store_true',
+ help='Create a hidden project')
@cmdln.option('-m', '--message', metavar='TEXT',
help='specify message TEXT')
@cmdln.option('-r', '--revision', metavar='rev',
@@ -2631,7 +2740,7 @@
nodevelproject=opts.nodevelproject, rev=opts.revision,
target_project=tproject, target_package=tpackage,
return_existing=opts.checkout, msg=opts.message or '',
- force=opts.force)
+ force=opts.force, noaccess=opts.noaccess)
if exists:
print >>sys.stderr, 'Using existing branch project: %s' % targetprj
@@ -2672,6 +2781,8 @@
print_request_list(apiurl, devloc, srcpkg)
+ @cmdln.option('-m', '--message', metavar='TEXT',
+ help='specify log message TEXT')
def do_undelete(self, subcmd, opts, *args):
"""${cmd_name}: Restores a deleted project or package on the server.
@@ -2689,19 +2800,29 @@
if len(args) < 1:
raise oscerr.WrongArgs('Missing argument.')
+ msg = ''
+ if opts.message:
+ msg = opts.message
+ else:
+ msg = edit_message()
+
apiurl = self.get_api_url()
prj = args[0]
pkgs = args[1:]
if pkgs:
for pkg in pkgs:
- undelete_package(apiurl, prj, pkg)
+ undelete_package(apiurl, prj, pkg, msg)
else:
- undelete_project(apiurl, prj)
+ undelete_project(apiurl, prj, msg)
+ @cmdln.option('-r', '--recursive', action='store_true',
+ help='deletes a project with packages inside')
@cmdln.option('-f', '--force', action='store_true',
- help='deletes a package or an empty project')
+ help='deletes a project where other depends on')
+ @cmdln.option('-m', '--message', metavar='TEXT',
+ help='specify log message TEXT')
def do_rdelete(self, subcmd, opts, *args):
"""${cmd_name}: Delete a project or packages on the server.
@@ -2709,10 +2830,12 @@
packages first). Also, packages must have no requests pending (i.e., you need
to accept/revoke such requests first).
If you are sure that you want to remove this project and all
- its packages use \'--force\' switch.
+ its packages use \'--recursive\' switch.
+ It may still not work because other depends on it. If you want to ignore this as
+ well use \'--force\' switch.
usage:
- osc rdelete [-f] PROJECT [PACKAGE]
+ osc rdelete [-r] [-f] PROJECT [PACKAGE]
${cmd_option_list}
"""
@@ -2724,6 +2847,12 @@
apiurl = self.get_api_url()
prj = args[0]
+ msg = ''
+ if opts.message:
+ msg = opts.message
+ else:
+ msg = edit_message()
+
# empty arguments result in recursive project delete ...
if not len(prj):
raise oscerr.WrongArgs('Project argument is empty')
@@ -2743,15 +2872,15 @@
'Or just use \'--force\'.'
sys.exit(1)
- delete_package(apiurl, prj, pkg)
+ delete_package(apiurl, prj, pkg, opts.force, msg)
- elif len(meta_get_packagelist(apiurl, prj)) >= 1 and not opts.force:
+ elif (not opts.recursive) and len(meta_get_packagelist(apiurl, prj)) >= 1:
print >>sys.stderr, 'Project contains packages. It must be empty before deleting it. ' \
'If you are sure that you want to remove this project and all its ' \
- 'packages use the \'--force\' switch.'
+ 'packages use the \'--recursive\' switch.'
sys.exit(1)
else:
- delete_project(apiurl, prj)
+ delete_project(apiurl, prj, opts.force, msg)
@cmdln.hide(1)
def do_deletepac(self, subcmd, opts, *args):
@@ -2992,6 +3121,151 @@
run_pager(rdiff)
+ def _pdiff_raise_non_existing_package(self, project, package, msg = None):
+ raise oscerr.PackageMissing(project, package, msg or '%s/%s does not exist.' % (project, package))
+
+ def _pdiff_package_exists(self, apiurl, project, package):
+ try:
+ show_package_meta(apiurl, project, package)
+ return True
+ except urllib2.HTTPError, e:
+ if e.code != 404:
+ print >>sys.stderr, 'Cannot check that %s/%s exists: %s' % (project, package, e)
+ return False
+
+ def _pdiff_guess_parent(self, apiurl, project, package, check_exists_first = False):
+ # Make sure the parent exists
+ if check_exists_first and not self._pdiff_package_exists(apiurl, project, package):
+ self._pdiff_raise_non_existing_package(project, package)
+
+ if project.startswith('home:'):
+ guess = project[len('home:'):]
+ # remove user name
+ pos = guess.find(':')
+ if pos > 0:
+ guess = guess[guess.find(':') + 1:]
+ if guess.startswith('branches:'):
+ guess = guess[len('branches:'):]
+ return (guess, package)
+
+ return (None, None)
+
+ def _pdiff_get_parent_from_link(self, apiurl, project, package):
+ link_url = makeurl(apiurl, ['source', project, package, '_link'])
+
+ try:
+ file = http_GET(link_url)
+ root = ET.parse(file).getroot()
+ except urllib2.HTTPError, e:
+ return (None, None)
+ except SyntaxError, e:
+ print >>sys.stderr, 'Cannot parse %s/%s/_link: %s' % (project, package, e)
+ return (None, None)
+
+ parent_project = root.get('project')
+ parent_package = root.get('package') or package
+
+ if parent_project is None:
+ return (None, None)
+
+ return (parent_project, parent_package)
+
+ def _pdiff_get_exists_and_parent(self, apiurl, project, package):
+ link_url = makeurl(apiurl, ['public', 'source', project, package])
+ try:
+ file = http_GET(link_url)
+ root = ET.parse(file).getroot()
+ except urllib2.HTTPError, e:
+ if e.code != 404:
+ print >>sys.stderr, 'Cannot get list of files for %s/%s: %s' % (project, package, e)
+ return (None, None, None)
+ except SyntaxError, e:
+ print >>sys.stderr, 'Cannot parse list of files for %s/%s: %s' % (project, package, e)
+ return (None, None, None)
+
+ link_node = root.find('linkinfo')
+ if link_node is None:
+ return (True, None, None)
+
+ parent_project = link_node.get('project')
+ parent_package = link_node.get('package') or package
+
+ if parent_project is None:
+ raise oscerr.APIError('%s/%s is a link with no parent?' % (project, package))
+
+ return (True, parent_project, parent_package)
+
+ @cmdln.option('-p', '--plain', action='store_true',
+ dest='plain',
+ help='output the diff in plain (not unified) diff format')
+ @cmdln.option('-n', '--nomissingok', action='store_true',
+ dest='nomissingok',
+ help='fail if the parent package does not exist on the server')
+ def do_pdiff(self, subcmd, opts, *args):
+ """${cmd_name}: Quick alias to diff the content of a package with its parent.
+
+ Usage:
+ osc pdiff [--plain|-p] [--nomissing-ok|-n]
+ osc pdiff [--plain|-p] [--nomissing-ok|-n] PKG
+ osc pdiff [--plain|-p] [--nomissing-ok|-n] PRJ PKG
+
+ ${cmd_option_list}
+ """
+
+ apiurl = self.get_api_url()
+ args = slash_split(args)
+
+ unified = not opts.plain
+ noparentok = not opts.nomissingok
+
+ if len(args) > 2:
+ raise oscerr.WrongArgs('Too many arguments.')
+
+ if len(args) == 0:
+ if not is_package_dir(os.getcwd()):
+ raise oscerr.WrongArgs('Current directory is not a checked out package. Please specify a project and a package.')
+ project = store_read_project(os.curdir)
+ package = store_read_package(os.curdir)
+ elif len(args) == 1:
+ if not is_project_dir(os.getcwd()):
+ raise oscerr.WrongArgs('Current directory is not a checked out project. Please specify a project and a package.')
+ project = store_read_project(os.curdir)
+ package = args[0]
+ elif len(args) == 2:
+ project = args[0]
+ package = args[1]
+ else:
+ raise RuntimeError('Internal error: bad check for arguments.')
+
+ ## Find parent package
+
+ # Old way, that does one more request to api
+ #(parent_project, parent_package) = self._pdiff_get_parent_from_link(apiurl, project, package)
+ #if not parent_project:
+ # (parent_project, parent_package) = self._pdiff_guess_parent(apiurl, project, package, check_exists_first = True)
+ # if parent_project and parent_package:
+ # print 'Guessed that %s/%s is the parent package.' % (parent_project, parent_package)
+
+ # New way
+ (exists, parent_project, parent_package) = self._pdiff_get_exists_and_parent (apiurl, project, package)
+ if not exists:
+ self._pdiff_raise_non_existing_package(project, package)
+ if not parent_project:
+ (parent_project, parent_package) = self._pdiff_guess_parent(apiurl, project, package, check_exists_first = False)
+ if parent_project and parent_package:
+ print 'Guessed that %s/%s is the parent package.' % (parent_project, parent_package)
+
+ if not parent_project or not parent_package:
+ print >>sys.stderr, 'Cannot find a parent for %s/%s to diff against.' % (project, package)
+ return 1
+
+ if not noparentok and not self._pdiff_package_exists(apiurl, parent_project, parent_package):
+ self._pdiff_raise_non_existing_package(parent_project, parent_package, msg = 'Parent for %s/%s (%s/%s) does not exist.' % (project, package, parent_project, parent_package))
+
+ rdiff = server_diff(apiurl, parent_project, parent_package, None, project, package, None, unified = unified, missingok = noparentok)
+
+ run_pager(rdiff)
+
@cmdln.hide(1)
@cmdln.alias('in')
def do_install(self, subcmd, opts, *args):
@@ -3372,8 +3646,10 @@
help='force commit - do not tests a file list')
@cmdln.option('--skip-validation', default=False, action="store_true",
help='Skip the source validation')
- @cmdln.option('--verbose-validation', default=False, action="store_true",
- help='Run the source validation with verbose information')
+ @cmdln.option('-v', '--verbose', default=False, action="store_true",
+ help='Run the source services and validation with verbose information')
+ @cmdln.option('--skip-local-service-run', default=False, action="store_true",
+ help='Skip service run of \'localonly\' or \'trylocal\' configured source services')
def do_commit(self, subcmd, opts, *args):
"""${cmd_name}: Upload content to the repository server
@@ -3426,20 +3702,16 @@
if conf.config['do_package_tracking'] and is_project_dir(arg):
try:
prj = Project(arg)
- prj.validate_pacs(validators, opts.verbose_validation)
if not msg:
msg = edit_message()
- prj.commit(msg=msg)
+ prj.commit(validators_dir=validators, msg=msg, skip_local_service_run=opts.skip_local_service_run, verbose=opts.verbose)
except oscerr.ExtRuntimeError, e:
- print >>sys.stderr, "ERROR: source_validator failed", e
+ print >>sys.stderr, "ERROR: service run failed", e
return 1
args.remove(arg)
pacs = findpacs(args)
- if conf.config['check_filelist'] and not opts.force:
- check_filelist_before_commit(pacs)
-
if conf.config['do_package_tracking'] and len(pacs) > 0:
prj_paths = {}
single_paths = []
@@ -3457,27 +3729,30 @@
files[pac_path] = pac.todo
else:
single_paths.append(pac.dir)
+ if not pac.todo:
+ pac.todo = pac.filenamelist + pac.filenamelist_unvers
+ pac.todo.sort()
for prj_path, packages in prj_paths.iteritems():
prj = Project(prj_path)
- prj.validate_pacs(validators, opts.verbose_validation, *packages)
if not msg:
msg = get_commit_msg(prj.absdir, pac_objs[prj_path])
- prj.commit(packages, msg=msg, files=files)
+ prj.commit(packages, validators_dir=validators, msg=msg, files=files, skip_local_service_run=opts.skip_local_service_run, verbose=opts.verbose)
store_unlink_file(prj.absdir, '_commit_msg')
for pac in single_paths:
p = Package(pac)
- p.validate(validators, opts.verbose_validation)
if not msg:
msg = get_commit_msg(p.absdir, [p])
- p.commit(msg)
+ p.commit(msg, validators_dir=validators, skip_local_service_run=opts.skip_local_service_run, verbose=opts.verbose)
store_unlink_file(p.absdir, '_commit_msg')
else:
for p in pacs:
p = Package(pac)
- p.validate(validators, opts.verbose_validation)
+ if not p.todo:
+ p.todo = p.filenamelist + p.filenamelist_unvers
+ p.todo.sort()
if not msg:
msg = get_commit_msg(p.absdir, [p])
- p.commit(msg)
+ p.commit(msg, validators_dir=validators, skip_local_service_run=opts.skip_local_service_run, verbose=opts.verbose)
store_unlink_file(p.absdir, '_commit_msg')
@cmdln.option('-r', '--revision', metavar='REV',
@@ -3590,7 +3865,7 @@
p.update(rev, opts.server_side_source_service_files, opts.limit_size)
rev = p.linkinfo.lsrcmd5
elif p.islink() and p.isexpanded():
- rev = p.latest_rev()
+ rev = p.latest_rev(include_service_files=opts.server_side_source_service_files)
p.update(rev, opts.server_side_source_service_files, opts.limit_size)
if opts.source_service_files:
@@ -3918,7 +4193,7 @@
Needs to be called from within a package directory.
When called as buildlogtail (or blt) it just shows the end of the logfile.
- This is usefull to see just a build failure reasons.
+ This is useful to see just a build failure reasons.
The arguments REPOSITORY and ARCH are the first two columns in the 'osc
results' output. If the buildlog url is used buildlog command has the
@@ -4628,9 +4903,14 @@
args = self.parse_repoarchdescr(args, opts.noinit or opts.offline, opts.alternative_project)
# check for source services
- if not opts.noservice and not opts.noinit and os.listdir('.').count("_service"):
+ if not opts.noservice and not opts.noinit:
p = Package('.')
- p.run_source_services()
+ r = p.run_source_services(verbose=True)
+ if r != 0:
+ print >>sys.stderr, 'Source service run failed!'
+ sys.exit(1)
+ # that is currently unreadable on cli, we should not have a backtrace on standard errors:
+ #raise oscerr.ServiceRuntimeError('Service run failed: \'%s\'', r)
if conf.config['no_verify']:
opts.no_verify = True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.131/osc/conf.py new/osc-0.132.0/osc/conf.py
--- old/osc-0.131/osc/conf.py 2011-04-27 14:22:54.000000000 +0200
+++ new/osc-0.132.0/osc/conf.py 2011-06-07 16:42:28.000000000 +0200
@@ -136,9 +136,11 @@
'submitrequest_accepted_template': '',
'submitrequest_declined_template': '',
'linkcontrol': '0',
+ 'include_request_from_project': '1',
# Maintenance defaults to OBS instance defaults
'maintained_attribute': 'OBS:Maintained',
+ 'maintenance_attribute': 'OBS:MaintenanceProject',
'maintained_update_project_attribute': 'OBS:UpdateProject',
'show_download_progress': '0',
}
@@ -149,7 +151,7 @@
boolean_opts = ['debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'traceback', 'check_filelist', 'plaintext_passwd',
'checkout_no_colon', 'checkout_rooted', 'check_for_request_on_action', 'linkcontrol', 'show_download_progress', 'request_show_interactive',
- 'use_keyring', 'gnome_keyring', 'no_verify', 'builtin_signature_check', 'http_full_debug']
+ 'use_keyring', 'gnome_keyring', 'no_verify', 'builtin_signature_check', 'http_full_debug', 'include_request_from_project']
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj']
@@ -823,14 +825,15 @@
raise oscerr.ConfigError('user is blank for %s, please delete of complete the "user=" entry in %s.' % (apiurl,config['conffile']), config['conffile'])
if config['plaintext_passwd'] and passwordx or not config['plaintext_passwd'] and password:
- if not config['plaintext_passwd']:
- if password != passwordx:
- print >>sys.stderr, '%s: rewriting from plain pass to encoded pass' % url
- add_section(conffile, url, user, password)
- else:
+ if config['plaintext_passwd']:
if password != passwordx:
print >>sys.stderr, '%s: rewriting from encoded pass to plain pass' % url
add_section(conffile, url, user, passwordx)
+ password = passwordx
+ else:
+ if password != passwordx:
+ print >>sys.stderr, '%s: rewriting from plain pass to encoded pass' % url
+ add_section(conffile, url, user, password)
if not config['plaintext_passwd']:
password = passwordx
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.131/osc/core.py new/osc-0.132.0/osc/core.py
--- old/osc-0.131/osc/core.py 2011-04-27 14:38:54.000000000 +0200
+++ new/osc-0.132.0/osc/core.py 2011-06-07 16:42:28.000000000 +0200
@@ -3,7 +3,7 @@
# and distributed under the terms of the GNU General Public Licence,
# either version 2, or version 3 (at your option).
-__version__ = '0.131git'
+__version__ = '0.132'
# __store_version__ is to be incremented when the format of the working copy
# "store" changes in an incompatible way. Please add any needed migration
@@ -302,7 +302,7 @@
r.append( s )
return r
- def execute(self, dir, callmode = None, singleservice = None):
+ def execute(self, dir, callmode = None, singleservice = None, verbose = None):
import tempfile
# cleanup existing generated files
@@ -317,6 +317,7 @@
allservices = [data]
# recreate files
+ ret = 0
for service in allservices:
if singleservice and service['name'] != singleservice:
continue
@@ -324,22 +325,25 @@
continue
if service['mode'] != "disabled" and callmode == "disabled":
continue
+ if service['mode'] != "trylocal" and service['mode'] != "localonly" and callmode == "trylocal":
+ continue
call = service['command']
temp_dir = tempfile.mkdtemp()
name = call.split(None, 1)[0]
if not os.path.exists("/usr/lib/obs/service/"+name):
raise oscerr.PackageNotInstalled("obs-service-"+name)
c = "/usr/lib/obs/service/" + call + " --outdir " + temp_dir
- if conf.config['verbose'] > 1:
+ if conf.config['verbose'] > 1 or verbose:
print "Run source service:", c
- ret = subprocess.call(c, shell=True)
- if ret != 0:
+ r = subprocess.call(c, shell=True)
+ if r != 0:
print "ERROR: service call failed: " + c
# FIXME: addDownloadUrlService calls si.execute after
# updating _services.
print " (your _services file may be corrupt now)"
+ ret = r
- if service['mode'] == "disabled" or service['mode'] == "trylocal" or service['mode'] == "localonly" or callmode == "local":
+ if service['mode'] == "disabled" or service['mode'] == "trylocal" or service['mode'] == "localonly" or callmode == "local" or callmode == "trylocal":
for filename in os.listdir(temp_dir):
shutil.move( os.path.join(temp_dir, filename), os.path.join(dir, filename) )
else:
@@ -347,6 +351,8 @@
shutil.move( os.path.join(temp_dir, filename), os.path.join(dir, "_service:"+name+":"+filename) )
os.rmdir(temp_dir)
+ return ret
+
class Linkinfo:
"""linkinfo metadata (which is part of the xml representing a directory
"""
@@ -651,7 +657,7 @@
def update(self, pacs = (), expand_link=False, unexpand_link=False, service_files=False):
if len(pacs):
for pac in pacs:
- Package(os.path.join(self.dir, pac, progress_obj=self.progress_obj)).update()
+ Package(os.path.join(self.dir, pac), progress_obj=self.progress_obj).update()
else:
# we need to make sure that the _packages file will be written (even if an exception
# occurs)
@@ -723,6 +729,7 @@
finally:
self.write_packages()
+ # TO BE OBSOLETED WITH SOURCE SERVICE VALIDATORS
def validate_pacs(self, validators, verbose_validation=False, *pacs):
if len(pacs) == 0:
for pac in self.pacs_broken:
@@ -740,7 +747,8 @@
p = Package(os.path.join(self.dir, pac))
p.validate(validators, verbose_validation)
- def commit(self, pacs = (), msg = '', files = {}, validators_dir = None, verbose_validation = False):
+
+ def commit(self, pacs = (), msg = '', files = {}, validators_dir = None, verbose = False, skip_local_service_run = False):
if len(pacs):
try:
for pac in pacs:
@@ -749,7 +757,7 @@
todo = files[pac]
state = self.get_state(pac)
if state == 'A':
- self.commitNewPackage(pac, msg, todo, validators_dir=validators_dir, verbose_validation=verbose_validation)
+ self.commitNewPackage(pac, msg, todo, validators_dir=validators_dir, verbose=verbose, skip_local_service_run=skip_local_service_run)
elif state == 'D':
self.commitDelPackage(pac)
elif state == ' ':
@@ -759,13 +767,13 @@
else:
p = Package(os.path.join(self.dir, pac))
p.todo = todo
- p.commit(msg, validators_dir=validators_dir, verbose_validation=verbose_validation)
+ p.commit(msg, validators_dir=validators_dir, verbose=verbose, skip_local_service_run=skip_local_service_run)
elif pac in self.pacs_unvers and not is_package_dir(os.path.join(self.dir, pac)):
print 'osc: \'%s\' is not under version control' % pac
elif pac in self.pacs_broken:
print 'osc: \'%s\' package not found' % pac
elif state == None:
- self.commitExtPackage(pac, msg, todo, validators_dir=validators_dir, verbose_validation=verbose_validation)
+ self.commitExtPackage(pac, msg, todo, validators_dir=validators_dir, verbose=verbose)
finally:
self.write_packages()
else:
@@ -779,15 +787,15 @@
state = self.get_state(pac)
if state == ' ':
# do a simple commit
- Package(os.path.join(self.dir, pac)).commit(msg, validators_dir=validators_dir, verbose_validation=verbose_validation)
+ Package(os.path.join(self.dir, pac)).commit(msg, validators_dir=validators_dir, verbose=verbose, skip_local_service_run=skip_local_service_run)
elif state == 'D':
self.commitDelPackage(pac)
elif state == 'A':
- self.commitNewPackage(pac, msg, validators_dir=validators_dir, verbose_validation=verbose_validation)
+ self.commitNewPackage(pac, msg, validators_dir=validators_dir, verbose=verbose, skip_local_service_run=skip_local_service_run)
finally:
self.write_packages()
- def commitNewPackage(self, pac, msg = '', files = [], validators_dir = None, verbose_validation = False):
+ def commitNewPackage(self, pac, msg = '', files = [], validators_dir = None, verbose = False, skip_local_service_run = False):
"""creates and commits a new package if it does not exist on the server"""
if pac in self.pacs_available:
print 'package \'%s\' already exists' % pac
@@ -808,7 +816,7 @@
p = Package(os.path.join(self.dir, pac))
p.todo = files
print statfrmt('Sending', os.path.normpath(p.dir))
- p.commit(msg=msg, validators_dir=validators_dir, verbose_validation=verbose_validation)
+ p.commit(msg=msg, validators_dir=validators_dir, verbose=verbose, skip_local_service_run=skip_local_service_run)
self.set_state(pac, ' ')
os.chdir(olddir)
@@ -834,7 +842,7 @@
delete_package(self.apiurl, self.name, pac)
self.del_package_node(pac)
- def commitExtPackage(self, pac, msg, files = [], validators_dir=None, verbose_validation=False):
+ def commitExtPackage(self, pac, msg, files = [], validators_dir=None, verbose=False):
"""commits a package from an external project"""
if os_path_samefile(os.path.join(self.dir, pac), os.getcwd()):
pac_path = '.'
@@ -853,7 +861,7 @@
template_args=({'name': pac, 'user': user}), apiurl=apiurl)
p = Package(pac_path)
p.todo = files
- p.commit(msg=msg, validators_dir=validators_dir, verbose_validation=verbose_validation)
+ p.commit(msg=msg, validators_dir=validators_dir, verbose=verbose)
def __str__(self):
r = []
@@ -1201,14 +1209,20 @@
if p.wait() != 0:
raise oscerr.ExtRuntimeError('ERROR: source_validator failed:\n%s' % p.stdout, validator)
- def commit(self, msg='', validators_dir=None, verbose_validation=False):
+ def commit(self, msg='', validators_dir=None, verbose=False, skip_local_service_run=False):
# commit only if the upstream revision is the same as the working copy's
upstream_rev = self.latest_rev()
if self.rev != upstream_rev:
raise oscerr.WorkingCopyOutdated((self.absdir, self.rev, upstream_rev))
+ if not skip_local_service_run:
+ r = self.run_source_services(mode="trylocal", verbose=verbose)
+ if r is not 0:
+ print "osc: source service run failed", r
+ raise oscerr.ServiceRuntimeError(r)
+
if not validators_dir is None:
- self.validate(validators_dir, verbose_validation)
+ self.validate(validators_dir, verbose)
if not self.todo:
self.todo = [i for i in self.to_be_added if not i in self.filenamelist] + self.filenamelist
@@ -1314,6 +1328,21 @@
print_request_list(self.apiurl, self.prjname, self.name)
+ if self.findfilebyname("_service"):
+ print 'Waiting for server side source service run',
+ u = makeurl(self.apiurl, ['source', self.prjname, self.name])
+ while 1:
+ f = http_GET(u)
+ sfilelist = ET.parse(f).getroot()
+ s = sfilelist.find('serviceinfo')
+ if s.get('code') == "running":
+ print '.',
+ else:
+ break
+ self.update()
+ print " updated"
+
+
def __write_storelist(self, name, data):
if len(data) == 0:
try:
@@ -1816,23 +1845,23 @@
if os.path.exists(os.path.join(self.storedir, '_frozenlink')):
os.unlink(os.path.join(self.storedir, '_frozenlink'))
- def latest_rev(self):
+ def latest_rev(self, include_service_files=False):
if self.islinkrepair():
- upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrepair=1, meta=self.meta)
+ upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrepair=1, meta=self.meta, include_service_files=include_service_files)
elif self.islink() and self.isexpanded():
if self.isfrozen() or self.ispulled():
- upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev=self.linkinfo.srcmd5, meta=self.meta)
+ upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev=self.linkinfo.srcmd5, meta=self.meta, include_service_files=include_service_files)
else:
try:
- upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, meta=self.meta)
+ upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, meta=self.meta, include_service_files=include_service_files)
except:
try:
- upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev=self.linkinfo.srcmd5, meta=self.meta)
+ upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev=self.linkinfo.srcmd5, meta=self.meta, include_service_files=include_service_files)
except:
- upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev="base", meta=self.meta)
+ upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev="base", meta=self.meta, include_service_files=include_service_files)
self.mark_frozen()
else:
- upstream_rev = show_upstream_rev(self.apiurl, self.prjname, self.name, meta=self.meta)
+ upstream_rev = show_upstream_rev(self.apiurl, self.prjname, self.name, meta=self.meta, include_service_files=include_service_files)
return upstream_rev
def __get_files(self, fmeta_root):
@@ -2022,7 +2051,9 @@
print 'At revision %s.' % self.rev
- def run_source_services(self, mode=None, singleservice=None):
+ def run_source_services(self, mode=None, singleservice=None, verbose=None):
+ if self.name.startswith("_"):
+ return 0
curdir = os.getcwd()
os.chdir(self.absdir) # e.g. /usr/lib/obs/service/verify_file fails if not inside the project dir.
si = Serviceinfo()
@@ -2030,8 +2061,9 @@
service = ET.parse(os.path.join(self.absdir, '_service')).getroot()
si.read(service)
si.getProjectGlobalServices(self.apiurl, self.prjname, self.name)
- si.execute(self.absdir, mode, singleservice)
+ r = si.execute(self.absdir, mode, singleservice, verbose)
os.chdir(curdir)
+ return r
def prepare_filelist(self):
"""Prepare a list of files, which will be processed by process_filelist
@@ -2742,21 +2774,17 @@
def read_filemeta(dir):
global store
- msg = '\'%s\' is not a valid working copy.\n' % dir
+ msg = '\'%s\' is not a valid working copy.' % dir
+ filesmeta = os.path.join(dir, store, '_files')
if not is_package_dir(dir):
raise oscerr.NoWorkingCopy(msg)
-
- filesmeta = os.path.join(dir, store, '_files')
if not os.path.isfile(filesmeta):
- print >>sys.stderr, "Warning: file _files is missing, creating a default one"
- store_write_string(os.path.join(dir, store), '_files', '')
+ raise oscerr.NoWorkingCopy('%s (%s does not exist)' % (msg, filesmeta))
try:
r = ET.parse(filesmeta)
except SyntaxError, e:
- raise oscerr.NoWorkingCopy(msg +
- 'When parsing .osc/_files, the following error was encountered:\n'
- '%s' % (dir, e))
+ raise oscerr.NoWorkingCopy('%s\nWhen parsing .osc/_files, the following error was encountered:\n%s' % (msg, e))
return r
def store_readlist(dir, name):
@@ -3285,16 +3313,26 @@
f = http_GET(makeurl(apiurl, ['source', prj, pac], query=query))
return f.read()
-def show_upstream_srcmd5(apiurl, prj, pac, expand=False, revision=None, meta=False):
+def show_upstream_srcmd5(apiurl, prj, pac, expand=False, revision=None, meta=False, include_service_files=False):
m = show_files_meta(apiurl, prj, pac, expand=expand, revision=revision, meta=meta)
- return ET.fromstring(''.join(m)).get('srcmd5')
+ et = ET.fromstring(''.join(m))
+ if include_service_files:
+ try:
+ if et.find('serviceinfo') and et.find('serviceinfo').get('xsrcmd5'):
+ return et.find('serviceinfo').get('xsrcmd5')
+ except:
+ pass
+ return et.get('srcmd5')
-def show_upstream_xsrcmd5(apiurl, prj, pac, revision=None, linkrev=None, linkrepair=False, meta=False):
- m = show_files_meta(apiurl, prj, pac, revision=revision, linkrev=linkrev, linkrepair=linkrepair, meta=meta)
+def show_upstream_xsrcmd5(apiurl, prj, pac, revision=None, linkrev=None, linkrepair=False, meta=False, include_service_files=False):
+ m = show_files_meta(apiurl, prj, pac, revision=revision, linkrev=linkrev, linkrepair=linkrepair, meta=meta, expand=include_service_files)
+ et = ET.fromstring(''.join(m))
+ if include_service_files:
+ return et.get('srcmd5')
try:
# only source link packages have a <linkinfo> element.
- li_node = ET.fromstring(''.join(m)).find('linkinfo')
+ li_node = et.find('linkinfo')
except:
return None
@@ -3306,9 +3344,16 @@
return li.xsrcmd5
-def show_upstream_rev(apiurl, prj, pac, revision=None, expand=False, linkrev=None, meta=False):
+def show_upstream_rev(apiurl, prj, pac, revision=None, expand=False, linkrev=None, meta=False, include_service_files=False):
m = show_files_meta(apiurl, prj, pac, revision=revision, expand=expand, linkrev=linkrev, meta=meta)
- return ET.fromstring(''.join(m)).get('rev')
+ et = ET.fromstring(''.join(m))
+ if include_service_files:
+ try:
+ if et.find('serviceinfo') and et.find('serviceinfo').get('xsrcmd5'):
+ return et.find('serviceinfo').get('xsrcmd5')
+ except:
+ pass
+ return et.get('rev')
def read_meta_from_spec(specfile, *args):
@@ -3630,10 +3675,13 @@
if package:
todo['package'] = package
for kind, val in todo.iteritems():
- xpath = xpath_join(xpath, '(action/target/@%(kind)s=\'%(val)s\' or ' \
- 'action/source/@%(kind)s=\'%(val)s\' or ' \
- 'submit/target/@%(kind)s=\'%(val)s\' or ' \
- 'submit/source/@%(kind)s=\'%(val)s\')' % {'kind': kind, 'val': val}, op='and')
+ xpath_base = 'action/target/@%(kind)s=\'%(val)s\' or ' \
+ 'submit/target/@%(kind)s=\'%(val)s\''
+
+ if conf.config['include_request_from_project']:
+ xpath_base = xpath_join(xpath_base, 'action/source/@%(kind)s=\'%(val)s\' or ' \
+ 'submit/source/@%(kind)s=\'%(val)s\'', op='or', inner=True)
+ xpath = xpath_join(xpath, xpath_base % {'kind': kind, 'val': val}, op='and', nexpr_parentheses=True)
if conf.config['verbose'] > 1:
print '[ %s ]' % xpath
@@ -3662,10 +3710,14 @@
if package:
todo['package'] = package
for kind, val in todo.iteritems():
- xpath = xpath_join(xpath, '(action/target/@%(kind)s=\'%(val)s\' or ' \
- 'action/source/@%(kind)s=\'%(val)s\' or ' \
- 'submit/target/@%(kind)s=\'%(val)s\' or ' \
- 'submit/source/@%(kind)s=\'%(val)s\')' % {'kind': kind, 'val': val}, op='and')
+ xpath_base = 'action/target/@%(kind)s=\'%(val)s\' or ' \
+ 'submit/target/@%(kind)s=\'%(val)s\''
+
+ if conf.config['include_request_from_project']:
+ xpath_base = xpath_join(xpath_base, 'action/source/@%(kind)s=\'%(val)s\' or ' \
+ 'submit/source/@%(kind)s=\'%(val)s\'', op='or', inner=True)
+ xpath = xpath_join(xpath, xpath_base % {'kind': kind, 'val': val}, op='and', nexpr_parentheses=True)
+
if req_type:
xpath = xpath_join(xpath, 'action/@type=\'%s\'' % req_type, op='and')
for i in exclude_target_projects:
@@ -3985,12 +4037,16 @@
if expand:
rdiff = "## diff on expanded link not possible, showing unexpanded version\n"
try:
- rdiff += server_diff_noex(apiurl,
- old_project, old_package, old_revision,
- new_project, new_package, new_revision,
- unified, missingok, meta, False)
+ rdiff += server_diff_noex(apiurl,
+ old_project, old_package, old_revision,
+ new_project, new_package, new_revision,
+ unified, missingok, meta, False)
except:
- return 'error: diffing failed: %s' % body.find('summary').text
+ elm = ET.fromstring(body).find('summary')
+ summary = ''
+ if not elm is None:
+ summary = elm.text
+ return 'error: diffing failed: %s' % summary
return rdiff
@@ -4130,9 +4186,9 @@
# if it is a link we use the xsrcmd5 as the revision to be
# checked out
try:
- x = show_upstream_xsrcmd5(apiurl, project, package, revision=revision, meta=meta)
+ x = show_upstream_xsrcmd5(apiurl, project, package, revision=revision, meta=meta, include_service_files=server_service_files)
except:
- x = show_upstream_xsrcmd5(apiurl, project, package, revision=revision, meta=meta, linkrev='base')
+ x = show_upstream_xsrcmd5(apiurl, project, package, revision=revision, meta=meta, linkrev='base', include_service_files=server_service_files)
if x:
isfrozen = True
if x:
@@ -4149,7 +4205,7 @@
prj_obj.write_packages()
p.update(revision, server_service_files, size_limit)
if service_files:
- print 'Running local source services'
+ print 'Running all source services local'
p.run_source_services()
def replace_pkg_meta(pkgmeta, new_name, new_prj, keep_maintainers = False,
@@ -4338,7 +4394,7 @@
print 'Done.'
-def attribute_branch_pkg(apiurl, attribute, maintained_update_project_attribute, package, targetproject, return_existing=False, force=False):
+def attribute_branch_pkg(apiurl, attribute, maintained_update_project_attribute, package, targetproject, return_existing=False, force=False, noaccess=False):
"""
Branch packages defined via attributes (via API call)
"""
@@ -4348,6 +4404,8 @@
query['target_project'] = targetproject
if force:
query['force'] = "1"
+ if noaccess:
+ query['noaccess'] = "1"
if package:
query['package'] = package
if maintained_update_project_attribute:
@@ -4369,7 +4427,7 @@
return r
-def branch_pkg(apiurl, src_project, src_package, nodevelproject=False, rev=None, target_project=None, target_package=None, return_existing=False, msg='', force=False):
+def branch_pkg(apiurl, src_project, src_package, nodevelproject=False, rev=None, target_project=None, target_package=None, return_existing=False, msg='', force=False, noaccess=False):
"""
Branch a package (via API call)
"""
@@ -4378,6 +4436,8 @@
query['ignoredevel'] = '1'
if force:
query['force'] = '1'
+ if noaccess:
+ query['noaccess'] = '1'
if rev:
query['rev'] = rev
if target_project:
@@ -4475,21 +4535,39 @@
return 'Done.'
-def undelete_package(apiurl, prj, pac):
- u = makeurl(apiurl, ['source', prj, pac], query={'comment': 'undeleted via osc', 'cmd': 'undelete'})
+def undelete_package(apiurl, prj, pac, msg=None):
+ query={'cmd': 'undelete'}
+ if msg:
+ query['comment'] = msg
+ else:
+ query['comment'] = 'undeleted via osc'
+ u = makeurl(apiurl, ['source', prj, pac], query)
http_POST(u)
-def undelete_project(apiurl, prj):
- u = makeurl(apiurl, ['source', prj], query={'comment': 'undeleted via osc', 'cmd': 'undelete'})
+def undelete_project(apiurl, prj, msg=None):
+ query={'cmd': 'undelete'}
+ if msg:
+ query['comment'] = msg
+ else:
+ query['comment'] = 'undeleted via osc'
+ u = makeurl(apiurl, ['source', prj], query)
http_POST(u)
-def delete_package(apiurl, prj, pac):
- u = makeurl(apiurl, ['source', prj, pac])
+def delete_package(apiurl, prj, pac, force=False, msg=None):
+ query = {}
+ if force:
+ query['force'] = "1"
+ u = makeurl(apiurl, ['source', prj, pac], query)
http_DELETE(u)
-def delete_project(apiurl, prj):
- u = makeurl(apiurl, ['source', prj])
+def delete_project(apiurl, prj, force=False, msg=None):
+ query = {}
+ if force:
+ query['force'] = "1"
+ if msg:
+ query['comment'] = msg
+ u = makeurl(apiurl, ['source', prj], query)
http_DELETE(u)
def delete_files(apiurl, prj, pac, files):
@@ -5111,8 +5189,10 @@
comment.replace('&', '&').replace('<', '>').replace('>', '<'))
r.append('</logentry>')
else:
+ if requestid:
+ requestid="rq" + requestid
s = '-' * 76 + \
- '\nr%s | %s | %s | %s | %s | sr%s\n' % (rev, user, t, srcmd5, version, requestid) + \
+ '\nr%s | %s | %s | %s | %s | %s\n' % (rev, user, t, srcmd5, version, requestid) + \
'\n' + comment
r.append(s)
@@ -5842,7 +5922,13 @@
"""
diff = []
template = []
- files = [i for i in pac.todo if i.endswith('.changes') and pac.status(i) in ('A', 'M')]
+
+ if pac.todo:
+ todo = pac.todo
+ else:
+ todo = pac.filenamelist + pac.filenamelist_unvers
+
+ files = [i for i in todo if i.endswith('.changes') and pac.status(i) in ('A', 'M')]
for filename in files:
if pac.status(filename) == 'M':
@@ -5892,6 +5978,8 @@
footer.extend([''.join(i) for i in p.get_diff(ignoreUnversioned=True)])
lines.extend(get_commit_message_template(p))
if template is None:
+ if lines and lines[0] == '':
+ del lines[0]
template = '\n'.join(lines)
msg = ''
# if footer is empty, there is nothing to commit, and no edit needed.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.131/osc/oscerr.py new/osc-0.132.0/osc/oscerr.py
--- old/osc-0.131/osc/oscerr.py 2011-04-27 14:22:54.000000000 +0200
+++ new/osc-0.132.0/osc/oscerr.py 2011-06-07 16:42:28.000000000 +0200
@@ -48,6 +48,12 @@
self.msg = msg
self.file = fname
+class ServiceRuntimeError(OscBaseError):
+ """Exception raised when there is source service error runtime error"""
+ def __init__(self, msg):
+ OscBaseError.__init__(self)
+ self.msg = msg
+
class WrongArgs(OscBaseError):
"""Exception raised by the cli for wrong arguments usage"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.131/tests/test_commit.py new/osc-0.132.0/tests/test_commit.py
--- old/osc-0.131/tests/test_commit.py 2011-04-27 14:22:54.000000000 +0200
+++ new/osc-0.132.0/tests/test_commit.py 2011-06-07 16:42:28.000000000 +0200
@@ -17,10 +17,12 @@
return FIXTURES_DIR
@GET('http://localhost/source/osctest/simple?rev=latest', file='testSimple_filesremote')
+ @POST('http://localhost/source/osctest/simple?cmd=getprojectservices',
+ exp='', text='<services />')
@POST('http://localhost/source/osctest/simple?comment=&cmd=commitfilelist&user=Admin',
file='testSimple_missingfilelist', expfile='testSimple_lfilelist')
@PUT('http://localhost/source/osctest/simple/nochange?rev=repository',
- exp='This file didn\'t change but\nis modified.\n', text=rev_dummy)
+ exp='This file didn\'t change but\nis modified.\n', text=rev_dummy)
@POST('http://localhost/source/osctest/simple?comment=&cmd=commitfilelist&user=Admin',
file='testSimple_cfilesremote', expfile='testSimple_lfilelist')
def test_simple(self):
@@ -38,6 +40,8 @@
self._check_status(p, 'merge', ' ')
@GET('http://localhost/source/osctest/add?rev=latest', file='testAddfile_filesremote')
+ @POST('http://localhost/source/osctest/add?cmd=getprojectservices',
+ exp='', text='<services />')
@POST('http://localhost/source/osctest/add?comment=&cmd=commitfilelist&user=Admin',
file='testAddfile_missingfilelist', expfile='testAddfile_lfilelist')
@PUT('http://localhost/source/osctest/add/add?rev=repository',
@@ -61,6 +65,8 @@
self._check_status(p, 'nochange', ' ')
@GET('http://localhost/source/osctest/delete?rev=latest', file='testDeletefile_filesremote')
+ @POST('http://localhost/source/osctest/delete?cmd=getprojectservices',
+ exp='', text='<services />')
@POST('http://localhost/source/osctest/delete?comment=&cmd=commitfilelist&user=Admin',
file='testDeletefile_cfilesremote', expfile='testDeletefile_lfilelist')
def test_deletefile(self):
@@ -78,6 +84,8 @@
self._check_status(p, 'merge', ' ')
@GET('http://localhost/source/osctest/conflict?rev=latest', file='testConflictfile_filesremote')
+ @POST('http://localhost/source/osctest/conflict?cmd=getprojectservices',
+ exp='', text='<services />')
def test_conflictfile(self):
"""package has a file which is in conflict state"""
self._change_to_pkg('conflict')
@@ -89,6 +97,8 @@
self._check_conflictlist('merge\n')
@GET('http://localhost/source/osctest/nochanges?rev=latest', file='testNoChanges_filesremote')
+ @POST('http://localhost/source/osctest/nochanges?cmd=getprojectservices',
+ exp='', text='<services />')
def test_nochanges(self):
"""package has no changes (which can be committed)"""
self._change_to_pkg('nochanges')
@@ -102,6 +112,8 @@
self._check_status(p, 'nochange', ' ')
@GET('http://localhost/source/osctest/multiple?rev=latest', file='testMultiple_filesremote')
+ @POST('http://localhost/source/osctest/multiple?cmd=getprojectservices',
+ exp='', text='<services />')
@POST('http://localhost/source/osctest/multiple?comment=&cmd=commitfilelist&user=Admin',
file='testMultiple_missingfilelist', expfile='testMultiple_lfilelist')
@PUT('http://localhost/source/osctest/multiple/nochange?rev=repository', exp='This file did change.\n', text=rev_dummy)
@@ -129,6 +141,8 @@
self._check_status(p, 'nochange', ' ')
@GET('http://localhost/source/osctest/multiple?rev=latest', file='testPartial_filesremote')
+ @POST('http://localhost/source/osctest/multiple?cmd=getprojectservices',
+ exp='', text='<services />')
@POST('http://localhost/source/osctest/multiple?comment=&cmd=commitfilelist&user=Admin',
file='testPartial_missingfilelist', expfile='testPartial_lfilelist')
@PUT('http://localhost/source/osctest/multiple/add?rev=repository', exp='added file\n', text=rev_dummy)
@@ -154,6 +168,8 @@
self.assertRaises(osc.oscerr.OscIOError, p.status, 'foo')
@GET('http://localhost/source/osctest/simple?rev=latest', file='testSimple_filesremote')
+ @POST('http://localhost/source/osctest/simple?cmd=getprojectservices',
+ exp='', text='<services />')
@POST('http://localhost/source/osctest/simple?comment=&cmd=commitfilelist&user=Admin',
file='testSimple_missingfilelist', expfile='testSimple_lfilelist')
@PUT('http://localhost/source/osctest/simple/nochange?rev=repository', exp='This file didn\'t change but\nis modified.\n',
@@ -170,6 +186,8 @@
self._check_status(p, 'nochange', 'M')
@GET('http://localhost/source/osctest/allstates?rev=latest', file='testPartial_filesremote')
+ @POST('http://localhost/source/osctest/allstates?cmd=getprojectservices',
+ exp='', text='<services />')
@POST('http://localhost/source/osctest/allstates?comment=&cmd=commitfilelist&user=Admin',
file='testAllStates_missingfilelist', expfile='testAllStates_lfilelist')
@PUT('http://localhost/source/osctest/allstates/add?rev=repository', exp='added file\n', text=rev_dummy)
@@ -198,6 +216,8 @@
self._check_status(p, 'test', ' ')
@GET('http://localhost/source/osctest/add?rev=latest', file='testAddfile_filesremote')
+ @POST('http://localhost/source/osctest/add?cmd=getprojectservices',
+ exp='', text='<services />')
@POST('http://localhost/source/osctest/add?comment=&cmd=commitfilelist&user=Admin',
file='testAddfile_cfilesremote', expfile='testAddfile_lfilelist')
def test_remoteexists(self):
@@ -217,6 +237,8 @@
self._check_status(p, 'nochange', ' ')
@GET('http://localhost/source/osctest/branch?rev=latest', file='testExpand_filesremote')
+ @POST('http://localhost/source/osctest/branch?cmd=getprojectservices',
+ exp='', text='<services />')
@POST('http://localhost/source/osctest/branch?comment=&cmd=commitfilelist&user=Admin&keeplink=1',
file='testExpand_missingfilelist', expfile='testExpand_lfilelist')
@PUT('http://localhost/source/osctest/branch/simple?rev=repository', exp='simple modified file.\n', text=rev_dummy)
@@ -234,6 +256,8 @@
self._check_status(p, 'simple', ' ')
@GET('http://localhost/source/osctest/added_missing?rev=latest', file='testAddedMissing_filesremote')
+ @POST('http://localhost/source/osctest/added_missing?cmd=getprojectservices',
+ exp='', text='<services />')
def test_added_missing(self):
"""commit an added file which is missing"""
self._change_to_pkg('added_missing')
@@ -245,6 +269,8 @@
self._check_status(p, 'add', '!')
@GET('http://localhost/source/osctest/added_missing?rev=latest', file='testAddedMissing_filesremote')
+ @POST('http://localhost/source/osctest/added_missing?cmd=getprojectservices',
+ exp='', text='<services />')
@POST('http://localhost/source/osctest/added_missing?comment=&cmd=commitfilelist&user=Admin',
file='testAddedMissing_missingfilelist', expfile='testAddedMissing_lfilelist')
@PUT('http://localhost/source/osctest/added_missing/bar?rev=repository', exp='foobar\n', text=rev_dummy)
++++++ osc.dsc ++++++
--- /var/tmp/diff_new_pack.BcERQq/_old 2011-06-08 10:35:38.000000000 +0200
+++ /var/tmp/diff_new_pack.BcERQq/_new 2011-06-08 10:35:38.000000000 +0200
@@ -1,6 +1,6 @@
Format: 1.0
Source: osc
-Version: 0.131
+Version: 0.132.0
Binary: osc
Maintainer: Adrian Schroeter
Architecture: any
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org