From c35069fae2ff3f517968cd2657d3e894b12b7c56 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Mar 05 2020 15:30:16 +0000 Subject: [PATCH 1/2] allow debuginfo for sidetag repos Fixes: https://pagure.io/koji/issue/540 --- diff --git a/builder/kojid b/builder/kojid index a9c8cf1..b199c4b 100755 --- a/builder/kojid +++ b/builder/kojid @@ -5323,7 +5323,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) From bca564248105a001ea308783fe46205fa3a20efe Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Mar 11 2020 12:37:19 +0000 Subject: [PATCH 2/2] fix typo --- diff --git a/plugins/hub/sidetag_hub.py b/plugins/hub/sidetag_hub.py index ef95da2..6b29e1b 100644 --- a/plugins/hub/sidetag_hub.py +++ b/plugins/hub/sidetag_hub.py @@ -32,7 +32,7 @@ def createSideTag(basetag, debuginfo=False): :type basetag: str or int :param debuginfo: should buildroot repos contain debuginfo? - :tybe debuginfo: bool + :type debuginfo: bool """ # Any logged-in user is able to request creation of side tags,