From 3db36c30932d156fef612eff8916d43b11eeae8a Mon Sep 17 00:00:00 2001 From: "Brett T. Warden" Date: Tue, 24 Oct 2017 17:16:20 -0700 Subject: [PATCH] tarball: Use repo name only if more descriptive For github URLs, only use the repo name as the package name if it's more descriptive than what was extracted from the tarball name. Otherwise, filter off prefix "release-" or a numeric suffix. Signed-off-by: Brett T. Warden --- autospec/tarball.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autospec/tarball.py b/autospec/tarball.py index ff3c7c0..7eee7b5 100644 --- a/autospec/tarball.py +++ b/autospec/tarball.py @@ -340,7 +340,12 @@ def name_and_version(name_arg, version_arg, filemanager): m = re.search(pattern, url) if m: repo = m.group(2).strip() - name = repo + if repo not in name: + # Only take the repo name as the package name if it's more descriptive + name = repo + elif name != repo: + name = re.sub("release-", '', name) + name = re.sub("\d*$", '', name) rawname = name version = convert_version(m.group(3)) giturl = "https://github.com/" + m.group(1).strip() + "/" + repo + ".git"