Blob Blame History Raw
# Generated by go2rpm
%bcond_with check

%global source_date_epoch_from_changelog Y

# https://github.com/rfjakob/gocryptfs
%global goipath         github.com/rfjakob/gocryptfs
Version:                1.7
%global extractdir      gocryptfs_v1.7_src

%gometa

%global common_description %{expand:
Encrypted overlay filesystem written in Go.}

%global golicenses      LICENSE
%global godocs          README.md

Name:           %{goname}
Release:        1%{?dist}
Summary:        Encrypted overlay filesystem written in Go

License:        MIT
URL:            %{gourl}
Source0:        https://%{goipath}/releases/download/v%{version}/gocryptfs_v%{version}_src.tar.gz
# Patch tests to not rebuild - useful for CI
Patch0:         fix_test.patch

BuildRequires:  golang(github.com/hanwen/go-fuse/fuse)
BuildRequires:  golang(github.com/hanwen/go-fuse/fuse/nodefs)
BuildRequires:  golang(github.com/hanwen/go-fuse/fuse/pathfs)
BuildRequires:  golang(github.com/jacobsa/crypto/siv)
BuildRequires:  golang(github.com/rfjakob/eme)
BuildRequires:  golang(golang.org/x/crypto/hkdf)
BuildRequires:  golang(golang.org/x/crypto/scrypt)
BuildRequires:  golang(golang.org/x/crypto/ssh/terminal)
BuildRequires:  golang(golang.org/x/sync/syncmap)
BuildRequires:  golang(golang.org/x/sys/unix)
BuildRequires:  openssl-devel

%description
%{common_description}

%gopkg

%package -n gocryptfs
Summary:       %{summary}
Requires:  fuse

%description -n gocryptfs
%{common_description}

%package -n gocryptfs-xray
Summary:       %{summary}

%description -n gocryptfs-xray
%{common_description}

This package contains the xray tool.

%prep
%goprep
%patch0 -p0

%build
USVERSION=$(cat VERSION)
GCVERSION=$USVERSION-Fedora-%{version}-%{release}
FUSEVERSION=$(rpm -q golang-github-hanwen-fuse-devel --queryformat '%%{version}')
BUILDDATE=$(date +%Y-%m-%d -d @$SOURCE_DATE_EPOCH)
# bex - notice the space here - it is needed and silly see https://pagure.io/go-rpm-macros/issue/19
LDFLAGS="-X main.GitVersion=$GCVERSION -X main.GitVersionFuse=$FUSEVERSION -X main.BuildDate=$BUILDDATE "
%gobuild -o %{gobuilddir}/bin/gocryptfs %{goipath}
for cmd in gocryptfs-xray; do
  %gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd
done

%install
%gopkginstall
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
install -D -m 644 Documentation/gocryptfs.1 %{buildroot}%{_mandir}/man1/gocryptfs.1
install -D -m 644 Documentation/gocryptfs-xray.1 %{buildroot}%{_mandir}/man1/gocryptfs-xray.1

%if %{with check}
%check
%gocheck
%endif

%files -n gocryptfs
%license LICENSE
%doc README.md
%{_bindir}/gocryptfs
%{_mandir}/man1/gocryptfs.1*

%files -n gocryptfs-xray
%license LICENSE
%{_bindir}/gocryptfs-xray
%{_mandir}/man1/gocryptfs-xray.1*

%gopkgfiles

%changelog
* Sun Jun 23 11:36:48 CEST 2019 Brian (bex) Exelbierd <bex@pobox.com> - 1.7-1
- Initial package