diff --git a/autospec/build.py b/autospec/build.py index bb14a77..2be9948 100644 --- a/autospec/build.py +++ b/autospec/build.py @@ -89,15 +89,6 @@ def failed_pattern(line, pattern, verbose, buildtool=None): if not s: return must_restart += buildreq.add_buildreq(util.translate('%s-python' % s)) - elif buildtool == 'go': - s = util.translate(s) - if not s: - return - elif s == match.group(1): - # the requirement it's also golang libpath format - # (e.g: github.com// so transform into pkg name - s = util.golang_name(s) - must_restart += buildreq.add_buildreq(s) elif buildtool == 'ruby': if s in config.gems: must_restart += buildreq.add_buildreq(config.gems[s]) diff --git a/autospec/buildreq.py b/autospec/buildreq.py index b5e3f48..c623407 100644 --- a/autospec/buildreq.py +++ b/autospec/buildreq.py @@ -466,10 +466,10 @@ def scan_for_configure(package, dir, autospecdir): if dirpath != dir: default_score = 1 - if any(file.endswith(".go") for file in files) and tarball.go_pkgname: + if any(file.endswith(".go") for file in files): add_buildreq("go") - tarball.name = tarball.go_pkgname buildpattern.set_build_pattern("golang", default_score) + if "CMakeLists.txt" in files and "configure.ac" not in files: add_buildreq("cmake") buildpattern.set_build_pattern("cmake", default_score) diff --git a/autospec/specfiles.py b/autospec/specfiles.py index 57186b9..6ac02f9 100644 --- a/autospec/specfiles.py +++ b/autospec/specfiles.py @@ -1021,17 +1021,11 @@ class Specfile(object): self._write_strip("%build") self.write_proxy_exports() self._write_strip("export LANG=C") + self._write_strip("export GOPATH=\"$PWD\"") + self._write_strip("go build") self._write_strip("\n") self._write_strip("%install") - self._write_strip('gopath="/usr/lib/golang-dist"') - self._write_strip('library_path="{}"'.format(library_path)) self._write_strip("rm -rf %{buildroot}") - self._write_strip("install -d -p %{buildroot}${gopath}/src/${library_path}/") - self._write_strip('for file in $(find . -iname "*.go" -o -iname "*.h" -o -iname "*.c") ; do') - self._write(" install -d -p %{buildroot}${gopath}/src/${library_path}/$(dirname $file)\n") - self._write(" cp -pav $file %{buildroot}${gopath}/src/${library_path}/$file\n") - self._write_strip("done") - self.write_make_install_append() self._write_strip("\n") def write_maven_pattern(self): diff --git a/autospec/tarball.py b/autospec/tarball.py index fb52740..782023b 100644 --- a/autospec/tarball.py +++ b/autospec/tarball.py @@ -32,8 +32,6 @@ import urllib.request import pycurl from io import BytesIO from util import call, print_fatal -# from util import golang_name -# from util import golang_libpath name = "" rawname = "" @@ -43,9 +41,6 @@ url = "" path = "" tarball_prefix = "" gcov_file = "" -golibpath = "" -go_pkgname = "" - def get_sha1sum(filename): sh = hashlib.sha1() @@ -129,9 +124,6 @@ def download_tarball(url_argument, name_arg, archives, target_dir): global path global tarball_prefix global gcov_file - # go naming - global golibpath - global go_pkgname tarfile = os.path.basename(url) @@ -372,4 +364,3 @@ def load_specfile(specfile): specfile.tarball_prefix = tarball_prefix specfile.gcov_file = gcov_file specfile.rawname = rawname - specfile.golibpath = golibpath diff --git a/autospec/util.py b/autospec/util.py index 8c18dd2..e2d1de1 100644 --- a/autospec/util.py +++ b/autospec/util.py @@ -64,29 +64,6 @@ def translate(package): return package -def golang_name(some_str): - """ get the golang-somesite-project-repo format pkg name""" - ret = some_str - pattern = re.compile(r".*(github)\.com/([0-9a-zA-Z_-]+)/([0-9a-zA-Z_-]+)/?") - match = pattern.search(some_str) - if match: - domain = match.group(1).strip() - project = match.group(2).strip() - repo = match.group(3).strip() - ret = "golang-" + domain + "-" + project + "-" + repo - return ret - - -def golang_libpath(some_str): - """ get the import path for golang""" - ret = "" - pattern = re.compile(r".*(github\.com/[0-9a-zA-Z_\-]+/[0-9a-zA-Z_\-]+).*") - match = pattern.search(some_str) - if match: - ret = match.group(1).strip() - return ret - - def print_fatal(message): print("[\033[1m\033[91mFATAL\033[0m] {}".format(message))