Skip to content

Commit c5a064f

Browse files
authored
Merge pull request #40 from DrDaveD/older-go
patch to use older go instead of including newer go
2 parents 53503e1 + 3c39224 commit c5a064f

File tree

6 files changed

+64
-48
lines changed

6 files changed

+64
-48
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,6 @@ jobs:
5757
OS_VERSION: latest
5858
run: ./ci/docker-run
5959

60-
rpmbuild-fedora41:
61-
name: rpmbuild-fedora41
62-
runs-on: ubuntu-latest
63-
steps:
64-
- uses: actions/checkout@v2
65-
# fetch tags as checkout@v2 doesn't do that by default
66-
- run: git fetch --prune --unshallow --tags --force
67-
68-
- name: Build rpm under docker
69-
env:
70-
OS_TYPE: quay.io/fedora/fedora-bootc
71-
OS_VERSION: 41
72-
run: ./ci/docker-run
73-
7460
rpmbuild-fedora42:
7561
name: rpmbuild-fedora42
7662
runs-on: ubuntu-latest

ci/rpm-build

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# install dependencies
55

6-
dnf -y install git gpg make python3 gcc-c++ findutils golang wget
6+
dnf -y install git gpg golang wget
77
dnf install -y rpm-build
88
if [[ "$OS_TYPE" = rocky* ]] || [[ "$OS_TYPE" = alma* ]]; then
99
dnf install -y epel-release
@@ -27,7 +27,9 @@ su testuser -c '
2727
wget "$DISTURL"
2828
GOVERSION="`sed -n "s/%global go_version //p" openbao.spec`"
2929
GOURL="`sed -n "s/^Source2: //p" openbao.spec|sed "s/%{go_version}/$GOVERSION/"`"
30-
wget "$GOURL"
30+
if [ -n "$GOURL" ]; then
31+
wget "$GOURL"
32+
fi
3133
# eliminate the "dist" part in the rpm name, for the release assets
3234
rpmbuild -D "dist %{nil}" -D "_topdir $PWD" -D "_sourcedir $PWD" -D "_srcrpmdir $PWD" -D "_rpmdir $PWD" -ba openbao.spec
3335
mv $(arch)/* .

goversion.patch

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/.go-version b/.go-version
2+
index 7a429d68a3..2f4320f67f 100644
3+
--- a/.go-version
4+
+++ b/.go-version
5+
@@ -1 +1 @@
6+
-1.24.6
7+
+1.24.4
8+
diff --git a/go.mod b/go.mod
9+
index 85f7d5a9b8..682261e3cd 100644
10+
--- a/go.mod
11+
+++ b/go.mod
12+
@@ -9,7 +9,7 @@ module github.com/openbao/openbao
13+
// updated. If we choose not to do so at some point (e.g. because we don't want some new
14+
// semantic related to Go module handling), this comment should be updated to explain that.
15+
16+
-go 1.24.6
17+
+go 1.24.4
18+
19+
replace github.com/openbao/openbao/api/v2 => ./api
20+

make-spec

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ fi
1212
# is OK. Otherwise if it is more than 2 seconds newer than the .in
1313
# most likely it was edited after git checkout.
1414
if [ -w openbao.spec ]; then
15-
INTIME="`stat -c '%Y' $PKG.spec.in`"
16-
OUTTIME="`stat -c '%Y' $PKG.spec`"
15+
INTIME="$(stat -c '%Y' $PKG.spec.in)"
16+
OUTTIME="$(stat -c '%Y' $PKG.spec)"
1717
if (( $OUTTIME >= $INTIME + 2 )); then
1818
echo "$PKG.spec is newer than $PKG.spec.in -- was it accidentally edited?" >&2
1919
exit 2
2020
fi
2121
fi
22-
VERSION="`sed -n 's/^Version:[ \t]*//p' $PKG.spec.in|sed 's/~/-/'`"
22+
VERSION="$(sed -n 's/^Version:[ \t]*//p' $PKG.spec.in|sed 's/~/-/')"
2323
GOMOD=/tmp/go.mod.$$
2424
trap "rm -f $GOMOD" 0
2525
URL="https://raw.githubusercontent.com/$ORG/$PKG/refs/tags/v$VERSION/go.mod"
@@ -32,8 +32,12 @@ while IFS='' read -r LINE; do
3232
if [[ "$LINE" = *"bundled provides" ]]; then
3333
awk '{if (index($1, "/") != 0 && ($1 != "//")) {print "Provides: bundled(golang("$1")) = "$2}}' $GOMOD | sed -e 's/-/_/g' | sort | uniq
3434
elif [[ "$LINE" = *"@GOVERSION@"* ]]; then
35-
URL="https://raw.githubusercontent.com/$ORG/$PKG/refs/tags/v$VERSION/.go-version"
36-
GOVERSION="`curl -sSL -f -m 15 $URL`"
35+
if [ -f goversion.patch ]; then
36+
GOVERSION="$(sed -n 's/^\+go //p' goversion.patch)"
37+
else
38+
URL="https://raw.githubusercontent.com/$ORG/$PKG/refs/tags/v$VERSION/.go-version"
39+
GOVERSION="$(curl -sSL -f -m 15 $URL)"
40+
fi
3741
echo "$LINE" | sed "s/@GOVERSION@/$GOVERSION/"
3842
else
3943
echo "$LINE"

openbao.spec

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# For example, it should have a dash instead of tilde for release candidates.
55
%global package_version 2.3.2
66

7-
%global go_version 1.24.6
7+
%global go_version 1.24.4
88

99
%global oldname vault
1010

@@ -17,12 +17,18 @@ Summary: A tool for securely accessing secrets
1717
License: MPL-2.0
1818
Source0: https://github.com/opensciencegrid/%{name}-rpm/releases/download/v%{package_version}/%{name}-rpm-%{package_version}.tar.gz
1919
Source1: https://github.com/openbao/%{name}/releases/download/v%{package_version}/%{name}-dist-%{package_version}.tar.xz
20-
Source2: https://golang.org/dl/go%{go_version}.src.tar.gz
20+
Patch0: goversion.patch
2121

2222
BuildRequires: golang
2323
BuildRequires: systemd-rpm-macros
2424
URL: https://openbao.org
2525

26+
%if "%{?osg}" != ""
27+
Provides: %{name}-%{oldname}-compat = %{version}-%{release}
28+
Provides: %{oldname} = %{version}-%{release}
29+
Obsoletes: %{oldname} < 2.0
30+
%endif
31+
2632
Provides: bundled(golang(cel.dev/expr)) = v0.24.0
2733
Provides: bundled(golang(cloud.google.com/go)) = v0.116.0
2834
Provides: bundled(golang(cloud.google.com/go/auth)) = v0.14.1
@@ -383,6 +389,7 @@ can access an encrypted Key/Value store and network encryption-as-a-service, or
383389
generate AWS IAM/STS credentials, SQL/NoSQL databases, X.509 certificates, SSH
384390
credentials, and more.
385391

392+
%if "%{?osg}" == ""
386393
%package %{oldname}-compat
387394
Summary: Vault-compatible command and service
388395
Requires: %{name} = %{version}-%{release}
@@ -392,29 +399,22 @@ Obsoletes: %{oldname} < 2.0
392399
%description %{oldname}-compat
393400
Provides a compatibility layer on top of OpenBao to emulate a Hashicorp
394401
Vault package.
402+
%endif
395403

396404
%prep
397405
%setup -q -n %{name}-rpm-%{package_version}
398-
RPMDIR=`pwd`
406+
RPMDIR=$(pwd)
399407
%setup -q -T -b 1 -n %{name}-dist-%{package_version}
400-
# put go src inside the above dir
401-
%setup -q -D -T -a 2 -c -n %{name}-dist-%{package_version}
408+
%autopatch
402409

403410
%build
404411
# starts out in %%{name}-dist-%%{package_version} directory
405-
cd go/src
406-
./make.bash
407-
cd ../..
408-
export PATH=$PWD/go/bin:$PATH
412+
409413
# this prevents it from complaining that ui assets are too old
410414
touch http/web_ui/index.html
411415

412416
uname_m=$(uname -m)
413-
if [ "$uname_m" = ppc64le ]; then
414-
GO_BUILD_MODE="-buildmode default"
415-
else
416-
GO_BUILD_MODE="-buildmode pie"
417-
fi
417+
GO_BUILD_MODE="-buildmode pie"
418418
GO_BUILD_GCFLAGS=
419419
GO_BUILD_LDFLAGS="-X github.com/%{name}/%{name}/version.fullVersion=%{version}-%{release}"
420420
GO_BUILD_LDFLAGS+=" -X github.com/%{name}/%{name}/version.GitCommit="
@@ -485,7 +485,9 @@ cp %{name}.conf %{buildroot}%{_sysusersdir}/%{name}.conf
485485
%doc README.md
486486
%doc CHANGELOG.md
487487

488+
%if "%{?osg}" == ""
488489
%files %{oldname}-compat
490+
%endif
489491
%{_bindir}/%{oldname}
490492
%{_sysconfdir}/%{oldname}.d
491493
%{_sharedstatedir}/%{oldname}

openbao.spec.in

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@ Summary: A tool for securely accessing secrets
1717
License: MPL-2.0
1818
Source0: https://github.com/opensciencegrid/%{name}-rpm/releases/download/v%{package_version}/%{name}-rpm-%{package_version}.tar.gz
1919
Source1: https://github.com/openbao/%{name}/releases/download/v%{package_version}/%{name}-dist-%{package_version}.tar.xz
20-
Source2: https://golang.org/dl/go%{go_version}.src.tar.gz
20+
Patch0: goversion.patch
2121

2222
BuildRequires: golang
2323
BuildRequires: systemd-rpm-macros
2424
URL: https://openbao.org
2525

26+
%if "%{?osg}" != ""
27+
Provides: %{name}-%{oldname}-compat = %{version}-%{release}
28+
Provides: %{oldname} = %{version}-%{release}
29+
Obsoletes: %{oldname} < 2.0
30+
%endif
31+
2632
# This line gets replaced by bundled provides
2733

2834
%description
@@ -33,6 +39,7 @@ can access an encrypted Key/Value store and network encryption-as-a-service, or
3339
generate AWS IAM/STS credentials, SQL/NoSQL databases, X.509 certificates, SSH
3440
credentials, and more.
3541

42+
%if "%{?osg}" == ""
3643
%package %{oldname}-compat
3744
Summary: Vault-compatible command and service
3845
Requires: %{name} = %{version}-%{release}
@@ -42,29 +49,22 @@ Obsoletes: %{oldname} < 2.0
4249
%description %{oldname}-compat
4350
Provides a compatibility layer on top of OpenBao to emulate a Hashicorp
4451
Vault package.
52+
%endif
4553

4654
%prep
4755
%setup -q -n %{name}-rpm-%{package_version}
48-
RPMDIR=`pwd`
56+
RPMDIR=$(pwd)
4957
%setup -q -T -b 1 -n %{name}-dist-%{package_version}
50-
# put go src inside the above dir
51-
%setup -q -D -T -a 2 -c -n %{name}-dist-%{package_version}
58+
%autopatch
5259

5360
%build
5461
# starts out in %%{name}-dist-%%{package_version} directory
55-
cd go/src
56-
./make.bash
57-
cd ../..
58-
export PATH=$PWD/go/bin:$PATH
62+
5963
# this prevents it from complaining that ui assets are too old
6064
touch http/web_ui/index.html
6165

6266
uname_m=$(uname -m)
63-
if [ "$uname_m" = ppc64le ]; then
64-
GO_BUILD_MODE="-buildmode default"
65-
else
66-
GO_BUILD_MODE="-buildmode pie"
67-
fi
67+
GO_BUILD_MODE="-buildmode pie"
6868
GO_BUILD_GCFLAGS=
6969
GO_BUILD_LDFLAGS="-X github.com/%{name}/%{name}/version.fullVersion=%{version}-%{release}"
7070
GO_BUILD_LDFLAGS+=" -X github.com/%{name}/%{name}/version.GitCommit="
@@ -135,7 +135,9 @@ cp %{name}.conf %{buildroot}%{_sysusersdir}/%{name}.conf
135135
%doc README.md
136136
%doc CHANGELOG.md
137137

138+
%if "%{?osg}" == ""
138139
%files %{oldname}-compat
140+
%endif
139141
%{_bindir}/%{oldname}
140142
%{_sysconfdir}/%{oldname}.d
141143
%{_sharedstatedir}/%{oldname}

0 commit comments

Comments
 (0)