import urlparse
import urllib2
import xml.etree.cElementTree as ElementTree
+import errors
from osc import conf, core
class ObsError(Exception):
pac_path = os.path.basename(os.path.normpath(pac.absdir))
files = {}
files[pac_path] = pac.todo
- core.Project(prj).commit(tuple([pac_path]), msg=msg, files=files)
+ try:
+ core.Project(prj).commit(tuple([pac_path]), msg=msg, files=files)
+ except urllib2.HTTPError, e:
+ raise errors.ObsError('%s' % e)
core.store_unlink_file(pac.absdir, '_commit_msg')
def branchPkg(self, src_project, src_package, rev=None, target_project=None, target_package=None):
prj = obspkg.ObsProject(target_prj, apiurl = APISERVER, oscrc = oscrcpath)
msger.info('checking status of obs project: %s ...' % target_prj)
if prj.is_new():
+ if opts.target_obsprj and not target_prj.startswith('home:%s:' % USER):
+ msger.error('no permission to create project %s, only subpackage '\
+ 'of home:%s is allowed ' % (target_prj, USER))
msger.info('creating %s for package build ...' % target_prj)
try:
prj.branch_from(base_prj)
localpkg.update_local()
- msger.info('commit packaging files to build server ...')
- localpkg.commit ('submit packaging files to obs for OBS building')
+ try:
+ msger.info('commit packaging files to build server ...')
+ localpkg.commit ('submit packaging files to obs for OBS building')
+ except errors.ObsError, e:
+ msger.error('commit packages fail: %s, please check the permission '\
+ 'of target project:%s' % (e,target_prj))
os.unlink(oscrcpath)
msger.info('local changes submitted to build server successfully')