On Wed, 14 Nov 2007 20:35:08 -0500 Jesse Keating <[EMAIL PROTECTED]> wrote:
> I've committed my changes to a git tree (cloned from tip today) here: > > http://jkeating.fedorapeople.org/git/koji/ > > Feedback would be welcome. I've rebased this repo against current git. Attached is a diff of the result of applying all the commits from the above repo. -- Jesse Keating Fedora -- All my bits are free, are yours?
diff --git a/builder/kojid b/builder/kojid
index f3afb71..756db12 100755
--- a/builder/kojid
+++ b/builder/kojid
@@ -2149,18 +2149,13 @@ class NewRepoTask(BaseTaskHandler):
def handler(self, tag):
self.uploadpath = self.getUploadDir()
tinfo = session.getTag(tag, strict=True)
- preptask = session.host.subtask(method='prepRepo',
- arglist=[tinfo],
- label='prep',
- parent=self.id,
- arch='noarch')
- repo_id, event_id = self.wait(preptask)[preptask]
+ repo_id, event_id = session.host.repoInit(tinfo['id'])
path = koji.pathinfo.repo(repo_id, tinfo['name'])
if not os.path.isdir(path):
raise koji.GenericError, "Repo directory missing: %s" % path
arches = []
for fn in os.listdir(path):
- if fn != 'groups' and os.path.isdir("%s/%s/RPMS" % (path, fn)):
+ if fn != 'groups' and os.path.isfile("%s/%s/pkglist" % (path, fn)):
arches.append(fn)
#see if we can find a previous repo to update from
oldrepo = session.getRepo(tinfo['id'], state=koji.REPO_READY)
@@ -2180,41 +2175,6 @@ class NewRepoTask(BaseTaskHandler):
session.host.repoDone(repo_id, data)
return repo_id, event_id
-
-class PrepRepoTask(BaseTaskHandler):
- Methods = ['prepRepo']
- _taskWeight = 0.2
-
- def handler(self, tinfo):
- repo_id, event_id = session.host.repoInit(tinfo['id'])
- path = koji.pathinfo.repo(repo_id, tinfo['name'])
- if not os.path.isdir(path):
- raise koji.GenericError, "Repo directory missing: %s" % path
- #create and upload meta rpm
- spec = "%s/groups/groups.spec" % path
- #the repoInit call should have created groups.spec
- if not os.path.exists(spec):
- raise koji.GenericError, "groups.spec missing"
- #build command
- cmd = ['rpmbuild']
- for macro in ('_sourcedir', '_builddir', '_srcrpmdir', '_rpmdir'):
- cmd.extend(['--define', "%s %s" % (macro,self.workdir)])
- cmd.extend(['-bb', spec])
- logfile = "%s/groups_rpm.log" % self.workdir
- uploadpath = self.getUploadDir()
- status = log_output(cmd[0], cmd, logfile, uploadpath, logerror=True)
- if not _isSuccess(status):
- raise koji.GenericError, "failed to build groups rpm: %s" \
- % _parseStatus(status, ' '.join(cmd))
- #upload file and return path
- fn = 'buildsys-build-1-1.noarch.rpm'
- pkg = "%s/noarch/%s" % (self.workdir, fn)
- session.uploadWrapper(pkg, uploadpath, fn)
- self.logger.debug("Adding %s to repo %s" % (fn, repo_id))
- session.host.repoAddRPM(repo_id, "%s/%s" % (uploadpath, fn))
- return repo_id, event_id
-
-
class CreaterepoTask(BaseTaskHandler):
Methods = ['createrepo']
@@ -2227,17 +2187,20 @@ class CreaterepoTask(BaseTaskHandler):
if rinfo['state'] != koji.REPO_INIT:
raise koji.GenericError, "Repo %(id)s not in INIT state (got %(state)s)" % rinfo
pathinfo = koji.PathInfo(options.topdir)
- repodir = pathinfo.repo(repo_id, rinfo['tag_name'])
- repodir = "%s/%s" % (repodir, arch)
+ toprepodir = pathinfo.repo(repo_id, rinfo['tag_name'])
+ repodir = "%s/%s" % (toprepodir, arch)
+ groupdata = os.path.join(toprepodir, 'groups', 'comps.xml')
if not os.path.isdir(repodir):
raise koji.GenericError, "Repo directory missing: %s" % repodir
#set up our output dir
outdir = "%s/repo" % self.workdir
datadir = "%s/repodata" % outdir
koji.ensuredir(outdir)
- cmd = ['/usr/bin/createrepo', '-vp', '--outputdir', outdir]
- if os.path.exists("%s/comps.xml" % repodir):
- cmd.extend(['-g', 'comps.xml'])
+ pkglist = os.path.join(repodir, 'pkglist')
+ pkgdir = os.path.join(pathinfo.topdir, 'packages/')
+ cmd = ['/usr/bin/createrepo', '-vd', '--outputdir', outdir, '-i', pkglist, '-u', options.pkgurl]
+ if os.path.isfile(groupdata):
+ cmd.extend(['-g', groupdata])
#attempt to recycle repodata from last repo
if oldrepo:
oldpath = pathinfo.repo(oldrepo['id'], rinfo['tag_name'])
@@ -2251,7 +2214,7 @@ class CreaterepoTask(BaseTaskHandler):
# note: we can't easily use a cachedir because we do not have write
# permission. The good news is that with --update we won't need to
# be scanning many rpms.
- cmd.append(repodir)
+ cmd.append(pkgdir)
logfile = "%s/createrepo.log" % self.workdir
uploadpath = self.getUploadDir()
@@ -2263,7 +2226,7 @@ class CreaterepoTask(BaseTaskHandler):
files = []
for f in os.listdir(datadir):
- if f.endswith('.xml') or f.endswith('.xml.gz'):
+ if f.endswith('.xml') or f.endswith('.xml.gz') or f.endswith('.sqlite.bz2'):
files.append(f)
session.uploadWrapper("%s/%s" % (datadir, f), uploadpath, f)
@@ -2556,6 +2519,7 @@ def get_options():
parser.add_option("--mockdir", help="Specify mockdir")
parser.add_option("--mockuser", help="User to run mock as")
parser.add_option("-s", "--server", help="url of XMLRPC server")
+ parser.add_option("--pkgurl", help="url of packages directory")
(options, args) = parser.parse_args()
if args:
@@ -2589,6 +2553,7 @@ def get_options():
'server': None,
'user': None,
'password': None,
+ 'pkgurl': None,
'cert': '/etc/kojid/client.crt',
'ca': '/etc/kojid/clientca.crt',
'serverca': '/etc/kojid/serverca.crt'}
@@ -2614,6 +2579,9 @@ def get_options():
if not options.server:
parser.error("--server argument required")
+ if not options.pkgurl:
+ parser.error("--pkgurl argument required")
+
def quit(msg=None, code=1):
if msg:
logging.getLogger("koji.build").error(msg)
diff --git a/builder/kojid.conf b/builder/kojid.conf
index c6d5ee4..b0b2711 100644
--- a/builder/kojid.conf
+++ b/builder/kojid.conf
@@ -32,6 +32,9 @@
; The URL for the xmlrpc server
server=http://hub.example.com/kojihub
+; The URL for the packages tree
+pkgurl=http://hub.example.com/packages
+
; The mail host to use for sending email notifications
smtphost=example.com
diff --git a/hub/kojihub.py b/hub/kojihub.py
index 8e604c8..8489672 100644
--- a/hub/kojihub.py
+++ b/hub/kojihub.py
@@ -1724,11 +1724,6 @@ def repo_init(tag, with_src=False, with_debuginfo=False):
fo = file("%s/comps.xml" % groupsdir,'w')
fo.write(comps)
fo.close()
- spec = koji.make_groups_spec(groups, name='buildsys-build', buildgroup='build')
- fn = "%s/groups.spec" % groupsdir
- fo = file(fn, 'w')
- fo.write(spec)
- fo.close()
# commit the transaction now so we don't hold locks in the database while we're creating
# links on the filesystem (which can take a long time)
@@ -1739,27 +1734,22 @@ def repo_init(tag, with_src=False, with_debuginfo=False):
if arch in ['src','noarch']:
continue
# src and noarch special-cased -- see below
- rpmdir = "%s/%s/RPMS" % (repodir,arch)
- koji.ensuredir(rpmdir)
- logger.info("Linking %d packages for %s" % (len(packages[arch]),arch))
+ archdir = os.path.join(repodir, arch)
+ koji.ensuredir(archdir)
+ pkglist = file(os.path.join(repodir, arch, 'pkglist'), 'w')
+ logger.info("Creating package list for %s" % arch)
for rpminfo in packages[arch]:
- filename = os.path.basename(rpminfo['path'])
- os.link(rpminfo['path'], "%s/%s" %(rpmdir,filename))
+ pkglist.write(rpminfo['path'].split(os.path.join(koji.pathinfo.topdir, 'packages/'))[1] + '\n')
#noarch packages
for rpminfo in packages.get('noarch',[]):
- filename = os.path.basename(rpminfo['path'])
- os.link(rpminfo['path'], "%s/%s" %(rpmdir,filename))
+ pkglist.write(rpminfo['path'].split(os.path.join(koji.pathinfo.topdir, 'packages/'))[1] + '\n')
# srpms
if with_src:
- srpmdir = "%s/%s/SRPMS" % (repodir,arch)
+ srpmdir = "%s/%s" % (repodir,'src')
koji.ensuredir(srpmdir)
for rpminfo in packages.get('src',[]):
- filename = os.path.basename(rpminfo['path'])
- os.link(rpminfo['path'], "%s/%s" %(srpmdir,filename))
- # comps
- logger.info("Linking comps for %s" % arch)
- os.link("%s/comps.xml" % groupsdir,"%s/%s/comps.xml" % (repodir,arch))
- #groups rpm linked in a later call (hasn't been generated yet)
+ pkglist.write(rpminfo['path'].split(os.path.join(koji.pathinfo.topdir, 'packages/'))[1] + '\n')
+ pkglist.close()
return [repo_id, event_id]
def repo_set_state(repo_id, state, check=True):
signature.asc
Description: PGP signature
-- Fedora-buildsys-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/fedora-buildsys-list
