From c86b5c3ac0d1e6499f846ba5febe09c7fa834b3e Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Mar 30 2017 13:47:20 +0000 Subject: first stab at renaming signed repos to dist repos sed -i -e 's/signed\(.\?[Rr]epo\)/dist\1/g' sed -i -e 's/Signed\(.\?[Rr]epo\)/Dist\1/g' --- diff --git a/builder/kojid b/builder/kojid index 5e3dea9..74a0d55 100755 --- a/builder/kojid +++ b/builder/kojid @@ -4933,13 +4933,13 @@ class CreaterepoTask(BaseTaskHandler): % parseStatus(status, ' '.join(cmd))) -class NewSignedRepoTask(BaseTaskHandler): - Methods = ['signedRepo'] +class NewDistRepoTask(BaseTaskHandler): + Methods = ['distRepo'] _taskWeight = 0.1 def handler(self, tag, repo_id, keys, task_opts): tinfo = self.session.getTag(tag, strict=True, event=task_opts['event']) - path = koji.pathinfo.signedrepo(repo_id, tinfo['name']) + path = koji.pathinfo.distrepo(repo_id, tinfo['name']) if len(task_opts['arch']) == 0: task_opts['arch'] = tinfo['arches'].split() if len(task_opts['arch']) == 0: @@ -4958,7 +4958,7 @@ class NewSignedRepoTask(BaseTaskHandler): # get a task ID and wait for them to complete arglist = [tag, repo_id, arch, keys, task_opts] subtasks[arch] = self.session.host.subtask( - method='createsignedrepo', arglist=arglist, label=arch, + method='createdistrepo', arglist=arglist, label=arch, parent=self.id, arch='noarch') if len(subtasks) > 0 and task_opts['multilib']: results = self.wait(subtasks.values(), all=True, failany=True) @@ -4966,14 +4966,14 @@ class NewSignedRepoTask(BaseTaskHandler): # move the 32-bit task output to the final resting place # so the 64-bit arches can use it for multilib upload, files, sigmap = results[subtasks[arch]] - self.session.host.signedRepoMove( + self.session.host.distRepoMove( repo_id, upload, files, arch, sigmap) for arch in canonArches: # do the other arches if arch not in arch32s: arglist = [tag, repo_id, arch, keys, task_opts] subtasks[arch] = self.session.host.subtask( - method='createsignedrepo', arglist=arglist, label=arch, + method='createdistrepo', arglist=arglist, label=arch, parent=self.id, arch='noarch') # wait for 64-bit subtasks to finish data = {} @@ -4986,14 +4986,14 @@ class NewSignedRepoTask(BaseTaskHandler): continue #else upload, files, sigmap = results[subtasks[arch]] - self.session.host.signedRepoMove( + self.session.host.distRepoMove( repo_id, upload, files, arch, sigmap) self.session.host.repoDone(repo_id, data, expire=False) - return 'Signed repository #%s successfully generated' % repo_id + return 'Dist repository #%s successfully generated' % repo_id -class createSignedRepoTask(CreaterepoTask): - Methods = ['createsignedrepo'] +class createDistRepoTask(CreaterepoTask): + Methods = ['createdistrepo'] _taskWeight = 1.5 archmap = {'s390x': 's390', 'ppc64': 'ppc', 'x86_64': 'i686'} @@ -5025,7 +5025,7 @@ class createSignedRepoTask(CreaterepoTask): self.repo_id = self.rinfo['id'] self.pathinfo = koji.PathInfo(self.options.topdir) groupdata = os.path.join( - self.pathinfo.signedrepo(repo_id, self.rinfo['tag_name']), + self.pathinfo.distrepo(repo_id, self.rinfo['tag_name']), 'groups', 'comps.xml') #set up our output dir self.repodir = '%s/repo' % self.workdir @@ -5041,7 +5041,7 @@ class createSignedRepoTask(CreaterepoTask): if not oldrepo['signed']: raise koji.GenericError("Base repo for deltas must be signed") # regular repos don't actually have rpms, just pkglist - path = koji.pathinfo.signedrepo(repo_id, oldrepo['tag_name']) + path = koji.pathinfo.distrepo(repo_id, oldrepo['tag_name']) if not os.path.exists(path): raise koji.GenericError('Base drpm repo missing: %s' % path) oldpkgs.append(path) @@ -5076,7 +5076,7 @@ class createSignedRepoTask(CreaterepoTask): def do_multilib(self, arch, ml_arch, conf): self.repo_id = self.rinfo['id'] pathinfo = koji.PathInfo(self.options.topdir) - repodir = pathinfo.signedrepo(self.rinfo['id'], self.rinfo['tag_name']) + repodir = pathinfo.distrepo(self.rinfo['id'], self.rinfo['tag_name']) mldir = os.path.join(repodir, koji.canonArch(ml_arch)) ml_true = set() # multilib packages we need to include before depsolve ml_conf = os.path.join(self.pathinfo.work(), conf) diff --git a/cli/koji b/cli/koji index f50a0a1..3506884 100755 --- a/cli/koji +++ b/cli/koji @@ -7090,9 +7090,9 @@ def handle_regen_repo(options, session, args): session.logout() return watch_tasks(session, [task_id], quiet=options.quiet) -def handle_signed_repo(options, session, args): +def handle_dist_repo(options, session, args): """create a yum repo of GPG signed RPMs""" - usage = _("usage: %prog signed-repo [options] tag keyID [keyID...]") + 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) parser.add_option('--allow-unsigned', action='store_true', default=False, @@ -7104,11 +7104,11 @@ def handle_signed_repo(options, session, args): parser.add_option('--comps', help='Include a comps file in the repodata') parser.add_option('--delta-rpms', metavar='REPO',default=[], action='append', - help=_('Create delta rpms. REPO can be the id of another signed repo ' - 'or the name of a tag that has a signed repo. May be specified ' + help=_('Create delta rpms. REPO can be the id of another dist repo ' + 'or the name of a tag that has a dist repo. May be specified ' 'multiple times.')) parser.add_option('--event', type='int', - help=_('create a signed repository based on a Brew event')) + help=_('create a dist repository based on a Brew event')) parser.add_option('--non-latest', dest='latest', default=True, action='store_false', help='Include older builds, not just the latest') parser.add_option('--multilib', default=None, metavar="CONFIG", @@ -7141,7 +7141,7 @@ def handle_signed_repo(options, session, args): if repo.isdigit(): rinfo = session.repoInfo(int(repo), strict=True) else: - # get signed repo for tag + # get dist repo for tag rinfo = session.getRepo(repo, signed=True) if not rinfo: # maybe there is an expired one @@ -7193,8 +7193,8 @@ def handle_signed_repo(options, session, args): 'skip': task_opts.skip_unsigned, 'unsigned': task_opts.allow_unsigned } - task_id = session.signedRepo(tag, keys, **opts) - print("Creating signed repo for tag " + tag) + task_id = session.distRepo(tag, keys, **opts) + print("Creating dist repo for tag " + tag) if _running_in_bg() or task_opts.nowait: return else: diff --git a/docs/schema-update-signed-repos.sql b/docs/schema-update-signed-repos.sql index e67abb4..fa38ef1 100644 --- a/docs/schema-update-signed-repos.sql +++ b/docs/schema-update-signed-repos.sql @@ -1,4 +1,4 @@ -# schema updates for signed repo feature +# schema updates for dist repo feature # to be merged into schema upgrade script for next release INSERT INTO permissions (name) VALUES ('image'); diff --git a/hub/kojihub.py b/hub/kojihub.py index b35ec33..d35ce54 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -2442,7 +2442,7 @@ def _write_maven_repo_metadata(destdir, artifacts): mdfile.close() _generate_maven_metadata(destdir) -def signed_repo_init(tag, keys, task_opts): +def dist_repo_init(tag, keys, task_opts): """Create a new repo entry in the INIT state, return full repo data""" state = koji.REPO_INIT tinfo = get_tag(tag, strict=True) @@ -2460,7 +2460,7 @@ def signed_repo_init(tag, keys, task_opts): insert.set(id=repo_id, create_event=event, tag_id=tag_id, state=state, signed=True) insert.execute() - repodir = koji.pathinfo.signedrepo(repo_id, tinfo['name']) + repodir = koji.pathinfo.distrepo(repo_id, tinfo['name']) for arch in arches: koji.ensuredir(os.path.join(repodir, arch)) # handle comps @@ -10140,12 +10140,12 @@ class RootExports(object): repoInfo = staticmethod(repo_info) getActiveRepos = staticmethod(get_active_repos) - def signedRepo(self, tag, keys, **task_opts): - """Create a signed-repo task. returns task id""" - context.session.assertPerm('signed-repo') - repo_id, event_id = signed_repo_init(tag, keys, task_opts) + def distRepo(self, tag, keys, **task_opts): + """Create a dist-repo task. returns task id""" + context.session.assertPerm('dist-repo') + repo_id, event_id = dist_repo_init(tag, keys, task_opts) task_opts['event'] = event_id - return make_task('signedRepo', [tag, repo_id, keys, task_opts], priority=15, channel='createrepo') + return make_task('distRepo', [tag, repo_id, keys, task_opts], priority=15, channel='createrepo') def newRepo(self, tag, event=None, src=False, debuginfo=False): """Create a newRepo task. returns task id""" @@ -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 signed repo, also hardlink signed rpms in the final + If this is a dist repo, also hardlink signed rpms in the final directory. * This is used when a repo from an older event is generated @@ -12326,9 +12326,9 @@ class HostExports(object): koji.plugin.run_callbacks('postRepoDone', repo=rinfo, data=data, expire=expire) - def signedRepoMove(self, repo_id, uploadpath, files, arch, sigmap): + def distRepoMove(self, repo_id, uploadpath, files, arch, sigmap): """ - Move a signed repo into its final location + Move a dist repo into its final location Unlike normal repos (which are moved into place by repoDone), signed @@ -12348,7 +12348,7 @@ class HostExports(object): """ workdir = koji.pathinfo.work() rinfo = repo_info(repo_id, strict=True) - repodir = koji.pathinfo.signedrepo(repo_id, rinfo['tag_name']) + repodir = koji.pathinfo.distrepo(repo_id, rinfo['tag_name']) archdir = "%s/%s" % (repodir, koji.canonArch(arch)) if not os.path.isdir(archdir): raise koji.GenericError("Repo arch directory missing: %s" % archdir) diff --git a/koji.next.md b/koji.next.md index 5f30e42..255359e 100644 --- a/koji.next.md +++ b/koji.next.md @@ -64,7 +64,7 @@ Warning to the reader: - refactor uploads - more flexible gc - introduce an ORM to do away with raw SQL queries. -- know how to manage signed repositories of RPMs +- know how to manage dist repositories of RPMs - know how to build installation media - more granular access control/groups - things like Read, Execute, Execute scratch, Delete, Tag, so we can delegate diff --git a/koji/__init__.py b/koji/__init__.py index 4ac9a68..2f06b75 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -1815,8 +1815,8 @@ class PathInfo(object): """Return the directory where a repo belongs""" return self.topdir + ("/repos/%(tag_str)s/%(repo_id)s" % locals()) - def signedrepo(self, repo_id, tag): - """Return the directory with a signed repo lives""" + 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)) def repocache(self, tag_str): @@ -2792,7 +2792,7 @@ def _taskLabel(taskInfo): if 'request' in taskInfo: build = taskInfo['request'][1] extra = buildLabel(build) - elif method in ('newRepo', 'signedRepo'): + elif method in ('newRepo', 'distRepo'): if 'request' in taskInfo: extra = str(taskInfo['request'][0]) elif method in ('tagBuild', 'tagNotification'): @@ -2807,7 +2807,7 @@ def _taskLabel(taskInfo): if 'request' in taskInfo: arch = taskInfo['request'][1] extra = arch - elif method == 'createsignedrepo': + elif method == 'createdistrepo': if 'request' in taskInfo: repo_id = taskInfo['request'][1] arch = taskInfo['request'][2] diff --git a/tests/test_cli/data/list-commands.txt b/tests/test_cli/data/list-commands.txt index 8c5a54f..5a21320 100644 --- a/tests/test_cli/data/list-commands.txt +++ b/tests/test_cli/data/list-commands.txt @@ -119,7 +119,7 @@ miscellaneous commands: import-comps Import group/package information from a comps file moshimoshi Introduce yourself save-failed-tree Create tarball with whole buildtree - signed-repo create a yum repo of GPG signed RPMs + dist-repo create a yum repo of GPG signed RPMs monitor commands: wait-repo Wait for a repo to be regenerated diff --git a/tests/test_hub/test_signed_repo.py b/tests/test_hub/test_signed_repo.py index cea8a4a..e62306f 100644 --- a/tests/test_hub/test_signed_repo.py +++ b/tests/test_hub/test_signed_repo.py @@ -12,7 +12,7 @@ from koji.util import dslice_ex IP = kojihub.InsertProcessor -class TestSignedRepoInit(unittest.TestCase): +class TestDistRepoInit(unittest.TestCase): def getInsert(self, *args, **kwargs): @@ -42,10 +42,10 @@ class TestSignedRepoInit(unittest.TestCase): mock.patch.stopall() - def test_simple_signed_repo_init(self): + def test_simple_dist_repo_init(self): # simple case - kojihub.signed_repo_init('tag', ['key'], {'arch': ['x86_64']}) + kojihub.dist_repo_init('tag', ['key'], {'arch': ['x86_64']}) self.InsertProcessor.assert_called_once() ip = self.inserts[0] @@ -59,10 +59,10 @@ class TestSignedRepoInit(unittest.TestCase): self.copyfile.assert_not_called() - def test_signed_repo_init_with_comps(self): + def test_dist_repo_init_with_comps(self): # simple case - kojihub.signed_repo_init('tag', ['key'], {'arch': ['x86_64'], + kojihub.dist_repo_init('tag', ['key'], {'arch': ['x86_64'], 'comps': 'COMPSFILE'}) self.InsertProcessor.assert_called_once() @@ -77,27 +77,27 @@ class TestSignedRepoInit(unittest.TestCase): self.copyfile.assert_called_once() -class TestSignedRepo(unittest.TestCase): +class TestDistRepo(unittest.TestCase): - @mock.patch('kojihub.signed_repo_init') + @mock.patch('kojihub.dist_repo_init') @mock.patch('kojihub.make_task') - def test_SignedRepo(self, make_task, signed_repo_init): + def test_DistRepo(self, make_task, dist_repo_init): session = kojihub.context.session = mock.MagicMock() # It seems MagicMock will not automatically handle attributes that # start with "assert" session.assertPerm = mock.MagicMock() - signed_repo_init.return_value = ('repo_id', 'event_id') + dist_repo_init.return_value = ('repo_id', 'event_id') make_task.return_value = 'task_id' exports = kojihub.RootExports() - ret = exports.signedRepo('tag', 'keys') - session.assertPerm.assert_called_once_with('signed-repo') - signed_repo_init.assert_called_once() + ret = exports.distRepo('tag', 'keys') + session.assertPerm.assert_called_once_with('dist-repo') + dist_repo_init.assert_called_once() make_task.assert_called_once() self.assertEquals(ret, make_task.return_value) -class TestSignedRepoMove(unittest.TestCase): +class TestDistRepoMove(unittest.TestCase): def setUp(self): self.topdir = tempfile.mkdtemp() @@ -114,7 +114,7 @@ class TestSignedRepoMove(unittest.TestCase): # set up a fake koji topdir # koji.pathinfo._topdir = self.topdir mock.patch('koji.pathinfo._topdir', new=self.topdir).start() - repodir = koji.pathinfo.signedrepo(self.rinfo['id'], self.rinfo['tag_name']) + repodir = koji.pathinfo.distrepo(self.rinfo['id'], self.rinfo['tag_name']) archdir = "%s/%s" % (repodir, koji.canonArch(self.arch)) os.makedirs(archdir) self.uploadpath = 'UNITTEST' @@ -185,9 +185,9 @@ class TestSignedRepoMove(unittest.TestCase): return self.builds[buildInfo] - def test_signedRepoMove(self): + def test_distRepoMove(self): exports = kojihub.HostExports() - exports.signedRepoMove(self.rinfo['id'], self.uploadpath, + exports.distRepoMove(self.rinfo['id'], self.uploadpath, list(self.files), self.arch, self.sigmap) # check result repodir = self.topdir + '/repos-signed/%(tag_name)s/%(id)s' % self.rinfo diff --git a/util/kojira b/util/kojira index 38e02b3..45ff365 100755 --- a/util/kojira +++ b/util/kojira @@ -136,8 +136,8 @@ class ManagedRepo(object): tag_name = tag_info['name'] rinfo = self.session.repoInfo(self.repo_id, strict=True) if rinfo['signed']: - path = pathinfo.signedrepo(self.repo_id, tag_name) - lifetime = self.options.signed_repo_lifetime + path = pathinfo.distrepo(self.repo_id, tag_name) + lifetime = self.options.dist_repo_lifetime else: path = pathinfo.repo(self.repo_id, tag_name) lifetime = self.options.deleted_repo_lifetime @@ -642,14 +642,14 @@ def main(options, session): # TODO also move rmtree jobs to threads logger.info("Entering main loop") repodir = "%s/repos" % pathinfo.topdir - signedrepodir = "%s/repos-signed" % pathinfo.topdir + distrepodir = "%s/repos-signed" % pathinfo.topdir while True: try: repomgr.updateRepos() repomgr.checkQueue() repomgr.printState() repomgr.pruneLocalRepos(repodir, 'deleted_repo_lifetime') - repomgr.pruneLocalRepos(signedrepodir, 'signed_repo_lifetime') + repomgr.pruneLocalRepos(distrepodir, 'dist_repo_lifetime') if not curr_chk_thread.isAlive(): logger.error("Currency checker thread died. Restarting it.") curr_chk_thread = start_currency_checker(session, repomgr) @@ -745,7 +745,7 @@ def get_options(): 'delete_batch_size' : 3, 'deleted_repo_lifetime': 7*24*3600, #XXX should really be called expired_repo_lifetime - 'signed_repo_lifetime': 7*24*3600, + 'dist_repo_lifetime': 7*24*3600, 'sleeptime' : 15, 'cert': None, 'ca': '', # FIXME: unused, remove in next major release @@ -755,7 +755,7 @@ def get_options(): int_opts = ('deleted_repo_lifetime', 'max_repo_tasks', 'repo_tasks_limit', 'retry_interval', 'max_retries', 'offline_retry_interval', 'max_delete_processes', 'max_repo_tasks_maven', - 'delete_batch_size', 'signed_repo_lifetime') + 'delete_batch_size', 'dist_repo_lifetime') str_opts = ('topdir', 'server', 'user', 'password', 'logfile', 'principal', 'keytab', 'krbservice', 'cert', 'ca', 'serverca', 'debuginfo_tags', 'source_tags') # FIXME: remove ca here bool_opts = ('with_src','verbose','debug','ignore_stray_repos', 'offline_retry', diff --git a/util/kojira.conf b/util/kojira.conf index 1d361b3..fc8f4c0 100644 --- a/util/kojira.conf +++ b/util/kojira.conf @@ -43,8 +43,8 @@ with_src=no ;how soon (in seconds) to clean up expired repositories. 1 week default ;deleted_repo_lifetime = 604800 -;how soon (in seconds) to clean up signed repositories. 1 week default here too -;signed_repo_lifetime = 604800 +;how soon (in seconds) to clean up dist repositories. 1 week default here too +;dist_repo_lifetime = 604800 ;turn on debugging statements in the log ;debug = false diff --git a/www/kojiweb/index.py b/www/kojiweb/index.py index 8fc8248..49ea24b 100644 --- a/www/kojiweb/index.py +++ b/www/kojiweb/index.py @@ -431,8 +431,8 @@ _TASKS = ['build', 'tagBuild', 'newRepo', 'createrepo', - 'signedRepo', - 'createsignedrepo', + 'distRepo', + 'createdistrepo', 'buildNotification', 'tagNotification', 'dependantTask', @@ -446,9 +446,9 @@ _TASKS = ['build', 'livemedia', 'createLiveMedia'] # Tasks that can exist without a parent -_TOPLEVEL_TASKS = ['build', 'buildNotification', 'chainbuild', 'maven', 'chainmaven', 'wrapperRPM', 'winbuild', 'newRepo', 'signedRepo', 'tagBuild', 'tagNotification', 'waitrepo', 'livecd', 'appliance', 'image', 'livemedia'] +_TOPLEVEL_TASKS = ['build', 'buildNotification', 'chainbuild', 'maven', 'chainmaven', 'wrapperRPM', 'winbuild', 'newRepo', 'distRepo', 'tagBuild', 'tagNotification', 'waitrepo', 'livecd', 'appliance', 'image', 'livemedia'] # Tasks that can have children -_PARENT_TASKS = ['build', 'chainbuild', 'maven', 'chainmaven', 'winbuild', 'newRepo', 'signedRepo', 'wrapperRPM', 'livecd', 'appliance', 'image', 'livemedia'] +_PARENT_TASKS = ['build', 'chainbuild', 'maven', 'chainmaven', 'winbuild', 'newRepo', 'distRepo', 'wrapperRPM', 'livecd', 'appliance', 'image', 'livemedia'] def tasks(environ, owner=None, state='active', view='tree', method='all', hostID=None, channelID=None, start=None, order='-id'): values = _initValues(environ, 'Tasks', 'tasks') @@ -625,7 +625,7 @@ def taskinfo(environ, taskID): build = server.getBuild(params[1]) values['destTag'] = destTag values['build'] = build - elif task['method'] in ('newRepo', 'signedRepo', 'createsignedrepo'): + elif task['method'] in ('newRepo', 'distRepo', 'createdistrepo'): tag = server.getTag(params[0]) values['tag'] = tag elif task['method'] == 'tagNotification': diff --git a/www/kojiweb/taskinfo.chtml b/www/kojiweb/taskinfo.chtml index 613e2f9..a4e050f 100644 --- a/www/kojiweb/taskinfo.chtml +++ b/www/kojiweb/taskinfo.chtml @@ -223,7 +223,7 @@ $value #if $len($params) > 1 $printOpts($params[1]) #end if - #elif $task.method == 'signedRepo' + #elif $task.method == 'distRepo' Tag: $tag.name
Repo ID: $params[1]
Keys: $printValue(0, $params[2])
@@ -241,7 +241,7 @@ $value #if $len($params) > 4 and $params[4] External Repos: $printValue(None, [ext['external_repo_name'] for ext in $params[3]])
#end if - #elif $task.method == 'createsignedrepo' + #elif $task.method == 'createdistrepo' Tag: $tag.name
Repo ID: $params[1]
Arch: $printValue(0, $params[2])