#1595 Append -flatpak suffix to koji package name for flatpaks
Merged 2 years ago by kevin. Opened 2 years ago by yselkowitz.
fedora-infra/ yselkowitz/ansible flatpaks  into  main

@@ -369,34 +369,42 @@ 

  

          for pkg in packages:

              owner = get_pagure_project_owner(namespace, pkg, verbose=verbose)

+             if (

+                 namespace == 'flatpaks'

+                 and not pkg.startswith('flatpak-')

+                 and not pkg.endswith('-flatpak')

+             ):

+                 koji_pkg = pkg + '-flatpak'

+             else

+                 koji_pkg = pkg

              # When the user is created in fedora infra, they wont be added to koji

              # until they logged into koji for the first time

              # Set the owner to 'releng' until they logged into koji

              if not session.getUser(owner):

                  owner = 'releng'

-             if pkg not in koji_pkgs:

+             if koji_pkg not in koji_pkgs:

                  extra_arches = None

-                 if pkg in EXTRA_ARCH_LIST:

-                     extra_arches = " ".join(EXTRA_ARCH_LIST[pkg])

+                 if koji_pkg in EXTRA_ARCH_LIST:

+                     extra_arches = " ".join(EXTRA_ARCH_LIST[koji_pkg])

                  if verbose:

                      print('- Adding the package "{0}" to the package list for '

                            'the tag "{1}" on arch "{2}" and applicable extra '

-                           'arches'.format(pkg, tag, arch))

+                           'arches'.format(koji_pkg, tag, arch))

                  session.packageListAdd(

-                     tag, pkg, owner=owner, extra_arches=extra_arches)

-             elif koji_pkgs[pkg]['owner_name'] != owner:

+                     tag, koji_pkg, owner=owner, extra_arches=extra_arches)

+             elif koji_pkgs[koji_pkg]['owner_name'] != owner:

                  if verbose:

                      print('- Setting the owner on package "{0}" for the tag '

                            '"{1}" on arch "{2}"'

-                           .format(pkg, tag, arch))

+                           .format(koji_pkg, tag, arch))

                  try:

-                     session.packageListSetOwner(tag, pkg, owner, force=True)

+                     session.packageListSetOwner(tag, koji_pkg, owner, force=True)

                  except:

                      # Onwer is not added to koji yet, setting releng as owner

                      print('- Setting releng as owner on package "{0}" for the tag '

                            '"{1}" on arch "{2}"'

-                           .format(pkg, tag, arch))

-                     session.packageListSetOwner(tag, pkg, 'releng', force=True)

+                           .format(koji_pkg, tag, arch))

+                     session.packageListSetOwner(tag, koji_pkg, 'releng', force=True)

  

  

  

NOTE this is my first contribution to this repository, and I don't know how to test this. So, please review it thoroughly, because I almost certainly messed up something.

At this point, all new flatpak requests should use the new flatpak infrastructure, which still uses flatpaks/$NAME dist-git but $NAME-flatpak koji "package".

Resolves: https://pagure.io/releng/issue/11626

For testing we are using the staging environment.

If you agree with this, I can deploy it on staging first and you can test it there.

rebased onto f71d9168c147408d9e380349d519f808d1b8f362

2 years ago

rebased onto f71d9168c147408d9e380349d519f808d1b8f362

2 years ago

Metadata Update from @zlopez:
- Pull-request tagged with: post-freeze

2 years ago

I think this should to be something like if namespace == 'flatpaks and not pkg.startswith('flatpak-') because we don't want flatpak-runtime-flatpak, etc. (

Otherwise looks good to me.

I think this should to be something like if namespace == 'flatpaks and not pkg.startswith('flatpak-') because we don't want flatpak-runtime-flatpak, etc. (

Good point; fixed.

kojipkg vs koji_pkgs bothers me a bit :-)

There is already for arch in arches, for pkg in pkgs, for tag in tags, for namespace in namespaces etc. so this seemed to fit the pattern. :shrug:

rebased onto c2af50b056ccf0084f1b997d3f60b0ff72b227d3

2 years ago

I'd be fine withkoji_pkg and koji_pkgs - what bothered me was kojipkg and koji_pkgs :smile: Certainly will work either way!

I don't generally contribute to Fedora infra so I have no idea how to go about testing this. What needs to happen is that e.g. fedpkg request-repo --namespace flatpaks crosswords does the following:

  • creates the flatpaks/crosswords repo in dist-git, with a default stable branch (as before)
  • creates the crosswords-flatpak package in koji and adds that package to the f39-flatpak tag
  • does NOT create a crosswords module, as flatpaks are no longer using modules as of F39.

rebased onto f04edd51190dabe072ed028d7d47d2dde763cfe8

2 years ago

rebased onto f04edd51190dabe072ed028d7d47d2dde763cfe8

2 years ago

rebased onto ba97149a67e32b857ffdf3ba9dc9b018c9de4f1f

2 years ago

rebased onto 0a83eb5e4bc748eb55e3d63b057a534eb7991574

2 years ago

I might be misreading the code, but I think every time the script is run it will keep adding the -flatpak suffix (i.e. we now have thunderbird and thunderbird-flatpak in koji_pkgs, so the next run it will create a new package named thunderbird-flatpak-flatpak, the next run thunderbird-flatpak-flatpak-flatpak, and so on...)

@mattia I'm completely new to this repo, and it's been a while since I looked at this (thanks to the long freeze). Is this run over the entire database every time, or only on specific packages as they are requested to be added? Is it necessary, and would it suffice, to add and not pkg.endswith('-flatpak') here?

rebased onto f1edae8ca59c46fe7c29df7aa2b2f8f7ab00d606

2 years ago

rebased onto f1edae8ca59c46fe7c29df7aa2b2f8f7ab00d606

2 years ago

@mattia I'm completely new to this repo, and it's been a while since I looked at this (thanks to the long freeze). Is this run over the entire database every time, or only on specific packages as they are requested to be added? Is it necessary, and would it suffice, to add and not pkg.endswith('-flatpak') here?

I am new also to this script... but from what I see, this script is run once a day with a list of build tags as argument, so it synch all packages built in that tag.
At a first glance, the 'and not pkg.endswith' should do the trick, but maybe it is better having another opinion frome someone else...

rebased onto c3ff699d689d7563b43c3cea08eee4686b9d58fe

2 years ago

rebased onto d60d7a0

2 years ago

It runs once a day with all the tags, but it also runs from a fedora-messaging consumer when it sees a new package/project message.

I think this seems ok, so I will go ahead and push it... do you have a new flatpak to add to test?

I can run it manually on the tags (although I think it takes a while to run). and/or just on f39-flatpak.

Pull-Request has been merged by kevin

2 years ago

I made some minor syntax tweaks... and then ran it on f39-flatpak and it corrected all the ownerships and did the right thing. Then I ran it on epel9-next and it didn't blow up...

so, hopefully we are set. Will keep an eye on it.

That one seems to have worked. ;)