# GOLANG # https://docs.fedoraproject.org/en-US/packaging-guidelines/Golang/ # https://docs.fedoraproject.org/en-US/quick-docs/publish-rpm-on-copr # http://ftp.rpm.org/max-rpm/s1-rpm-inside-scripts.html # https://rpm-software-management.github.io/rpm/manual/macros.html # https://rpm-packaging-guide.github.io/ %global _owner pgnd %global _build_timestamp %( date +%%Y%%m%%d_%%H%%M%%S --utc ) %global _dist .%{_build_timestamp}.%{_owner}.fc%{fedora} # https://stackoverflow.com/questions/47838041/rpmbuild-how-to-disable-check-buildroot # https://rpm-software-management.github.io/rpm/manual/dependency_generators.html # %%global __spec_install_pre /bin/true # %%global __arch_install_post %%{nil} %global __os_install_post %%{nil} %global _disable_source_fetch 0 %global debug_package %{nil} # %%undefine _auto_set_build_flags %global _hardened_build 1 %global __brp_mangle_shebangs %%{nil} %global __brp_strip %%{nil} # %%global __requires_exclude ^.*/xxx/bin/python.*$ # %%global __requires_exclude_from ^.*/xxx/bin/python.*$ # RHEL8 rpmbuild and /usr/lib/.build-id # https://access.redhat.com/discussions/5045161 %global _build_id_links none # %%bcond_with XXX : opt build with XXX; default, without # %%bcond_without XXX : opt build without XXX; default, with # OPENBAO # https://openbao.org/ # https://github.com/openbao/openbao # https://openbao.org/docs/install/#compiling-from-source # # goreleaser? # Update of RPM package overwrites existing configuration files # https://github.com/openbao/openbao/issues/599 # https://github.com/opensciencegrid/vault-rpm/blob/master/vault.spec %global _bao_name openbao %global _bao_pkgnm openbao %global _bao_unitnm openbao %global _bao_comment OpenBao identity-based secrets and encryption management system %global _bao_descrip %{expand: %{_bao_comment}.} # https://spdx.org/licenses/MPL-2.0.html %global _bao_license MPL-2.0 # https://docs.fedoraproject.org/en-US/packaging-guidelines/SourceURL/ %global _bao_scm_repo openbao/openbao %global _bao_scm_branch main # %%global _bao_scm_branch release/2.1.x %global _bao_scm_repo_esc %( echo %{_bao_scm_repo} | sed 's|_|-|g' | sed 's|/|%2F|g') %global _bao_scm_repo_norm %( echo %{_bao_scm_repo} | sed 's|_|-|g' | sed 's|/|-|g' ) %global _bao_scm_branch_norm %( echo %{_bao_scm_branch} | sed 's|_|-|g' | sed 's|/|-|g' ) %global _bao_scm_host https://github.com %global _bao_scm_host_api https://api.github.com/repos %global _bao_scm_url %{_bao_scm_host}/%{_bao_scm_repo} %global _bao_scm_tarball %{_bao_scm_host_api}/%{_bao_scm_repo}/tarball/%{commit0} # !!NOTE!! GH API tarball extracts to: %global _bao_scm_extract_dir %{_bao_scm_repo_norm}-%{shortcommit0} %global forgeurl0 %{_bao_scm_url} %global commit0 %( git ls-remote %{forgeurl0} | grep /%{_bao_scm_branch}$ | cut -f1 ) %global shortcommit0 %( c=%{commit0}; echo ${c} | head -c 7 ) %global forgesource0 %{_bao_scm_tarball} %global extractdir0 %{_bao_scm_extract_dir} %global forgesetupargs0 -T -D -b 0 -n %{extractdir0} %global goipath github.com/%{_bao_scm_repo} # %%global goaltipaths github %forgemeta -i -a %global dist %{_dist} # Vendor Pinning Vendor: %{_owner} # NEVRA (n-e:v-r.a) Name: %{_bao_pkgnm} Epoch: 3 # https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/ Version: %{scm0}_%( echo %{_bao_scm_branch} | sed 's|[/-]|_|g' ) Release: 0%{?dist} # https://blog.jasonantman.com/2014/07/how-yum-and-rpm-compare-versions/ %global _same_evr %{epoch}:%{version}-%{release} Summary: %{_bao_comment} License: %{_bao_license} URL: %{forgeurl0} Source0: %{forgesource0} # https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets # https://docs.pagure.org/packaging-guidelines/Packaging:Scriptlets.html BuildRequires: golang BuildRequires: bash %description %{_bao_descrip} %prep echo '##### STARTING PREP #####' %forgesetup -a %build echo '##### STARTING BUILD #####' cd %{_builddir}/%{extractdir0} mkdir -p %{buildroot}%{_bindir} export GOPATH=%{_builddir}/GOPATH mkdir -p ${GOPATH}/src mkdir -p ${GOPATH}/bin export PATH=${GOPATH}/bin:$PATH export GOPROXY=https://proxy.golang.org,direct export GOSUMDB=sum.golang.org export CGO_ENABLED=1 # this prevents the build from trying to use git to figure out the version # which fails because there's no git info ln -s /bin/true ${GOPATH}/bin/git echo '##### WHATS HERE 1 #####' pwd echo %{buildroot}%{_bindir} # CHANGELOG # core: Bump to latest Go toolchain 1.23.5. [GH-912] go env -w GOTOOLCHAIN=go1.23.5+auto go mod tidy #go mod vendor #go build -mod=vendor -o %%{gobuilddir}/bin/openbao . make bootstrap make dev %install echo '##### STARTING INSTALL #####' cd %{_builddir}/%{extractdir0} echo "WHAT'S HERE 0" echo "GOBUILDDIR %{gobuilddir}" find %{gobuilddir} | grep "bin/openbao" find %{_builddir} | grep "bin/openbao" find ${RPM_BUILD_ROOT} | grep "bin/openbao" mkdir -p ${RPM_BUILD_ROOT}/%{_bindir} mkdir -p ${RPM_BUILD_ROOT}/%{_datadir}/openbao/vendor install -m 0755 -v %{gobuilddir}/bin/openbao ${RPM_BUILD_ROOT}/%{_bindir}/ ln -sf /usr/bin/openbao ${RPM_BUILD_ROOT}/%{_bindir}/bao #cp -r vendor ${RPM_BUILD_ROOT}/%%{_datadir}/openbao/vendor/ mkdir -p ${RPM_BUILD_ROOT}/%{_bindir} %pre %post -e %preun %postun %files # %%license LICENSE # %%doc CHANGELOG.md README.md scripts/changelog.sh %{_bindir}/openbao %{_bindir}/bao # %%{_datadir}/openbao/vendor %changelog * Fri Jan 24 2025 pgnd _ - bump 1737762767