Skip to content

Commit

Permalink
Merge pull request #370 from tri-adam/gopath
Browse files Browse the repository at this point in the history
Remove GOPATH Use, Simplify RPM Spec
  • Loading branch information
tri-adam authored Oct 14, 2021
2 parents 5a61cb3 + 9a84255 commit 2993c7c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 42 deletions.
12 changes: 9 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ wget -O /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz \
sudo tar -C /usr/local -xzf /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz
```

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

```sh
echo 'export GOPATH=${HOME}/go' >> ~/.bashrc
echo 'export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin' >> ~/.bashrc
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
```

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

<!-- markdownlint-enable MD013 -->

Add `$(go env GOPATH)` to the `PATH` environment variable:

```sh
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc
source ~/.bashrc
```

## Clone the repo

With the adoption of Go modules you no longer need to clone the SingularityCE
Expand Down
53 changes: 14 additions & 39 deletions dist/rpm/singularity-ce.spec.in
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
#
#
# Copyright (c) 2017-2021, SyLabs, Inc. All rights reserved.
# Copyright (c) 2017, SingularityWare, LLC. All rights reserved.
#
# Copyright (c) 2015-2017, Gregory M. Kurtzer. All rights reserved.
#
#
# Copyright (c) 2016, The Regents of the University of California, through
# Lawrence Berkeley National Laboratory (subject to receipt of any required
# approvals from the U.S. Dept. of Energy). All rights reserved.
#
#
# This software is licensed under a customized 3-clause BSD license. Please
# consult LICENSE file distributed with the sources of this project regarding
# your rights to use or distribute this software.
#
#
# NOTICE. This Software was developed under funding from the U.S. Department of
# Energy and the U.S. Government consequently retains certain rights. As such,
# the U.S. Government has been granted for itself and others acting on its
# behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software
# to reproduce, distribute copies to the public, prepare derivative works, and
# perform publicly and display publicly, and to permit other to do so.
#
#

%define singgopath src/github.com/sylabs/singularity
# perform publicly and display publicly, and to permit other to do so.
#
#

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

BuildRequires: git
BuildRequires: gcc
BuildRequires: make
%if ! 0%{?el6}
%if "%{sles_version}" != "11"
BuildRequires: libseccomp-devel
%endif
%endif
%if "%{_target_vendor}" == "suse"
Requires: squashfs
%else
Expand All @@ -74,25 +64,19 @@ containers that can be used across host environments.
export RPM_BUILD_ROOT="%{buildroot}"
%endif

if [ -d %{name}-%{version} ]; then
# Clean up old build root
# First clean go's modcache because directories are unwritable
GOPATH=$PWD/%{name}-%{version}/gopath go clean -modcache
rm -rf %{name}-%{version}
fi

# Create our build root
chmod -R +w %{name}-%{version} || true
rm -rf %{name}-%{version}
mkdir %{name}-%{version}

%build
cd %{name}-%{version}

# Setup an empty GOPATH for the build
mkdir -p gopath
export GOPATH=$PWD/gopath
export PATH=$GOPATH/bin:$PATH
mkdir -p "$GOPATH"

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

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

cd builddir
make old_config=
make -C builddir old_config=

%install
cd %{name}-%{version}

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

# Enter the source builddir for the install
cd %{name}-@PACKAGE_VERSION@/builddir
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
make DESTDIR=$RPM_BUILD_ROOT install man

%if "%{suse_version}" == "11"
%clean
/bin/rm -rf %{buildroot}
%endif
make -C builddir DESTDIR=$RPM_BUILD_ROOT install man

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

0 comments on commit 2993c7c

Please sign in to comment.