Build with vendored dependencies by default

aerc has a lot of dependencies and is picky about them. Upstream does a
good job at keeping them updated. aerc is prone to crashes with Fedora's
dependency versions, many of which are out of date.
This commit is contained in:
Maxwell G 2023-12-23 22:16:10 +00:00
commit 8aeee5cdc3
No known key found for this signature in database
GPG key ID: F79E4E25E8C661F8
4 changed files with 61 additions and 3 deletions

1
.gitignore vendored
View file

@ -8,3 +8,4 @@
/aerc-0.14.0.tar.gz
/aerc-0.15.2.tar.gz
/aerc-0.16.0.tar.gz
/aerc-0.16.0-vendor.tar.gz

View file

@ -1,5 +1,9 @@
# Generated by go2rpm 1.6.0
%bcond_without check
# aerc has a lot of dependencies and is picky about them. Upstream does a good
# job at keeping them updated. aerc is prone to crashes with Fedora's
# dependency versions, many of which are out of date
%bcond_without vendor
# https://git.sr.ht/~rjarry/aerc
%global goipath git.sr.ht/~rjarry/aerc
@ -21,6 +25,7 @@ URL: %{gourl}
# The forge macros don't support Sourcehut.
# https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/209
Source: %{gourl}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source: aerc-%{version}-vendor.tar.gz
BuildRequires: desktop-file-utils
# wrap and colorize filters are written in C
@ -36,8 +41,8 @@ Requires: notmuch
%{common_description}
%prep
%goprep
%autopatch -p1
%autosetup -n %{topdir} -p1 %{?with_vendor:-b1}
%goprep -e %{?with_vendor:-k}
# Disable building of aerc that we handle manually in the SPEC and
# preserve mtimes
@ -45,15 +50,19 @@ sed -e 's|install: $(DOCS) aerc wrap|install: $(DOCS)|' \
-e 's|install -m|install -pm|' \
-i Makefile
%if %{without vendor}
# From go.mod replace statements:
# replace golang.org/x/crypto => github.com/ProtonMail/go-crypto v0.0.0-20200420072808-71bec3603bf3
# replace github.com/zenhack/go.notmuch => github.com/brunnre8/go.notmuch v0.0.0-20201126061756-caa2daf7093c
sed -i "s|golang.org/x/crypto|github.com/ProtonMail/go-crypto|" $(find . -name "*.go" -type f)
sed -i "s|github.com/zenhack/go.notmuch|github.com/brunnre8/go.notmuch|" $(find . -name "*.go" -type f)
%endif
%generate_buildrequires
%if %{without vendor}
%go_generate_buildrequires
echo 'golang(github.com/brunnre8/go.notmuch)'
%endif
%build
export BUILDTAGS=notmuch
@ -84,7 +93,7 @@ LANG=en_US.UTF-8 ./filters/test.sh
%endif
%files
%license LICENSE
%license LICENSE %{?with_vendor:vendor/modules.txt}
%doc doc README.md
%{_bindir}/aerc
%{_bindir}/carddav-query

47
mkvendor.sh Executable file
View file

@ -0,0 +1,47 @@
#!/usr/bin/bash -x
set -euo pipefail
NAME="aerc"
googlestuff="true"
usage() {
echo "./mkvendor.sh [-n (disable proxy and sumbdb)] VERSION"
if [ -n "${1-}" ]; then
exit "${1}"
fi
}
do_env() {
if [ "${googlestuff}" = "true" ]; then
GOPROXY=https://proxy.golang.org,direct
GOSUMDB=sum.golang.org
export GOPROXY GOSUMDB
fi
}
while getopts "-nh" OPT; do
case "${OPT}" in
n)
googlestuff=""
;;
h)
usage 0
;;
*)
usage 1
;;
esac
done
shift "$((OPTIND-1))"
version="${1}" || usage 1
rm -rf "${NAME}-${version}/"
tar xf "${NAME}-${version}.tar.gz"
cd "${NAME}-${version}"
do_env
go mod vendor
cd -
tar czf "${NAME}-${version}-vendor.tar.gz" "${NAME}-${version}/vendor"

View file

@ -1 +1,2 @@
SHA512 (aerc-0.16.0.tar.gz) = 8196424915f8f6dc80bad0f936e34b7f51298665af3579ae8c06699a4f1caf962258185a432909911920ec1eb089c9f178c9086c54c0e799a44e1e0dac907fd8
SHA512 (aerc-0.16.0-vendor.tar.gz) = 92e7d134a94db8afcc9102e9d15c7aae8c1b10c74db78ff6e918521a17700e12ec8d27375778e902190291df399d4b76b2564e52a704cf40d7ba7194144e2614