from conf import configmgr
import git
import obspkg
+import errors
OSCRC_TEMPLATE = """[general]
apiurl = %(apiurl)s
msger.info('checking status of obs project: %s ...' % target_prj)
if prj.is_new():
msger.info('creating %s for package build ...' % target_prj)
- prj.branch_from(base_prj)
+ try:
+ prj.branch_from(base_prj)
+ except errors.ObsError, e:
+ msger.error('%s' % e)
msger.info('checking out %s/%s to %s ...' % (target_prj, name, tmpdir))
localpkg = obspkg.ObsPackage(tmpdir, target_prj, name, APISERVER, oscrcpath)
return
# pick the 1st valid package inside src prj FIXME
- dumb_pkg = self._bs.getPackageList(src_prj)[0]
+ pkglist = self._bs.getPackageList(src_prj)
+ if len(pkglist) == 0:
+ raise errors.ObsError('base project %s is empty.' % src_prj)
+ dumb_pkg = pkglist[0]
# branch out the new one
target_prj, target_pkg = self._bs.branchPkg(src_prj, dumb_pkg,
target_package = 'dumb_pkg')
if target_prj != self._prj:
- raise ObsError('branched prj: %s is not the expected %s' \
+ raise errors.ObsError('branched prj: %s is not the expected %s' \
% (target_prj, self._prj))
# remove the dumb pkg