From cd947ea11a492be24e2e0cbe864339864382a2cc Mon Sep 17 00:00:00 2001
From: Tomas Hrcka <thrcka@redhat.com>
Date: Aug 06 2020 10:10:04 +0000
Subject: [PATCH 1/4] Skip PDC magic for tests repo creation


Signed-off-by: Tomas Hrcka <thrcka@redhat.com>

---

diff --git a/fedscm_admin/utils.py b/fedscm_admin/utils.py
index fdaf7e6..7b1bfad 100644
--- a/fedscm_admin/utils.py
+++ b/fedscm_admin/utils.py
@@ -95,7 +95,7 @@ def verify_slas(branch, sla_dict):
         if not isinstance(eol, string_types):
             raise ValidationError(
                 'The SL\'s EOL is not a string. It was type "{0}".'
-                .format(type(eol).__name__))
+                    .format(type(eol).__name__))
         if re.match(eol_date_regex, eol):
             eol_date = datetime.strptime(eol, '%Y-%m-%d').date()
             today = datetime.utcnow().date()
@@ -105,7 +105,7 @@ def verify_slas(branch, sla_dict):
             elif eol_date.month not in [6, 12] or eol_date.day != 1:
                 raise ValidationError(
                     'The SL "{0}" must expire on June 1st or December 1st'
-                    .format(eol))
+                        .format(eol))
         else:
             raise ValidationError(
                 'The EOL date "{0}" is in an invalid format'.format(eol))
@@ -358,7 +358,7 @@ def prompt_for_new_repo(issue_json, issue_body_json, force=False,
     if not fedscm_admin.pagure.user_exists(issue_owner):
         sync_comment = ('@{0} needs to login to {1} to sync accounts '
                         'before we can proceed.'.format(
-                            issue_owner, pagure_url))
+            issue_owner, pagure_url))
         question = '{0}  Post this comment to the ticket?'.format(
             sync_comment)
         if click.confirm(question):
@@ -430,22 +430,26 @@ def prompt_for_new_repo(issue_json, issue_body_json, force=False,
         dist_git_url = '{0}/{1}/{2}'.format(
             pagure_url.rstrip('/'), namespace, repo)
         # If the global component already exists, this will not create another
-        fedscm_admin.pdc.new_global_component(repo, dist_git_url)
+        # Skip for tests namespace
+        if namespace != 'tests':
+            fedscm_admin.pdc.new_global_component(repo, dist_git_url)
         # Pagure uses plural names for namespaces, but PDC does not use the
         # plural version for branch types
         branch_type = fedscm_admin.pdc.component_type_to_singular(namespace)
         # If the branch requested isn't master, still create a master branch
         # in PDC anyways.
-        if branch_name != 'master':
-            fedscm_admin.pdc.new_branch(repo, 'master', branch_type)
-            for sla, eol in fedscm_admin.STANDARD_BRANCH_SLAS['master'].items():
+        # Skip pdc magic for tests namespace
+        if namespace != 'tests':
+            if branch_name != 'master':
+                fedscm_admin.pdc.new_branch(repo, 'master', branch_type)
+                for sla, eol in fedscm_admin.STANDARD_BRANCH_SLAS['master'].items():
+                    fedscm_admin.pdc.new_sla_to_branch(
+                        sla, eol, repo, 'master', branch_type)
+
+            fedscm_admin.pdc.new_branch(repo, branch_name, branch_type)
+            for sla, eol in issue_body_json['sls'].items():
                 fedscm_admin.pdc.new_sla_to_branch(
-                    sla, eol, repo, 'master', branch_type)
-
-        fedscm_admin.pdc.new_branch(repo, branch_name, branch_type)
-        for sla, eol in issue_body_json['sls'].items():
-            fedscm_admin.pdc.new_sla_to_branch(
-                sla, eol, repo, branch_name, branch_type)
+                    sla, eol, repo, branch_name, branch_type)
 
         # Create the Pagure repo
         fedscm_admin.pagure.new_project(
@@ -535,12 +539,12 @@ def prompt_for_new_branch(issue_json, issue_body_json, force=False, auto_approve
     pdc_branch = fedscm_admin.pdc.get_branch(repo, branch_name, branch_type)
     if pdc_branch:
         ticket_text = \
-            "The branch in PDC already exists, you can now create it yourself as follows:\n"\
-            "Check in the project's settings if you have activated the git hook preventing"\
-            "new git branches from being created and if you did, de-activate it.\n"\
-            "Then simply run in cloned repository: "\
-            "``git checkout -b <branch_name> && git push -u origin <branch_name>``.\n"\
-            "``<branch_name>`` is the name of the branch you requested. \n"\
+            "The branch in PDC already exists, you can now create it yourself as follows:\n" \
+            "Check in the project's settings if you have activated the git hook preventing" \
+            "new git branches from being created and if you did, de-activate it.\n" \
+            "Then simply run in cloned repository: " \
+            "``git checkout -b <branch_name> && git push -u origin <branch_name>``.\n" \
+            "``<branch_name>`` is the name of the branch you requested. \n" \
             "You only need to do this once and you can then use fedpkg as you normally do."
         prompt_to_close_bad_ticket(
             issue_json, ticket_text)
@@ -558,11 +562,11 @@ def prompt_for_new_branch(issue_json, issue_body_json, force=False, auto_approve
         click.secho(msg, fg='yellow')
     else:
         # Get the list of maintainers of the package
-        maintainers = set(project['access_users']['owner']) | set(project['access_users']['admin'])\
-            | set(project['access_users']['commit'])
+        maintainers = set(project['access_users']['owner']) | set(project['access_users']['admin']) \
+                      | set(project['access_users']['commit'])
         # Get the list of FAS groups who can maintain the package
-        access_groups = set(project['access_groups']['admin'])\
-            | set(project['access_groups']['commit'])
+        access_groups = set(project['access_groups']['admin']) \
+                        | set(project['access_groups']['commit'])
         group_member = False
         for access_group in access_groups:
             # Check if the requestor is part of any of the FAS groups who can maintain the package
@@ -841,5 +845,5 @@ def ticket_requires_approval(issue_type, issue):
 
     branch_name = issue['branch'].strip()
     standard_branch = is_valid_standard_branch(branch_name)
-    return not(standard_branch and not re.match(r'^(el|epel)[0-9]+$',
-               branch_name))
+    return not (standard_branch and not re.match(r'^(el|epel)[0-9]+$',
+                                                 branch_name))

From 7862d58b5982803dbe4c47e0262c6ce78bc903db Mon Sep 17 00:00:00 2001
From: Tomas Hrcka <thrcka@redhat.com>
Date: Aug 13 2020 14:51:54 +0000
Subject: [PATCH 2/4] Add f33 slas


Signed-off-by: Tomas Hrcka <thrcka@redhat.com>

---

diff --git a/fedscm_admin/__init__.py b/fedscm_admin/__init__.py
index d2a2fea..fa14b82 100644
--- a/fedscm_admin/__init__.py
+++ b/fedscm_admin/__init__.py
@@ -54,6 +54,10 @@ STANDARD_BRANCH_SLAS = {
         'security_fixes': '2020-11-30',
         'bug_fixes': '2020-11-30'
     },
+    'f33': {
+        'bug_fixes': '2021-11-16',
+        'security_fixes': '2021-11-16'
+    },
     'f32': {
         'bug_fixes': '2021-05-25',
         'security_fixes': '2021-05-25'

From 759dcbc285d03e27bfa5229e8aa36b6ee8506575 Mon Sep 17 00:00:00 2001
From: Tomas Hrcka <thrcka@redhat.com>
Date: Aug 13 2020 15:04:34 +0000
Subject: [PATCH 3/4] Skip RHBZ verification for containers


Signed-off-by: Tomas Hrcka <thrcka@redhat.com>

---

diff --git a/fedscm_admin/utils.py b/fedscm_admin/utils.py
index 7b1bfad..054d856 100644
--- a/fedscm_admin/utils.py
+++ b/fedscm_admin/utils.py
@@ -316,7 +316,7 @@ def prompt_for_new_repo(issue_json, issue_body_json, force=False,
         prompt_to_close_bad_ticket(issue_json, error)
         return
 
-    if force or exception is True or namespace in ('modules', 'flatpaks', 'tests'):
+    if force or exception is True or namespace in ('modules', 'flatpaks', 'tests', 'containers'):
         skip_msg = '- Skipping verification of RHBZ'
         if bug_id:
             skip_msg = '{0} #{1}'.format(skip_msg, bug_id)

From b318fff2f829907c275ae768e01a5da03d170842 Mon Sep 17 00:00:00 2001
From: Tomas Hrcka <thrcka@redhat.com>
Date: Aug 13 2020 16:26:22 +0000
Subject: [PATCH 4/4] Fix formating of utils.py


Signed-off-by: Tomas Hrcka <thrcka@redhat.com>

---

diff --git a/fedscm_admin/utils.py b/fedscm_admin/utils.py
index 054d856..b01a060 100644
--- a/fedscm_admin/utils.py
+++ b/fedscm_admin/utils.py
@@ -94,8 +94,7 @@ def verify_slas(branch, sla_dict):
     for sla, eol in sla_dict.items():
         if not isinstance(eol, string_types):
             raise ValidationError(
-                'The SL\'s EOL is not a string. It was type "{0}".'
-                    .format(type(eol).__name__))
+                'The SL\'s EOL is not a string. It was type "{0}".'.format(type(eol).__name__))
         if re.match(eol_date_regex, eol):
             eol_date = datetime.strptime(eol, '%Y-%m-%d').date()
             today = datetime.utcnow().date()
@@ -104,8 +103,7 @@ def verify_slas(branch, sla_dict):
                     'The SL "{0}" is already expired'.format(eol))
             elif eol_date.month not in [6, 12] or eol_date.day != 1:
                 raise ValidationError(
-                    'The SL "{0}" must expire on June 1st or December 1st'
-                        .format(eol))
+                    'The SL "{0}" must expire on June 1st or December 1st'.format(eol))
         else:
             raise ValidationError(
                 'The EOL date "{0}" is in an invalid format'.format(eol))
@@ -357,10 +355,8 @@ def prompt_for_new_repo(issue_json, issue_body_json, force=False,
     pagure_url = get_config_item(CONFIG, 'pagure_dist_git_url')
     if not fedscm_admin.pagure.user_exists(issue_owner):
         sync_comment = ('@{0} needs to login to {1} to sync accounts '
-                        'before we can proceed.'.format(
-            issue_owner, pagure_url))
-        question = '{0}  Post this comment to the ticket?'.format(
-            sync_comment)
+                        'before we can proceed.'.format(issue_owner, pagure_url))
+        question = '{0}  Post this comment to the ticket?'.format(sync_comment)
         if click.confirm(question):
             fedscm_admin.pagure.add_comment_to_issue(issue_id, sync_comment)
         return
@@ -562,11 +558,12 @@ def prompt_for_new_branch(issue_json, issue_body_json, force=False, auto_approve
         click.secho(msg, fg='yellow')
     else:
         # Get the list of maintainers of the package
-        maintainers = set(project['access_users']['owner']) | set(project['access_users']['admin']) \
-                      | set(project['access_users']['commit'])
+        maintainers = set(project['access_users']['owner']) | \
+                      set(project['access_users']['admin']) | \
+                      set(project['access_users']['commit'])
         # Get the list of FAS groups who can maintain the package
-        access_groups = set(project['access_groups']['admin']) \
-                        | set(project['access_groups']['commit'])
+        access_groups = set(project['access_groups']['admin'])\
+            | set(project['access_groups']['commit'])
         group_member = False
         for access_group in access_groups:
             # Check if the requestor is part of any of the FAS groups who can maintain the package

