| |
@@ -44,6 +44,49 @@
|
| |
def setup_centos_subparsers(self):
|
| |
self.register_do_fork()
|
| |
self.register_request_gated_side_tag()
|
| |
+ self.register_check_repo_name()
|
| |
+ self.register_fix_repo_name()
|
| |
+
|
| |
+ def register_check_repo_name(self):
|
| |
+ help_msg = 'Check if the repo name is consistent with it\'s folder, repo url and specfile'
|
| |
+ description = textwrap.dedent('''
|
| |
+ Check if the repo name is consistent with it\'s folder, repo url and specfile
|
| |
+ '''.format(self.name))
|
| |
+
|
| |
+ repo_checker = self.subparsers.add_parser(
|
| |
+ 'checkname',
|
| |
+ formatter_class=argparse.RawDescriptionHelpFormatter,
|
| |
+ help=help_msg,
|
| |
+ description=description)
|
| |
+ repo_checker.set_defaults(command=self.do_repo_checker)
|
| |
+
|
| |
+ def do_repo_checker(self):
|
| |
+ spec_name, git_name, dir_name = centpkg.utils.get_project_names()
|
| |
+ if spec_name != dir_name:
|
| |
+ self.log.info(
|
| |
+ "Mistmatch between name of the spec-file {} and the directory {}".format(spec_name, dir_name))
|
| |
+ if spec_name != git_name:
|
| |
+ self.log.info(
|
| |
+ "Mistmatch between name of the spec-file {} and the git-remote {}".format(spec_name, git_name))
|
| |
+ if spec_name == dir_name and spec_name == git_name:
|
| |
+ self.log.info("Specfile, directory and git-remote match.")
|
| |
+
|
| |
+ def register_fix_repo_name(self):
|
| |
+ help_msg = 'Check if the repo name is consistent with it\'s folder, repo url and specfile'
|
| |
+ description = textwrap.dedent('''
|
| |
+ Check if the repo name is consistent with it\'s folder, repo url and specfile
|
| |
+ '''.format(self.name))
|
| |
+
|
| |
+ repo_checker = self.subparsers.add_parser(
|
| |
+ 'fixname',
|
| |
+ formatter_class=argparse.RawDescriptionHelpFormatter,
|
| |
+ help=help_msg,
|
| |
+ description=description)
|
| |
+ repo_checker.set_defaults(command=self.do_repo_fixer)
|
| |
+
|
| |
+ def do_repo_fixer(self):
|
| |
+ self.do_repo_checker()
|
| |
+ centpkg.utils.fix_repo()
|
| |
|
| |
def register_do_fork(self):
|
| |
help_msg = 'Create a new fork of the current repository'
|
| |
@@ -138,3 +181,8 @@
|
| |
def request_gated_side_tag(self):
|
| |
self.args.suffix = "stack-gate"
|
| |
super(centpkgClient, self).request_side_tag()
|
| |
+
|
| |
+ def clone(self):
|
| |
+ super(centpkgClient, self).clone()
|
| |
+ project_dir = centpkg.utils.parse_project_dir(self.args.repo[0])
|
| |
+ centpkg.utils.fix_repo(project_dir)
|
| |
\ No newline at end of file
|
| |
There is an assumption that the name of the directory, repository and package as described in the specfile is the same.
This assumption can be easily broken when checking out the package from gitlab, where repositort-names are not case sensitive.
This code adds a workaround, that checks the three names are matching:
- directory name
- name of the specfile
- the git origin remote
and if not, uses the name of the specfile for all of them.
We probably should use the name of from the specfile for this, but the
load_repo_name
of the underlying rpkg libraryis using git remote for this information and this might have been necessary to be able to get the namespace alongside of the name.