From 15974ce6da17befe3f16c720eab922b5f6513465 Mon Sep 17 00:00:00 2001 From: Lubomír Sedlář Date: Mar 20 2016 11:46:03 +0000 Subject: [PATCH 1/2] Add rpms namespace for checkouts without namespace When user has an old checkout predating dist-git namespaces, the URL submitted to koji will have double slash before the module name, leading to failure. This patch adds a default "rpms" namespace. Signed-off-by: Lubomír Sedlář --- diff --git a/src/pyrpkg/__init__.py b/src/pyrpkg/__init__.py index 8644440..1e60817 100644 --- a/src/pyrpkg/__init__.py +++ b/src/pyrpkg/__init__.py @@ -568,7 +568,10 @@ class Commands(object): parts = urlparse.urlparse(self.push_url) if self.distgit_namespaced: - ns_module_name = "/".join(parts.path.split("/")[-2:]) + path_parts = [p for p in parts.path.split("/") if p] + if len(path_parts) == 1: + path_parts.insert(0, "rpms") + ns_module_name = "/".join(path_parts[-2:]) else: ns_module_name = posixpath.basename(parts.path) From f180bcc2a23e5ce3fa455c2ab80d93e6ceef1611 Mon Sep 17 00:00:00 2001 From: Lubomír Sedlář Date: Mar 22 2016 12:51:40 +0000 Subject: [PATCH 2/2] Print warning when using old git configuration Signed-off-by: Lubomír Sedlář --- diff --git a/src/pyrpkg/__init__.py b/src/pyrpkg/__init__.py index 1e60817..23d1866 100644 --- a/src/pyrpkg/__init__.py +++ b/src/pyrpkg/__init__.py @@ -560,6 +560,13 @@ class Commands(object): def ns_module_name(self, ns_module_name): self._ns_module_name = ns_module_name + def _print_old_checkout_warning(self, module): + self.log.warning('Your git configuration does not use a namespace.') + self.log.warning('Consider updating your git configuration by running:') + self.log.warning(' git remote set-url %s %s' + % (self.branch_remote, + self._get_namespace_giturl(module))) + def load_ns_module_name(self): """Loads a package module.""" @@ -570,6 +577,7 @@ class Commands(object): if self.distgit_namespaced: path_parts = [p for p in parts.path.split("/") if p] if len(path_parts) == 1: + self._print_old_checkout_warning(path_parts[0]) path_parts.insert(0, "rpms") ns_module_name = "/".join(path_parts[-2:]) else: