[PATCH] Configure a separate namespace for Flatpaks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Owen W. Taylor" <otaylor@xxxxxxxxxxxx>

Configure pagure to allow a flatpaks/ namespace, and koji and MBS
to allow building from it.

When we sync package ownership to Koji, the f29-flatpaks tag (which has
the Flatpak containers) tag gets everything in the flatpaks/ namespace,
while the f29-modular tag gets everything in modules/ *and* flatpaks/,
since modules can be built from either.

Signed-off-by: Owen W. Taylor <otaylor@xxxxxxxxxxxx>
---
 .../backend/files/koji-sync-listener.py       |  2 +-
 roles/bodhi2/backend/tasks/main.yml           |  2 +-
 .../backend/templates/owner-sync-pagure.j2    | 55 +++++++++++--------
 roles/distgit/pagure/templates/pagure.cfg     |  3 +-
 roles/koji_builder/templates/kojid.conf       |  2 +
 roles/mbs/common/templates/config.py          | 10 +++-
 6 files changed, 45 insertions(+), 29 deletions(-)

diff --git a/roles/bodhi2/backend/files/koji-sync-listener.py b/roles/bodhi2/backend/files/koji-sync-listener.py
index 02b0e3f18..cbcbd280f 100644
--- a/roles/bodhi2/backend/files/koji-sync-listener.py
+++ b/roles/bodhi2/backend/files/koji-sync-listener.py
@@ -23,7 +23,7 @@ def handle(content):
     sys.stdout.flush()
     # XXX If you modify this taglist.  Please also modify the other copy in
     # bodhi2/backend/tasks/main.yml
-    taglist = 'f30 f30-container f30-modular f29 f28 f29-container f28-container f28-docker f29-modular f28-modular epel7 dist-6E-epel module-package-list modular'
+    taglist = 'f30 f30-container f30-modular f29 f28 f29-container f29-flatpak f28-container f28-docker f29-modular f28-modular epel7 dist-6E-epel module-package-list modular'
     cmd = [
         '/usr/local/bin/owner-sync-pagure',
         '--package', package,
diff --git a/roles/bodhi2/backend/tasks/main.yml b/roles/bodhi2/backend/tasks/main.yml
index 114c113d5..e65feb417 100644
--- a/roles/bodhi2/backend/tasks/main.yml
+++ b/roles/bodhi2/backend/tasks/main.yml
@@ -166,7 +166,7 @@
   # bodhi2/backend/files/koji-sync-listener.py
   # This cronjob runs only once a day.  The listener script runs reactively.
   cron: name="owner-sync" minute="15" hour="4" user="root"
-      job="/usr/local/bin/lock-wrapper owner-sync '/usr/local/bin/owner-sync-pagure f30 f30-container f30-modular f29 f28 f29-container f28-container f28-docker f29-modular f28-modular epel7 dist-6E-epel module-package-list modular'"
+      job="/usr/local/bin/lock-wrapper owner-sync '/usr/local/bin/owner-sync-pagure f30 f30-container f30-modular f29 f28 f29-container f29-flatpak f28-container f28-docker f29-modular f28-modular epel7 dist-6E-epel module-package-list modular'"
       cron_file=update-koji-owner
   when: inventory_hostname.startswith('bodhi-backend01') and env == "production"
   tags:
diff --git a/roles/bodhi2/backend/templates/owner-sync-pagure.j2 b/roles/bodhi2/backend/templates/owner-sync-pagure.j2
index 89d7a371c..e558a26b9 100755
--- a/roles/bodhi2/backend/templates/owner-sync-pagure.j2
+++ b/roles/bodhi2/backend/templates/owner-sync-pagure.j2
@@ -65,6 +65,7 @@ if not PDC_URL.endswith('/'):
 PDC_TYPES = {
     'rpms': 'rpm',
     'modules': 'module',
+    'flatpaks': 'flatpak',
     'container': 'container',
 }
 
@@ -118,26 +119,29 @@ def get_options():
     return opts
 
 
-def get_namespace_and_version_from_tag(tag):
+def get_namespaces_and_version_from_tag(tag):
     if 'container' in tag:
-        namespace = 'container'
+        namespaces = ['container']
         version = tag.split('-')[0].split('f')[1]
     elif 'docker' in tag:
-        namespace = 'container'
+        namespaces = ['container']
         version = tag.split('-')[0].split('f')[1]
     elif 'modular' in tag:
-        namespace = 'modules'
+        namespaces = ['flatpaks', 'modules']
         try:
             version = tag.split('-')[0].split('f')[1]
         except IndexError:
             version = RAWHIDE
+    elif 'flatpak' in tag:
+        namespaces = ['flatpaks']
+        version = tag.split('-')[0].split('f')[1]
     elif tag == 'module-package-list':
         # See https://pagure.io/releng/issue/6663
         # and https://pagure.io/fm-orchestrator/issue/333
-        namespace = 'rpms'
+        namespaces = ['rpms']
         version = RAWHIDE
     else:
-        namespace = 'rpms'
+        namespaces = ['rpms']
         if tag.startswith('epel'):
             version = tag.split('epel')[1]
         elif tag.startswith('f'):
@@ -378,15 +382,15 @@ if __name__ == '__main__':
     unique_namespaces = set()
     tag_info = {}
     for tag in tags:
-        namespace, version = get_namespace_and_version_from_tag(tag)
+        namespaces, version = get_namespaces_and_version_from_tag(tag)
         branch, arches = get_branch_and_arches(tag, version)
         tag_info[tag] = {
-            'namespace': namespace,
+            'namespaces': namespaces,
             'version': version,
             'branch': branch,
             'arches': arches
         }
-        unique_namespaces.add(namespace)
+        unique_namespaces.update(namespaces)
 
     # Get all the project to branch mappings for every namespace
     namespace_to_projects = {}
@@ -401,24 +405,27 @@ if __name__ == '__main__':
         if verbose:
             print('Determining which projects have the namespace "{0}" and '
                   'branch "{1}"'.format(namespace, tag))
-        namespace = info['namespace']
+        namespaces = info['namespace']
         pkgs = []
-        for pkg, branches in namespace_to_projects[namespace].items():
-            if info['branch'] in branches or tag == ('f' + RAWHIDE):
-                # The tag and branch names are the same for "old-style" branches
-                pkgs.append(pkg)
-            elif namespace == 'modules':
-                # Add modules to f27-modular-updates even if their only branch is '2.4'
-                pkgs.append(pkg)
-
-        # This is a special project, not in dist-git, but which needs to be in
-        # the package list.
-        if namespace == 'rpms':
-            pkgs.append('module-build-macros')
+        for namespace in namespaces:
+            for pkg, branches in namespace_to_projects[namespace].items():
+                if info['branch'] in branches or tag == ('f' + RAWHIDE):
+                    # The tag and branch names are the same for "old-style" branches
+                    pkgs.append(pkg)
+                elif namespace in ('modules', 'flatpaks'):
+                    # Add modules to f27-modular-updates even if their only branch is '2.4'
+                    # Similarly, flatpaks will be built into f29-flatpak-updates-candidate
+                    # if they use the f29 runtime, even from master or stream branches.
+                    pkgs.append(pkg)
+
+            # This is a special project, not in dist-git, but which needs to be in
+            # the package list.
+            if namespace == 'rpms':
+                pkgs.append('module-build-macros')
 
         if verbose:
             print('Setting the Koji ownership and package list on packages in '
-                  'the tag "{0}" and namespace "{1}" and for arches "{2}"'
-                  .format(tag, namespace, ', '.join(info['arches'])))
+                  'the tag "{0}" and namespaces "{1}" and for arches "{2}"'
+                  .format(tag, namespaces, ', '.join(info['arches'])))
         set_koji_ownership(tag, pkgs, info['arches'], verbose=verbose)
 
diff --git a/roles/distgit/pagure/templates/pagure.cfg b/roles/distgit/pagure/templates/pagure.cfg
index 4b8e00b1b..46173b9b6 100644
--- a/roles/distgit/pagure/templates/pagure.cfg
+++ b/roles/distgit/pagure/templates/pagure.cfg
@@ -211,7 +211,7 @@ LOGGING = {
 # Configuration item that are specific for this odd pagure instance
 
 ENABLE_UI_NEW_PROJECTS = False
-ALLOWED_PREFIX = ['rpms', 'modules', 'container', 'tests']
+ALLOWED_PREFIX = ['rpms', 'modules', 'flatpaks', 'container', 'tests']
 EXCLUDE_GROUP_INDEX = ['packager']
 PRIVATE_PROJECTS = False
 FEDMSG_NOTIFICATIONS = True
@@ -235,6 +235,7 @@ ACLS = {
 
 REQUIRED_GROUPS = {
     'container/*': ['packager'],
+    'flatpaks/*': ['packager'],
     'modules/*': ['packager'],
     'rpms/*': ['packager'],
 }
diff --git a/roles/koji_builder/templates/kojid.conf b/roles/koji_builder/templates/kojid.conf
index 9fbb8216a..a1eb32338 100644
--- a/roles/koji_builder/templates/kojid.conf
+++ b/roles/koji_builder/templates/kojid.conf
@@ -81,6 +81,7 @@ allowed_scms=
     !src.stg.fedoraproject.org:/forks/*
     !src.stg.fedoraproject.org:/cgit/*
     src.stg.fedoraproject.org:/container/*:false
+    src.stg.fedoraproject.org:/flatpaks/*:false
     src.stg.fedoraproject.org:/git/rpms/*:false:fedpkg,sources
     !src.stg.fedoraproject.org:/git/*
     !pkgs.stg.fedoraproject.org:/fork/*
@@ -88,6 +89,7 @@ allowed_scms=
     !pkgs.stg.fedoraproject.org:/cgit/*
     !pkgs.stg.fedoraproject.org:/git/*
     pkgs.stg.fedoraproject.org:/container/*:false
+    pkgs.stg.fedoraproject.org:/flatpaks/*:false
     pkgs.stg.fedoraproject.org:/rpms/*:false:fedpkg,sources
     pkgs.stg.fedoraproject.org:/*:false:fedpkg,sources
     src.stg.fedoraproject.org:/*:false:fedpkg,sources
diff --git a/roles/mbs/common/templates/config.py b/roles/mbs/common/templates/config.py
index 47f3ad790..4ed7a9ef2 100644
--- a/roles/mbs/common/templates/config.py
+++ b/roles/mbs/common/templates/config.py
@@ -140,7 +140,10 @@ class ProdConfiguration(BaseConfiguration):
     PDC_URL = 'https://pdc.stg.fedoraproject.org/rest_api/v1'
     SCMURLS = ['git+https://src.stg.fedoraproject.org/modules/',
                'https://src.stg.fedoraproject.org/modules/',
-               'https://src.stg.fedoraproject.org/git/modules/']
+               'https://src.stg.fedoraproject.org/git/modules/',
+               'git+https://src.stg.fedoraproject.org/flatpaks/',
+               'https://src.stg.fedoraproject.org/flatpaks/',
+               'https://src.stg.fedoraproject.org/git/flatpaks/']
 
 {% else %}
     KOJI_PROFILE = 'production'
@@ -155,7 +158,10 @@ class ProdConfiguration(BaseConfiguration):
     PDC_URL = 'https://pdc.fedoraproject.org/rest_api/v1'
     SCMURLS = ['git+https://src.fedoraproject.org/modules/',
                'https://src.fedoraproject.org/modules/',
-               'https://src.fedoraproject.org/git/modules/']
+               'https://src.fedoraproject.org/git/modules/',
+               'git+https://src.fedoraproject.org/flatpaks/',
+               'https://src.fedoraproject.org/flatpaks/',
+               'https://src.fedoraproject.org/git/flatpaks/']
 {% endif %}
 
     RESOLVER = "db"
-- 
2.20.1
_______________________________________________
infrastructure mailing list -- infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to infrastructure-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/infrastructure@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora Development]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux