#98 Fix cloning of the SIG repositories
Merged 5 months ago by tdawson. Opened 5 months ago by mfocko.
centos/ mfocko/centpkg fix/sig-clone  into  develop

file modified
+9 -3
@@ -31,6 +31,10 @@ 

  import sys

  

  _DEFAULT_API_BASE_URL = 'https://gitlab.com'

+ _DEFAULT_PARENT_NAMESPACE = {

+     'centpkg': 'redhat/centos-stream',

+     'centpkg-sig': 'CentOS',

+ }

  

  

  class centpkgClient(cliClient):
@@ -355,11 +359,13 @@ 

          # Since gitlab allows git repos to be checked out with incorrect capitilization

          #   we need to check the spelling when cloning

          gl = gitlab.Gitlab(_DEFAULT_API_BASE_URL)

+         parent_namespace = _DEFAULT_PARENT_NAMESPACE[self.DEFAULT_CLI_NAME]

+ 

          if "/" in self.args.repo[0]:

-             project_name_with_namespace = "redhat/centos-stream/"+self.args.repo[0]

-             short_name=self.args.repo[0].split("/")[1]

+             project_name_with_namespace = parent_namespace+"/"+self.args.repo[0]

+             short_name=self.args.repo[0].split("/")[-1]

          else:

-             project_name_with_namespace = "redhat/centos-stream/rpms/"+self.args.repo[0]

+             project_name_with_namespace = parent_namespace+"/rpms/"+self.args.repo[0]

              short_name=self.args.repo[0]

          try:

              project = gl.projects.get(project_name_with_namespace)

  • Improves one assumption about the package path during cloning; rpms/bash works with the previous solution, but when trying to clone SIG package, cloud/rpms/hello-world yields rpms instead of the expected hello-world
  • Implements a switch between parent namespaces as they differ for the CentOS itself and CentOS SIGs

Notes:

  • Changes require users to do centpkg-sig clone cloud/rpms/hello-world, there is a room for improvement with regards to that, but it doesn't seem like a trivial change.
  • Assumes the SIG repos to be present on GitLab.
  • I haven't found an issue reporting this, so it doesn't seem like it is a breaking change to expect the repos on GitLab.
  • I have a feeling that the rpkg config for centpkg-sig will need to be adjusted to reflect the GitLab repos.
  • This PR is open as part of the RFE for Packit to be able to build in CBS (https://github.com/packit/packit/issues/2305 and https://github.com/packit/packit/issues/2002)

LGTM and passed my manual tests.

Pull-Request has been merged by tdawson

5 months ago
Metadata