From 8aeee5cdc3e5bfa2b1bd016a1e0265fe3e88152d Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Feb 24 2024 06:31:43 +0000 Subject: 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. --- diff --git a/.gitignore b/.gitignore index 9c038b1..336a0ca 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/aerc.spec b/aerc.spec index a2bcd50..905cd36 100644 --- a/aerc.spec +++ b/aerc.spec @@ -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 diff --git a/mkvendor.sh b/mkvendor.sh new file mode 100755 index 0000000..445789b --- /dev/null +++ b/mkvendor.sh @@ -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" diff --git a/sources b/sources index 534c10f..d14a1f0 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (aerc-0.16.0.tar.gz) = 8196424915f8f6dc80bad0f936e34b7f51298665af3579ae8c06699a4f1caf962258185a432909911920ec1eb089c9f178c9086c54c0e799a44e1e0dac907fd8 +SHA512 (aerc-0.16.0-vendor.tar.gz) = 92e7d134a94db8afcc9102e9d15c7aae8c1b10c74db78ff6e918521a17700e12ec8d27375778e902190291df399d4b76b2564e52a704cf40d7ba7194144e2614