Merge branch 'master' of git+ssh://git.fedoraproject.org/git/hosted/koji

This commit is contained in:
Michael Bonnet 2007-03-16 21:45:14 -04:00
commit 6578e852a8
4 changed files with 26 additions and 28 deletions

View file

@ -2109,7 +2109,7 @@ class NewRepoTask(BaseTaskHandler):
repo_id, event_id = self.wait(preptask)[preptask] repo_id, event_id = self.wait(preptask)[preptask]
path = koji.pathinfo.repo(repo_id, tinfo['name']) path = koji.pathinfo.repo(repo_id, tinfo['name'])
if not os.path.isdir(path): if not os.path.isdir(path):
raise koji.GenericError, "Repo directory missing: %s" % repodir raise koji.GenericError, "Repo directory missing: %s" % path
arches = [] arches = []
for fn in os.listdir(path): for fn in os.listdir(path):
if fn != 'groups' and os.path.isdir("%s/%s/RPMS" % (path, fn)): if fn != 'groups' and os.path.isdir("%s/%s/RPMS" % (path, fn)):
@ -2141,7 +2141,7 @@ class PrepRepoTask(BaseTaskHandler):
repo_id, event_id = session.host.repoInit(tinfo['id']) repo_id, event_id = session.host.repoInit(tinfo['id'])
path = koji.pathinfo.repo(repo_id, tinfo['name']) path = koji.pathinfo.repo(repo_id, tinfo['name'])
if not os.path.isdir(path): if not os.path.isdir(path):
raise koji.GenericError, "Repo directory missing: %s" % repodir raise koji.GenericError, "Repo directory missing: %s" % path
#create and upload meta rpm #create and upload meta rpm
spec = "%s/groups/groups.spec" % path spec = "%s/groups/groups.spec" % path
#the repoInit call should have created groups.spec #the repoInit call should have created groups.spec
@ -2157,7 +2157,7 @@ class PrepRepoTask(BaseTaskHandler):
status = log_output(cmd[0], cmd, logfile, uploadpath, logerror=True) status = log_output(cmd[0], cmd, logfile, uploadpath, logerror=True)
if not _isSuccess(status): if not _isSuccess(status):
raise koji.GenericError, "failed to build groups rpm: %s" \ raise koji.GenericError, "failed to build groups rpm: %s" \
% _parseStatus(status, pkgcmd) % _parseStatus(status, ' '.join(cmd))
#upload file and return path #upload file and return path
fn = 'buildsys-build-1-1.noarch.rpm' fn = 'buildsys-build-1-1.noarch.rpm'
pkg = "%s/noarch/%s" % (self.workdir, fn) pkg = "%s/noarch/%s" % (self.workdir, fn)
@ -2191,15 +2191,17 @@ class CreaterepoTask(BaseTaskHandler):
if os.path.exists("%s/comps.xml" % repodir): if os.path.exists("%s/comps.xml" % repodir):
cmd.extend(['-g', 'comps.xml']) cmd.extend(['-g', 'comps.xml'])
#attempt to recycle repodata from last repo #attempt to recycle repodata from last repo
if oldrepo: # XXX re-enable this if statement when --update support appears in
oldpath = pathinfo.repo(oldrepo['id'], rinfo['tag_name']) # upstream createrepo
olddatadir = "%s/%s/repodata" % (oldpath, arch) # if oldrepo:
if not os.path.isdir(olddatadir): # oldpath = pathinfo.repo(oldrepo['id'], rinfo['tag_name'])
self.logger.warn("old repodata is missing: %s" % olddatadir) # olddatadir = "%s/%s/repodata" % (oldpath, arch)
else: # if not os.path.isdir(olddatadir):
koji.ensuredir(datadir) # self.logger.warn("old repodata is missing: %s" % olddatadir)
os.system('cp -a %s/* %s' % (olddatadir, datadir)) # else:
cmd.append('--update') # koji.ensuredir(datadir)
# os.system('cp -a %s/* %s' % (olddatadir, datadir))
# cmd.append('--update')
# note: we can't easily use a cachedir because we do not have write # 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 # permission. The good news is that with --update we won't need to
# be scanning many rpms. # be scanning many rpms.
@ -2211,7 +2213,7 @@ class CreaterepoTask(BaseTaskHandler):
status = log_output(cmd[0], cmd, logfile, uploadpath, logerror=True) status = log_output(cmd[0], cmd, logfile, uploadpath, logerror=True)
if not _isSuccess(status): if not _isSuccess(status):
raise koji.GenericError, "failed to create repo: %s" \ raise koji.GenericError, "failed to create repo: %s" \
% _parseStatus(status, pkgcmd) % _parseStatus(status, ' '.join(cmd))
files = [] files = []
for f in os.listdir(datadir): for f in os.listdir(datadir):

View file

@ -1029,14 +1029,14 @@ def handle_list_permissions(options, session, args):
if len(args) > 0: if len(args) > 0:
parser.error(_("This command takes no arguments")) parser.error(_("This command takes no arguments"))
assert False assert False
if not options.user:
parser.error(_("A user must be specified"))
assert False
activate_session(session) activate_session(session)
user = session.getUser(options.user) if options.user:
if not user: user = session.getUser(options.user)
raise koji.GenericError("%s can not be found" % options.user) if not user:
perms = session.getUserPerms(user['id']) raise koji.GenericError("%s can not be found" % options.user)
perms = session.getUserPerms(user['id'])
else:
perms = [p['name'] for p in session.getAllPerms()]
print perms print perms
def handle_list_signed(options, session, args): def handle_list_signed(options, session, args):

View file

@ -2911,6 +2911,7 @@ def import_rpm(fn,buildinfo=None,brootid=None):
for (filename,filesize,filemd5,fileflags) in \ for (filename,filesize,filemd5,fileflags) in \
zip(hdr[rpm.RPMTAG_FILENAMES],hdr[rpm.RPMTAG_FILESIZES], zip(hdr[rpm.RPMTAG_FILENAMES],hdr[rpm.RPMTAG_FILESIZES],
hdr[rpm.RPMTAG_FILEMD5S],hdr[rpm.RPMTAG_FILEFLAGS]): hdr[rpm.RPMTAG_FILEMD5S],hdr[rpm.RPMTAG_FILEFLAGS]):
filename = koji.fixEncoding(filename)
q = """INSERT INTO rpmfiles (rpm_id,filename,filesize,filemd5,fileflags) q = """INSERT INTO rpmfiles (rpm_id,filename,filesize,filemd5,fileflags)
VALUES (%(rpminfo_id)d,%(filename)s,%(filesize)d,%(filemd5)s,%(fileflags)d) VALUES (%(rpminfo_id)d,%(filename)s,%(filesize)d,%(filemd5)s,%(fileflags)d)
""" """
@ -2947,13 +2948,8 @@ def import_changelog(buildinfo, rpmfile, replace=False):
for cltime, clauthor, cltext in zip(cltimelist, hdr['CHANGELOGNAME'], for cltime, clauthor, cltext in zip(cltimelist, hdr['CHANGELOGNAME'],
hdr['CHANGELOGTEXT']): hdr['CHANGELOGTEXT']):
cltime = datetime.datetime.fromtimestamp(cltime).isoformat(' ') cltime = datetime.datetime.fromtimestamp(cltime).isoformat(' ')
# XXX FIXME! clauthor = koji.fixEncoding(clauthor)
# Use koji.fixEncoding() instead of koji._forceAscii() cltext = koji.fixEncoding(cltext)
# once the database is in UTF-8
# clauthor = koji.fixEncoding(clauthor)
# cltext = koji.fixEncoding(cltext)
clauthor = koji._forceAscii(clauthor)
cltext = koji._forceAscii(cltext)
q = """INSERT INTO changelogs (build_id, date, author, text) VALUES q = """INSERT INTO changelogs (build_id, date, author, text) VALUES
(%(build_id)d, %(cltime)s, %(clauthor)s, %(cltext)s) (%(build_id)d, %(cltime)s, %(clauthor)s, %(cltext)s)
""" """

View file

@ -92,7 +92,7 @@ def _genHTML(req, fileName):
else: else:
req._values['currentUser'] = None req._values['currentUser'] = None
return str(Cheetah.Template.Template(file=fileName, searchList=[req._values])) return Cheetah.Template.Template(file=fileName, searchList=[req._values], filter='EncodeUnicode').respond()
def _getServer(req): def _getServer(req):
serverURL = req.get_options()['KojiHubURL'] serverURL = req.get_options()['KojiHubURL']