From 2a621b337cc6d363c737a556b1ae19a8f4adb48e Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Mar 31 2020 11:49:35 +0000 Subject: allow debuginfo for sidetag repos Fixes: https://pagure.io/koji/issue/540 --- diff --git a/builder/kojid b/builder/kojid index 82114a2..847d93b 100755 --- a/builder/kojid +++ b/builder/kojid @@ -5341,7 +5341,8 @@ class NewRepoTask(BaseTaskHandler): kwargs['with_src'] = True if separate_src: kwargs['with_separate_src'] = True - if debuginfo: + # generate debuginfo repo if requested or if specified in sidetag's extra + if debuginfo or tinfo['extra'].get('with_debuginfo'): kwargs['with_debuginfo'] = True repo_id, event_id = self.session.host.repoInit(tinfo['id'], **kwargs) path = koji.pathinfo.repo(repo_id, tinfo['name']) diff --git a/plugins/cli/sidetag_cli.py b/plugins/cli/sidetag_cli.py index 1e18e59..cc55157 100644 --- a/plugins/cli/sidetag_cli.py +++ b/plugins/cli/sidetag_cli.py @@ -30,12 +30,16 @@ def handle_add_sidetag(options, session, args): parser.add_argument( "-w", "--wait", action="store_true", help=_("Wait until repo is ready.") ) + parser.add_argument( + "--debuginfo", action="store_true", help=_("Buildroot repo will contain debuginfos") + ) + opts = parser.parse_args(args) activate_session(session, options) try: - tag = session.createSideTag(opts.basetag) + tag = session.createSideTag(opts.basetag, debuginfo=opts.debuginfo) except koji.ActionNotAllowed: parser.error(_("Policy violation")) diff --git a/plugins/hub/sidetag_hub.py b/plugins/hub/sidetag_hub.py index dd5f53c..ef95da2 100644 --- a/plugins/hub/sidetag_hub.py +++ b/plugins/hub/sidetag_hub.py @@ -25,11 +25,14 @@ CONFIG = None @export -def createSideTag(basetag): +def createSideTag(basetag, debuginfo=False): """Create a side tag. :param basetag: name or ID of base tag :type basetag: str or int + + :param debuginfo: should buildroot repos contain debuginfo? + :tybe debuginfo: bool """ # Any logged-in user is able to request creation of side tags, @@ -61,15 +64,18 @@ def createSideTag(basetag): # id assigned by _create_tag tag_id = nextval("tag_id_seq") + 1 sidetag_name = "%s-side-%s" % (basetag["name"], tag_id) + extra = { + "sidetag": True, + "sidetag_user": user["name"], + "sidetag_user_id": user["id"], + } + if debuginfo: + extra['with_debuginfo'] = True sidetag_id = _create_tag( sidetag_name, parent=basetag["id"], arches=basetag["arches"], - extra={ - "sidetag": True, - "sidetag_user": user["name"], - "sidetag_user_id": user["id"], - }, + extra=extra, ) _create_build_target(sidetag_name, sidetag_id, sidetag_id)