Use vendored dependencies for RHEL

This commit is contained in:
Yaakov Selkowitz 2022-12-21 00:22:14 -05:00
parent 9dc23837ed
commit 46d2ca508e
4 changed files with 48 additions and 3 deletions

1
.gitignore vendored
View File

@ -28,3 +28,4 @@
/toolbox-0.0.99.2^2.git40fbd377ed0b.tar.xz /toolbox-0.0.99.2^2.git40fbd377ed0b.tar.xz
/toolbox-0.0.99.2^3.git075b9a8d2779.tar.xz /toolbox-0.0.99.2^3.git075b9a8d2779.tar.xz
/toolbox-0.0.99.3.tar.xz /toolbox-0.0.99.3.tar.xz
/toolbox-0.0.99.3-vendor.tar.xz

27
gen-vendor-tarball.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
# Process a toolbox tarball to get vendored dependencies for the RHEL build.
#
# Yaakov Selkowitz <yselkowi@redhat.com> - 2022
SOURCE="$1"
DIRECTORY=`echo $SOURCE | sed 's/\.tar\.xz//'`
VENDOR_SOURCE="${DIRECTORY}-vendor.tar.xz"
error()
{
MESSAGE=$1
echo $MESSAGE
exit 1
}
rm -rf $DIRECTORY
tar xJf $SOURCE || error "Cannot unpack $SOURCE"
pushd $DIRECTORY/src > /dev/null || error "Cannot open directory \"$DIRECTORY\""
echo "Vendoring dependencies"
go mod vendor || error "Vendoring failed"
popd > /dev/null
tar cJf $VENDOR_SOURCE -C $DIRECTORY src/vendor || error "Unable to create $VENDOR_SOURCE"
echo "$VENDOR_SOURCE is ready to use"

View File

@ -1 +1,2 @@
SHA512 (toolbox-0.0.99.3.tar.xz) = d9e4bd1cc7667b6ecdcf25a2c3ad7d7d67cc997168a41e668c936d2de24db774331a78a1b4a06b63e7cef8e0dc4ac5651591b6d9cec0d8e81be2b2dd64854dca SHA512 (toolbox-0.0.99.3.tar.xz) = d9e4bd1cc7667b6ecdcf25a2c3ad7d7d67cc997168a41e668c936d2de24db774331a78a1b4a06b63e7cef8e0dc4ac5651591b6d9cec0d8e81be2b2dd64854dca
SHA512 (toolbox-0.0.99.3-vendor.tar.xz) = 51ce5a16276ccc75d2b6fb9cae1c4371ad028f6a820cd176a4a0ee85fab447a6b37b5ec2e969b882c4f04cfe58bd78f92975606297a0db22e72457f012102ec2

View File

@ -6,12 +6,16 @@ Version: 0.0.99.3
%global goipath github.com/containers/%{name} %global goipath github.com/containers/%{name}
%gometa %gometa
Release: 7%{?dist} Release: 8%{?dist}
Summary: Tool for containerized command line environments on Linux Summary: Tool for containerized command line environments on Linux
License: ASL 2.0 License: ASL 2.0
URL: https://containertoolbx.org/ URL: https://containertoolbx.org/
Source0: https://github.com/containers/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz Source0: https://github.com/containers/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz
# RHEL package is built with vendored dependencies
# created with gen-vendor-tarball.sh from SOURCE2
Source1: %{name}-%{version}-vendor.tar.xz
Source2: gen-vendor-tarball.sh
# Fedora specific # Fedora specific
Patch100: toolbox-Don-t-use-Go-s-semantic-import-versioning.patch Patch100: toolbox-Don-t-use-Go-s-semantic-import-versioning.patch
@ -22,6 +26,7 @@ Patch103: toolbox-cmd-root-Work-around-Cobra-1.1.2-s-handling-of-usage.patc
BuildRequires: ShellCheck BuildRequires: ShellCheck
BuildRequires: go-md2man BuildRequires: go-md2man
BuildRequires: golang >= 1.13 BuildRequires: golang >= 1.13
%if ! 0%{?rhel}
BuildRequires: golang(github.com/HarryMichal/go-version) BuildRequires: golang(github.com/HarryMichal/go-version)
BuildRequires: golang(github.com/acobaugh/osrelease) BuildRequires: golang(github.com/acobaugh/osrelease)
BuildRequires: golang(github.com/briandowns/spinner) >= 1.10.0 BuildRequires: golang(github.com/briandowns/spinner) >= 1.10.0
@ -35,6 +40,7 @@ BuildRequires: golang(github.com/spf13/cobra) >= 0.0.5
BuildRequires: golang(github.com/spf13/viper) >= 1.3.2 BuildRequires: golang(github.com/spf13/viper) >= 1.3.2
BuildRequires: golang(golang.org/x/crypto/ssh/terminal) BuildRequires: golang(golang.org/x/crypto/ssh/terminal)
BuildRequires: golang(golang.org/x/sys/unix) BuildRequires: golang(golang.org/x/sys/unix)
%endif
BuildRequires: meson >= 0.58.0 BuildRequires: meson >= 0.58.0
BuildRequires: pkgconfig(bash-completion) BuildRequires: pkgconfig(bash-completion)
BuildRequires: systemd-rpm-macros BuildRequires: systemd-rpm-macros
@ -138,8 +144,10 @@ The %{name}-tests package contains system tests for %{name}.
%prep %prep
%setup -q %setup -q %{?rhel:-a 1}
%if ! 0%{?rhel}
%patch100 -p1 %patch100 -p1
%endif
%ifnarch ppc64 %ifnarch ppc64
%patch101 -p1 %patch101 -p1
@ -147,7 +155,9 @@ The %{name}-tests package contains system tests for %{name}.
%patch102 -p1 %patch102 -p1
%endif %endif
%if ! 0%{?rhel}
%patch103 -p1 %patch103 -p1
%endif
%gomkdir %gomkdir
@ -158,6 +168,9 @@ export GOPATH=%{gobuilddir}:%{gopath}
export CGO_CFLAGS="%{optflags} -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" export CGO_CFLAGS="%{optflags} -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
ln -s src/cmd cmd ln -s src/cmd cmd
ln -s src/pkg pkg ln -s src/pkg pkg
%if 0%{?rhel}
ln -s src/vendor vendor
%endif
%meson --buildtype=plain -Dprofile_dir=%{_sysconfdir}/profile.d -Dtmpfiles_dir=%{_tmpfilesdir} %meson --buildtype=plain -Dprofile_dir=%{_sysconfdir}/profile.d -Dtmpfiles_dir=%{_tmpfilesdir}
%meson_build %meson_build
@ -172,7 +185,7 @@ ln -s src/pkg pkg
%files %files
%doc CODE-OF-CONDUCT.md NEWS README.md SECURITY.md %doc CODE-OF-CONDUCT.md NEWS README.md SECURITY.md
%license COPYING %license COPYING %{?rhel:src/vendor/modules.txt}
%{_bindir}/%{name} %{_bindir}/%{name}
%{_datadir}/bash-completion %{_datadir}/bash-completion
%{_mandir}/man1/%{name}.1* %{_mandir}/man1/%{name}.1*
@ -190,6 +203,9 @@ ln -s src/pkg pkg
%changelog %changelog
* Thu Dec 22 2022 Yaakov Selkowitz <yselkowi@redhat.com> - 0.0.99.3-8
- Use vendored dependencies for RHEL/ELN builds
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.99.3-7 * Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.99.3-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild