From 19dc20d3a2af77ba8b2de6dce44058f84dbe2d1e Mon Sep 17 00:00:00 2001 From: Owen W. Taylor Date: Jan 11 2019 01:17:20 +0000 Subject: Add support for a 'flatpaks' namespace flatpaks/ will be added as a separate namespace in Fedora distgit - see: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/LOLYI2FHGCVJ7EKC6NB3CZ3ACBRKQFCK/ The handling will be like modules/ - where flatpaks are currently: - No bugzilla bug is required for repository creation - Branch names must be valid module stream names Signed-off-by: Owen W. Taylor --- diff --git a/conf/etc/rpkg/fedpkg-stage.conf b/conf/etc/rpkg/fedpkg-stage.conf index 38b2a59..ebbdf3c 100644 --- a/conf/etc/rpkg/fedpkg-stage.conf +++ b/conf/etc/rpkg/fedpkg-stage.conf @@ -14,7 +14,7 @@ clone_config = bz.default-component %(repo)s sendemail.to %(repo)s-owner@fedoraproject.org distgit_namespaced = True -distgit_namespaces = rpms container modules +distgit_namespaces = rpms container modules flatpaks lookaside_namespaced = True kerberos_realms = STG.FEDORAPROJECT.ORG oidc_id_provider = https://id.stg.fedoraproject.org/openidc/ diff --git a/conf/etc/rpkg/fedpkg.conf b/conf/etc/rpkg/fedpkg.conf index 1333865..0b77a8c 100644 --- a/conf/etc/rpkg/fedpkg.conf +++ b/conf/etc/rpkg/fedpkg.conf @@ -14,7 +14,7 @@ clone_config = bz.default-component %(repo)s sendemail.to %(repo)s-owner@fedoraproject.org distgit_namespaced = True -distgit_namespaces = rpms container modules +distgit_namespaces = rpms container modules flatpaks lookaside_namespaced = True kerberos_realms = FEDORAPROJECT.ORG oidc_id_provider = https://id.fedoraproject.org/openidc/ diff --git a/fedpkg/cli.py b/fedpkg/cli.py index 7465443..c517b5d 100644 --- a/fedpkg/cli.py +++ b/fedpkg/cli.py @@ -803,7 +803,7 @@ targets to build the package for a particular stream. # bug is not a required parameter in the event the packager has an # exception, in which case, they may use the --exception flag # neither in case of modules, which don't require a formal review - if not bug and not exception and ns not in ['tests', 'modules']: + if not bug and not exception and ns not in ['tests', 'modules', 'flatpaks']: raise rpkgError( 'A Bugzilla bug is required on new repository requests') repo_regex = r'^[a-zA-Z0-9_][a-zA-Z0-9-_.+]*$' @@ -816,7 +816,7 @@ targets to build the package for a particular stream. .format(repo_name)) summary_from_bug = '' - if bug and ns not in ['tests', 'modules']: + if bug and ns not in ['tests', 'modules', 'flatpaks']: bz_url = config.get('{0}.bugzilla'.format(name), 'url') bz_client = BugzillaClient(bz_url) bug_obj = bz_client.get_review_bug(bug, ns, repo_name) @@ -929,13 +929,13 @@ targets to build the package for a particular stream. if is_epel(branch): assert_valid_epel_package(repo_name, branch) - if ns in ['modules', 'test-modules']: + if ns in ['modules', 'test-modules', 'flatpaks']: branch_valid = bool(re.match(r'^[a-zA-Z0-9.\-_+]+$', branch)) if not branch_valid: raise rpkgError( 'Only characters, numbers, periods, dashes, ' - 'underscores, and pluses are allowed in module branch ' - 'names') + 'underscores, and pluses are allowed in {} branch ' + 'names'.format('flatpak' if ns == 'flatpaks' else 'module')) release_branches = list(itertools.chain( *list(get_release_branches(pdc_url).values()))) if branch in release_branches: diff --git a/test/test_cli.py b/test/test_cli.py index cc6f184..40d9ac2 100644 --- a/test/test_cli.py +++ b/test/test_cli.py @@ -1223,6 +1223,22 @@ https://pagure.stg.example.com/releng/fedora-scm-requests/issue/3""" except rpkgError as error: self.assertEqual(str(error), expected_error) + def test_request_branch_invalid_flatpak_branch_name(self): + """Test request-branch raises an exception when a invalid module branch + name is supplied""" + cli_cmd = ['fedpkg-stage', '--path', self.cloned_repo_path, + '--name', 'nethack', '--namespace', 'flatpaks', + 'request-branch', 'some:branch'] + cli = self.get_cli(cli_cmd) + expected_error = ( + 'Only characters, numbers, periods, dashes, underscores, and ' + 'pluses are allowed in flatpak branch names') + try: + cli.request_branch() + assert False, 'rpkgError not raised' + except rpkgError as error: + self.assertEqual(str(error), expected_error) + def test_request_branch_no_branch(self): """Test request-branch raises an exception when a branch isn't supplied """