allow debuginfo for sidetag repos

Fixes: https://pagure.io/koji/issue/540
This commit is contained in:
Tomas Kopecek 2020-02-05 14:56:11 +01:00
parent b972b572a0
commit 2a621b337c
3 changed files with 19 additions and 8 deletions

View file

@ -5341,7 +5341,8 @@ class NewRepoTask(BaseTaskHandler):
kwargs['with_src'] = True kwargs['with_src'] = True
if separate_src: if separate_src:
kwargs['with_separate_src'] = True 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 kwargs['with_debuginfo'] = True
repo_id, event_id = self.session.host.repoInit(tinfo['id'], **kwargs) repo_id, event_id = self.session.host.repoInit(tinfo['id'], **kwargs)
path = koji.pathinfo.repo(repo_id, tinfo['name']) path = koji.pathinfo.repo(repo_id, tinfo['name'])

View file

@ -30,12 +30,16 @@ def handle_add_sidetag(options, session, args):
parser.add_argument( parser.add_argument(
"-w", "--wait", action="store_true", help=_("Wait until repo is ready.") "-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) opts = parser.parse_args(args)
activate_session(session, options) activate_session(session, options)
try: try:
tag = session.createSideTag(opts.basetag) tag = session.createSideTag(opts.basetag, debuginfo=opts.debuginfo)
except koji.ActionNotAllowed: except koji.ActionNotAllowed:
parser.error(_("Policy violation")) parser.error(_("Policy violation"))

View file

@ -25,11 +25,14 @@ CONFIG = None
@export @export
def createSideTag(basetag): def createSideTag(basetag, debuginfo=False):
"""Create a side tag. """Create a side tag.
:param basetag: name or ID of base tag :param basetag: name or ID of base tag
:type basetag: str or int :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, # Any logged-in user is able to request creation of side tags,
@ -61,15 +64,18 @@ def createSideTag(basetag):
# id assigned by _create_tag # id assigned by _create_tag
tag_id = nextval("tag_id_seq") + 1 tag_id = nextval("tag_id_seq") + 1
sidetag_name = "%s-side-%s" % (basetag["name"], tag_id) 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_id = _create_tag(
sidetag_name, sidetag_name,
parent=basetag["id"], parent=basetag["id"],
arches=basetag["arches"], arches=basetag["arches"],
extra={ extra=extra,
"sidetag": True,
"sidetag_user": user["name"],
"sidetag_user_id": user["id"],
},
) )
_create_build_target(sidetag_name, sidetag_id, sidetag_id) _create_build_target(sidetag_name, sidetag_id, sidetag_id)