mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Cleaning up odo rpm spec and scripts (#3904)
* Fixing rpm spec Provides and Obsoletes to be more specific Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com> * Fixing local build script to use dist/rpmbuild and topdir for build - This prevents polluting users main rpmbuild Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com> * Setting goflags during `make test` and turning off missing buildid - without goflags, unit tests take a while as they dont use vendor - providing -mod=vendor does not seem to help - missing gnu build ids in go binaries can cause warnings Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com> * Removing GOFLAGS from spec and adding build_flags to test target Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com> * Unsetting any goflags for make test in openshift ci Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com> * Removing the set +x from local build script Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com> * Adding rpm tests Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com> * Removing last rm -rf Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com> * Reverting to explicitly setting GOFLAGS for make test - It appears that while `-mod=vendor` flag is available for `go test` it is sometimes not respected - It is therefore, better to just set GOFLAGS only for make test - More investigation is needed to find better solution, but we should not break stuff relation to testing and release, where we should not be pulling from outside world Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com> * Cleaning up rpm-prepare Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com> * Removing unnessasary newline Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com> * Adding version file to spec for any future automation to have easier time Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
%global source_dir openshift-odo-%{odo_version}-%{odo_release}
|
||||
%global source_tar %{source_dir}.tar.gz
|
||||
%global gopath %{_builddir}/gocode
|
||||
%global _missing_build_ids_terminate_build 0
|
||||
|
||||
Name: %{package_name}
|
||||
Version: %{odo_version}
|
||||
@@ -23,8 +24,8 @@ URL: https://github.com/openshift/odo/tree/%{odo_cli_version}
|
||||
Source0: %{source_tar}
|
||||
BuildRequires: gcc
|
||||
BuildRequires: golang >= %{golang_version}
|
||||
Provides: %{package_name}
|
||||
Obsoletes: %{package_name}
|
||||
Provides: %{package_name} = %{odo_version}
|
||||
Obsoletes: %{package_name} <= %{odo_version}
|
||||
|
||||
%description
|
||||
odo is a fast, iterative, and straightforward CLI tool for developers who write, build, and deploy applications on OpenShift.
|
||||
@@ -40,11 +41,11 @@ export GOPATH=%{gopath}
|
||||
cd %{gopath}/src/github.com/openshift/odo
|
||||
%ifarch x86_64
|
||||
# go test -race is not supported on all arches
|
||||
make test
|
||||
GOFLAGS='-mod=vendor' make test
|
||||
%endif
|
||||
make prepare-release
|
||||
echo "%{odo_version}" > dist/release/VERSION
|
||||
unlink %{gopath}/src/github.com/openshift/odo
|
||||
rm -rf %{gopath}
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}/%{_bindir}
|
||||
@@ -59,7 +60,7 @@ install -p -m 755 dist/release/odo-darwin-amd64 %{buildroot}%{_datadir}/%{name}-
|
||||
install -p -m 755 dist/release/odo-windows-amd64.exe %{buildroot}%{_datadir}/%{name}-redistributable/odo-windows-amd64.exe
|
||||
cp -avrf dist/release/odo*.tar.gz %{buildroot}%{_datadir}/%{name}-redistributable
|
||||
cp -avrf dist/release/SHA256_SUM %{buildroot}%{_datadir}/%{name}-redistributable
|
||||
|
||||
cp -avrf dist/release/VERSION %{buildroot}%{_datadir}/%{name}-redistributable
|
||||
|
||||
%files
|
||||
%license LICENSE
|
||||
@@ -69,8 +70,8 @@ cp -avrf dist/release/SHA256_SUM %{buildroot}%{_datadir}/%{name}-redistributable
|
||||
Summary: %{product_name} client CLI binaries for Linux, macOS and Windows
|
||||
BuildRequires: gcc
|
||||
BuildRequires: golang >= %{golang_version}
|
||||
Provides: %{package_name}-redistributable
|
||||
Obsoletes: %{package_name}-redistributable
|
||||
Provides: %{package_name}-redistributable = %{odo_version}
|
||||
Obsoletes: %{package_name}-redistributable <= %{odo_version}
|
||||
|
||||
%description redistributable
|
||||
%{product_name} client odo cross platform binaries for Linux, macOS and Windows.
|
||||
@@ -91,3 +92,4 @@ Obsoletes: %{package_name}-redistributable
|
||||
%{_datadir}/%{name}-redistributable/odo-windows-amd64.exe
|
||||
%{_datadir}/%{name}-redistributable/odo-windows-amd64.exe.tar.gz
|
||||
%{_datadir}/%{name}-redistributable/SHA256_SUM
|
||||
%{_datadir}/%{name}-redistributable/VERSION
|
||||
|
||||
@@ -19,3 +19,6 @@ make test
|
||||
# crosscompile and publish artifacts
|
||||
make cross
|
||||
cp -r dist $ARTIFACTS_DIR
|
||||
|
||||
# RPM Tests
|
||||
scripts/rpm-x86_64-test.sh
|
||||
|
||||
@@ -6,13 +6,6 @@ if [[ ! -d dist/rpmbuild ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Cleaning up old rpmcontent"
|
||||
rm -f ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
||||
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
||||
|
||||
echo "Copying content to local rpmbuild"
|
||||
cp -avrf dist/rpmbuild/SOURCES/* $HOME/rpmbuild/SOURCES/
|
||||
cp -avrf dist/rpmbuild/SPECS/* $HOME/rpmbuild/SPECS/
|
||||
|
||||
top_dir="`pwd`/dist/rpmbuild"
|
||||
echo "Building locally"
|
||||
rpmbuild -ba $HOME/rpmbuild/SPECS/openshift-odo.spec
|
||||
rpmbuild --define "_topdir `echo $top_dir`" -ba dist/rpmbuild/SPECS/openshift-odo.spec
|
||||
|
||||
@@ -37,17 +37,11 @@ NAME="openshift-odo-$ODO_RPM_VERSION-$ODO_RELEASE"
|
||||
echo "Making release for $NAME, git commit $GIT_COMMIT"
|
||||
|
||||
echo "Cleaning up old content"
|
||||
if [[ -d $DIST_DIR ]]; then
|
||||
rm -rf $DIST_DIR
|
||||
fi
|
||||
if [[ -d $FINAL_OUT_DIR ]]; then
|
||||
rm -rf $FINAL_OUT_DIR
|
||||
fi
|
||||
rm -rf $DIST_DIR
|
||||
rm -rf $FINAL_OUT_DIR
|
||||
|
||||
echo "Configuring output directory $OUT_DIR"
|
||||
if [[ -d $OUT_DIR ]]; then
|
||||
rm -rf $OUT_DIR
|
||||
fi
|
||||
rm -rf $OUT_DIR
|
||||
mkdir -p $SPEC_DIR
|
||||
mkdir -p $SOURCES_DIR/$NAME
|
||||
mkdir -p $FINAL_OUT_DIR
|
||||
@@ -61,17 +55,13 @@ cp -arf ./* $SOURCES_DIR/$NAME
|
||||
pushd $SOURCES_DIR
|
||||
pushd $NAME
|
||||
# Remove bin if it exists, we dont need it in tarball
|
||||
if [[ -f ./odo ]]; then
|
||||
rm -rf ./odo
|
||||
fi
|
||||
rm -rf ./odo
|
||||
popd
|
||||
|
||||
# Create tarball
|
||||
tar -czf $NAME.tar.gz $NAME
|
||||
# Removed copied content
|
||||
if [[ -d $NAME ]]; then
|
||||
rm -rf $NAME
|
||||
fi
|
||||
rm -rf $NAME
|
||||
popd
|
||||
|
||||
echo "Finalizing..."
|
||||
|
||||
31
scripts/rpm-x86_64-test.sh
Executable file
31
scripts/rpm-x86_64-test.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "Preping rpm"
|
||||
scripts/rpm-prepare.sh
|
||||
|
||||
echo "Building rpm"
|
||||
scripts/rpm-local-build.sh
|
||||
|
||||
rm -rf dist/rpmtest
|
||||
mkdir -p dist/rpmtest/{odo,redistributable}
|
||||
|
||||
echo "Validating odo rpm"
|
||||
rpm2cpio dist/rpmbuild/RPMS/x86_64/`ls dist/rpmbuild/RPMS/x86_64/ | grep -v redistributable` > dist/rpmtest/odo/odo.cpio
|
||||
pushd dist/rpmtest/odo
|
||||
cpio -idv < odo.cpio
|
||||
ls ./usr/bin | grep odo
|
||||
./usr/bin/odo version
|
||||
popd
|
||||
|
||||
RL="odo-darwin-amd64 odo-linux-ppc64le odo-linux-arm64 odo-windows-amd64.exe odo-linux-amd64 odo-linux-s390x"
|
||||
echo "Validating odo-redistributable rpm"
|
||||
rpm2cpio dist/rpmbuild/RPMS/x86_64/`ls dist/rpmbuild/RPMS/x86_64/ | grep redistributable` > dist/rpmtest/redistributable/odo-redistribuable.cpio
|
||||
pushd dist/rpmtest/redistributable
|
||||
cpio -idv < odo-redistribuable.cpio
|
||||
for i in $RL; do
|
||||
ls ./usr/share/odo-redistributable | grep $i
|
||||
done
|
||||
./usr/share/odo-redistributable/odo-linux-amd64 version
|
||||
popd
|
||||
Reference in New Issue
Block a user