#76 Check package spelling (CS-767)
Merged a year ago by tdawson. Opened a year ago by tdawson.
centos/ tdawson/centpkg check-spelling  into  develop

file modified
+24
@@ -25,6 +25,7 @@ 

  from six.moves.urllib_parse import urlparse

  import six.moves.configparser as ConfigParser

  

+ import gitlab

  import json

  import koji

  import os
@@ -276,3 +277,26 @@ 

      def request_gated_side_tag(self):

          self.args.suffix = "stack-gate"

          super(centpkgClient, self).request_side_tag()

+ 

+     def clone(self):

+         # 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)

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

+             project_name_with_namespace = "redhat/centos-stream/"+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]

+             short_name=self.args.repo[0]

+         try:

+             project = gl.projects.get(project_name_with_namespace)

+         except gitlab.exceptions.GitlabGetError as e:

+             self.log.info("There is no repository with the given name. Did you spell it correctly?")

+             self.log.info("Fatal: ")

+             self.log.info(e)

+             raise SystemExit

+         if not project.name == short_name:

+             self.log.info("Fatal: ")

+             self.log.info("Project name is wrong: " + short_name + " it should be: " + project.name)

+             raise SystemExit

+         super(centpkgClient, self).clone()

Since gitlab allows git repos to be checked out with incorrect capitilization
we need to check the spelling when cloning

Signed-off-by: Troy Dawson tdawson@redhat.com

Pull-Request has been merged by tdawson

a year ago
Metadata