Skip to content

Commit 2993c7c

Browse files
authored
Merge pull request #370 from tri-adam/gopath
Remove GOPATH Use, Simplify RPM Spec
2 parents 5a61cb3 + 9a84255 commit 2993c7c

File tree

2 files changed

+23
-42
lines changed

2 files changed

+23
-42
lines changed

INSTALL.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,10 @@ wget -O /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz \
5656
sudo tar -C /usr/local -xzf /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz
5757
```
5858

59-
Finally, set up your environment for Go:
59+
Finally, add `/usr/local/go/bin` to the `PATH` environment variable:
6060

6161
```sh
62-
echo 'export GOPATH=${HOME}/go' >> ~/.bashrc
63-
echo 'export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin' >> ~/.bashrc
62+
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
6463
source ~/.bashrc
6564
```
6665

@@ -86,6 +85,13 @@ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/insta
8685

8786
<!-- markdownlint-enable MD013 -->
8887

88+
Add `$(go env GOPATH)` to the `PATH` environment variable:
89+
90+
```sh
91+
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc
92+
source ~/.bashrc
93+
```
94+
8995
## Clone the repo
9096

9197
With the adoption of Go modules you no longer need to clone the SingularityCE

dist/rpm/singularity-ce.spec.in

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
1-
#
1+
#
22
# Copyright (c) 2017-2021, SyLabs, Inc. All rights reserved.
33
# Copyright (c) 2017, SingularityWare, LLC. All rights reserved.
44
#
55
# Copyright (c) 2015-2017, Gregory M. Kurtzer. All rights reserved.
6-
#
6+
#
77
# Copyright (c) 2016, The Regents of the University of California, through
88
# Lawrence Berkeley National Laboratory (subject to receipt of any required
99
# approvals from the U.S. Dept. of Energy). All rights reserved.
10-
#
10+
#
1111
# This software is licensed under a customized 3-clause BSD license. Please
1212
# consult LICENSE file distributed with the sources of this project regarding
1313
# your rights to use or distribute this software.
14-
#
14+
#
1515
# NOTICE. This Software was developed under funding from the U.S. Department of
1616
# Energy and the U.S. Government consequently retains certain rights. As such,
1717
# the U.S. Government has been granted for itself and others acting on its
1818
# behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software
1919
# to reproduce, distribute copies to the public, prepare derivative works, and
20-
# perform publicly and display publicly, and to permit other to do so.
21-
#
22-
#
23-
24-
%define singgopath src/github.com/sylabs/singularity
20+
# perform publicly and display publicly, and to permit other to do so.
21+
#
22+
#
2523

2624
# Disable debugsource packages; otherwise it ends up with an empty %files
2725
# file in debugsourcefiles.list on Fedora
@@ -36,19 +34,11 @@ License: BSD-3-Clause-LBNL
3634
URL: https://www.sylabs.io/singularity/
3735
Source: %{name}-@[email protected]
3836
ExclusiveOS: linux
39-
# RPM_BUILD_ROOT wasn't being set ... for some reason
40-
%if "%{sles_version}" == "11"
41-
BuildRoot: /var/tmp/singularity-%{version}-build
42-
%endif
4337

4438
BuildRequires: git
4539
BuildRequires: gcc
4640
BuildRequires: make
47-
%if ! 0%{?el6}
48-
%if "%{sles_version}" != "11"
4941
BuildRequires: libseccomp-devel
50-
%endif
51-
%endif
5242
%if "%{_target_vendor}" == "suse"
5343
Requires: squashfs
5444
%else
@@ -74,25 +64,19 @@ containers that can be used across host environments.
7464
export RPM_BUILD_ROOT="%{buildroot}"
7565
%endif
7666

77-
if [ -d %{name}-%{version} ]; then
78-
# Clean up old build root
79-
# First clean go's modcache because directories are unwritable
80-
GOPATH=$PWD/%{name}-%{version}/gopath go clean -modcache
81-
rm -rf %{name}-%{version}
82-
fi
83-
8467
# Create our build root
68+
chmod -R +w %{name}-%{version} || true
69+
rm -rf %{name}-%{version}
8570
mkdir %{name}-%{version}
8671

8772
%build
8873
cd %{name}-%{version}
8974

9075
# Setup an empty GOPATH for the build
91-
mkdir -p gopath
9276
export GOPATH=$PWD/gopath
93-
export PATH=$GOPATH/bin:$PATH
77+
mkdir -p "$GOPATH"
9478

95-
# Perform the build outside of GOPATH as we are using go modules
79+
# Extract the source
9680
tar -xf "%SOURCE0"
9781
cd %{name}-@PACKAGE_VERSION@
9882

@@ -113,25 +97,16 @@ cd %{name}-@PACKAGE_VERSION@
11397
--mandir=%{_mandir} \
11498
--infodir=%{_infodir}
11599

116-
cd builddir
117-
make old_config=
100+
make -C builddir old_config=
118101

119102
%install
120103
cd %{name}-%{version}
121104

122-
# Setup an empty GOPATH for the build
123105
export GOPATH=$PWD/gopath
124-
export PATH=$GOPATH/bin:$PATH
106+
cd %{name}-@PACKAGE_VERSION@
125107

126-
# Enter the source builddir for the install
127-
cd %{name}-@PACKAGE_VERSION@/builddir
128108
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
129-
make DESTDIR=$RPM_BUILD_ROOT install man
130-
131-
%if "%{suse_version}" == "11"
132-
%clean
133-
/bin/rm -rf %{buildroot}
134-
%endif
109+
make -C builddir DESTDIR=$RPM_BUILD_ROOT install man
135110

136111
%files
137112
%attr(4755, root, root) %{_libexecdir}/singularity/bin/starter-suid

0 commit comments

Comments
 (0)