From 38613cac9478ddc129e99e2a645852a2d56b4c71 Mon Sep 17 00:00:00 2001 From: Jason McKenna Date: Fri, 14 Dec 2018 10:33:51 -0500 Subject: [PATCH] Add go "dep" tool to support lockfiles in go pkgs The go compiler supports "go get" to download dependencies, but it will download the latest version of dependencies from the git repository of the dependency. This could lead to non-reproducable builds, or the potential of dependency API changes (including deprecated features) to break the build of packages. The "dep" tool allows for a lockfile to be created, which captures the git commit ID of dependencies, and can restore dependencies to the captured state. Since no binary package containing "dep" is currently available for CentOS, this change adds the package and compiles it from source. Depends-On: https://review.openstack.org/625333 Story: 2004617 Task: 28525 Change-Id: Ic3bfad6a419b344e7c147c3839d16956c432a99e Signed-off-by: Jason McKenna --- base/golang-dep/centos/build_srpm.data | 2 ++ base/golang-dep/centos/golang-dep.spec | 45 ++++++++++++++++++++++++++ centos_pkg_dirs | 1 + 3 files changed, 48 insertions(+) create mode 100644 base/golang-dep/centos/build_srpm.data create mode 100644 base/golang-dep/centos/golang-dep.spec diff --git a/base/golang-dep/centos/build_srpm.data b/base/golang-dep/centos/build_srpm.data new file mode 100644 index 000000000..418ca079f --- /dev/null +++ b/base/golang-dep/centos/build_srpm.data @@ -0,0 +1,2 @@ +COPY_LIST="$CGCS_BASE/downloads/dep-v0.5.0.tar.gz" +TIS_PATCH_VER=0 diff --git a/base/golang-dep/centos/golang-dep.spec b/base/golang-dep/centos/golang-dep.spec new file mode 100644 index 000000000..ba461d4f8 --- /dev/null +++ b/base/golang-dep/centos/golang-dep.spec @@ -0,0 +1,45 @@ +Name: golang-dep +Version: 0.5.0 +Release: %{tis_patch_ver}%{?_tis_dist} +Summary: Go dep dependency management tool +Group: Development/Languages +License: Go +URL: https://github.com/golang/dep +Source: dep-v0.5.0.tar.gz +BuildRequires: golang +Requires: golang + +%global with_debug 0 +%global debug_package %{nil} +%define __spec_install_post %{nil} + +%define tooldir %{_libdir}/go/pkg/%{name}/linux_amd64 + +%if ! 0%{?gobuild:1} +%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**}; +%endif + +%description +This package includes additional go development tools. + +%prep +%setup -T -c -n go/src/github.com/golang/dep +tar --strip-components=1 -x -f %{SOURCE0} + +%build +export GOPATH=%{_builddir}/go +(cd cmd/dep && %gobuild -o dep) + +%install +rm -rf %{buildroot} +install -d %{buildroot}%{_bindir} +install -d %{buildroot}%{tooldir} +install cmd/dep/dep %{buildroot}%{_bindir} + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%{_bindir}/dep + diff --git a/centos_pkg_dirs b/centos_pkg_dirs index cc99a7c57..384080369 100644 --- a/centos_pkg_dirs +++ b/centos_pkg_dirs @@ -145,6 +145,7 @@ database/python-psycopg2 base/crontabs base/dnsmasq base/dnsmasq-config +base/golang-dep filesystem/parted security/python-keyring grub/grub2