This change allows autospec to build and ship go binaries but stops
autospec creating source directories for the packages. This means that
autospec is to be used only to create go binaries and thus those
binaries must vendor all their dependencies.
Go packages will likely need to be patched in order for go build to
work due to the directory naming and/or vendoring handling. Please see
the patch in the 0001 patch in Clear Linux's
golang-github-cpuguy83-go-md2man package for an example of this.
---
autospec/build.py | 9 ---------
autospec/buildreq.py | 4 ++--
autospec/specfiles.py | 10 ++--------
autospec/tarball.py | 9 ---------
autospec/util.py | 23 -----------------------
5 files changed, 4 insertions(+), 51 deletions(-)
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/<project>/<repo> 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 56fcef2..39e63af 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))
--
2.13.0