more renaming

This commit is contained in:
Mike McLean 2017-03-24 21:33:55 -04:00
parent c86b5c3ac0
commit 8346a60976
7 changed files with 23 additions and 22 deletions

View file

@ -5038,8 +5038,9 @@ class createDistRepoTask(CreaterepoTask):
# should be a list of repo ids to delta against
for repo_id in opts['delta']:
oldrepo = self.session.repoInfo(repo_id, strict=True)
if not oldrepo['signed']:
raise koji.GenericError("Base repo for deltas must be signed")
if not oldrepo['dist']:
raise koji.GenericError("Base repo for deltas must also "
"be a dist repo")
# regular repos don't actually have rpms, just pkglist
path = koji.pathinfo.distrepo(repo_id, oldrepo['tag_name'])
if not os.path.exists(path):

View file

@ -7091,7 +7091,7 @@ def handle_regen_repo(options, session, args):
return watch_tasks(session, [task_id], quiet=options.quiet)
def handle_dist_repo(options, session, args):
"""create a yum repo of GPG signed RPMs"""
"""Create a yum repo with distribution options"""
usage = _("usage: %prog dist-repo [options] tag keyID [keyID...]")
usage += _("\n(Specify the --help option for a list of other options)")
parser = OptionParser(usage=usage)
@ -7126,7 +7126,7 @@ def handle_dist_repo(options, session, args):
if task_opts.allow_unsigned and task_opts.skip_unsigned:
parser.error(_('allow_unsigned and skip_unsigned are mutually exclusive'))
activate_session(session)
stuffdir = _unique_path('cli-signed')
stuffdir = _unique_path('cli-dist-repo')
if task_opts.comps:
if not os.path.exists(task_opts.comps):
parser.error(_('could not find %s') % task_opts.comps)
@ -7142,11 +7142,11 @@ def handle_dist_repo(options, session, args):
rinfo = session.repoInfo(int(repo), strict=True)
else:
# get dist repo for tag
rinfo = session.getRepo(repo, signed=True)
rinfo = session.getRepo(repo, dist=True)
if not rinfo:
# maybe there is an expired one
rinfo = session.getRepo(repo,
state=koji.REPO_STATES['EXPIRED'], signed=True)
state=koji.REPO_STATES['EXPIRED'], dist=True)
if not rinfo:
parser.errpr(_("Can't find repo for tag: %s") % repo)
old_repos.append(rinfo['id'])

View file

@ -3,5 +3,5 @@
INSERT INTO permissions (name) VALUES ('image');
ALTER TABLE repo ADD COLUMN signed BOOLEAN DEFAULT 'false';
ALTER TABLE repo ADD COLUMN dist BOOLEAN DEFAULT 'false';

View file

@ -411,7 +411,7 @@ CREATE TABLE repo (
create_event INTEGER NOT NULL REFERENCES events(id) DEFAULT get_event(),
tag_id INTEGER NOT NULL REFERENCES tag(id),
state INTEGER,
signed BOOLEAN DEFAULT 'false'
dist BOOLEAN DEFAULT 'false'
) WITHOUT OIDS;
-- external yum repos

View file

@ -2452,13 +2452,13 @@ def dist_repo_init(tag, keys, task_opts):
# note: we need to match args from the other preRepoInit callback
koji.plugin.run_callbacks('preRepoInit', tag=tinfo, with_src=False,
with_debuginfo=False, event=event, repo_id=None,
signed=True, keys=keys, arches=arches, task_opts=task_opts)
dist=True, keys=keys, arches=arches, task_opts=task_opts)
if not event:
event = get_event()
repo_id = nextval('repo_id_seq')
insert = InsertProcessor('repo')
insert.set(id=repo_id, create_event=event, tag_id=tag_id,
state=state, signed=True)
state=state, dist=True)
insert.execute()
repodir = koji.pathinfo.distrepo(repo_id, tinfo['name'])
for arch in arches:
@ -10109,20 +10109,20 @@ class RootExports(object):
taginfo['extra'][key] = ancestor['extra'][key]
return taginfo
def getRepo(self, tag, state=None, event=None, signed=False):
def getRepo(self, tag, state=None, event=None, dist=False):
if isinstance(tag, (int, long)):
id = tag
else:
id = get_tag_id(tag, strict=True)
fields = ['repo.id', 'repo.state', 'repo.create_event', 'events.time', 'EXTRACT(EPOCH FROM events.time)', 'repo.signed']
aliases = ['id', 'state', 'create_event', 'creation_time', 'create_ts', 'signed']
fields = ['repo.id', 'repo.state', 'repo.create_event', 'events.time', 'EXTRACT(EPOCH FROM events.time)', 'repo.dist']
aliases = ['id', 'state', 'create_event', 'creation_time', 'create_ts', 'dist']
joins = ['events ON repo.create_event = events.id']
clauses = ['repo.tag_id = %(id)i']
if signed:
clauses.append('repo.signed is true')
if dist:
clauses.append('repo.dist is true')
else:
clauses.append('repo.signed is false')
clauses.append('repo.dist is false')
if event:
# the repo table doesn't have all the fields of a _config table, just create_event
clauses.append('create_event <= %(event)i')
@ -12277,7 +12277,7 @@ class HostExports(object):
data: a dictionary of the form { arch: (uploadpath, files), ...}
expire(optional): if set to true, mark the repo expired immediately*
If this is a dist repo, also hardlink signed rpms in the final
If this is a dist repo, also hardlink the rpms in the final
directory.
* This is used when a repo from an older event is generated
@ -12290,7 +12290,7 @@ class HostExports(object):
raise koji.GenericError("Repo %(id)s not in INIT state (got %(state)s)" % rinfo)
repodir = koji.pathinfo.repo(repo_id, rinfo['tag_name'])
workdir = koji.pathinfo.work()
if not rinfo['signed']:
if not rinfo['dist']:
for arch, (uploadpath, files) in data.iteritems():
archdir = "%s/%s" % (repodir, koji.canonArch(arch))
if not os.path.isdir(archdir):
@ -12331,7 +12331,7 @@ class HostExports(object):
Move a dist repo into its final location
Unlike normal repos (which are moved into place by repoDone), signed
Unlike normal repos (which are moved into place by repoDone), dist
repos have all their content linked (or copied) into place.
repo_id - the repo to move

View file

@ -1817,7 +1817,7 @@ class PathInfo(object):
def distrepo(self, repo_id, tag):
"""Return the directory with a dist repo lives"""
return os.path.join(self.topdir, 'repos-signed', tag, str(repo_id))
return os.path.join(self.topdir, 'repos-dist', tag, str(repo_id))
def repocache(self, tag_str):
"""Return the directory where a repo belongs"""

View file

@ -135,7 +135,7 @@ class ManagedRepo(object):
return False
tag_name = tag_info['name']
rinfo = self.session.repoInfo(self.repo_id, strict=True)
if rinfo['signed']:
if rinfo['dist']:
path = pathinfo.distrepo(self.repo_id, tag_name)
lifetime = self.options.dist_repo_lifetime
else:
@ -642,7 +642,7 @@ def main(options, session):
# TODO also move rmtree jobs to threads
logger.info("Entering main loop")
repodir = "%s/repos" % pathinfo.topdir
distrepodir = "%s/repos-signed" % pathinfo.topdir
distrepodir = "%s/repos-dist" % pathinfo.topdir
while True:
try:
repomgr.updateRepos()