build_rpm now uses local rpmbuild directory

This commit is contained in:
Imbus 2024-06-10 12:10:06 +02:00
parent a262510dc7
commit 368f29324a

View file

@ -15,6 +15,29 @@
version=0.1.0 version=0.1.0
name=SolutionTM name=SolutionTM
rpmbuild=$PWD/rpmbuild
mkdir -p $rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo "Building RPM package for $name version $version."
# Check so that all versions are coherent
grep -q "Version:.*$version" $name.spec
if [ $? -eq 0 ]; then
echo "Version number in spec file is $version."
else
echo "Version number in spec file is not $version. Exiting."
exit 1
fi
grep -q "version = \"$version\"" Cargo.toml
if [ $? -eq 0 ]; then
echo "Version number in Cargo.toml is $version."
else
echo "Version number in Cargo.toml is not $version. Exiting."
exit 1
fi
source_tar=$name-$version.tar.gz source_tar=$name-$version.tar.gz
vendor_tar=$name-$version-vendor.tar.gz vendor_tar=$name-$version-vendor.tar.gz
@ -25,11 +48,11 @@ git archive --format=tar.gz --prefix=$name-$version/ -o SolutionTM-$version.tar.
# git ls-files | tar --transform='s,^,$name-$version/,' -T - -czf $source_tar # git ls-files | tar --transform='s,^,$name-$version/,' -T - -czf $source_tar
# Then we need a vendor tarball of the dependencies. # Then we need a vendor tarball of the dependencies.
cargo vendor --versioned-dirs --offline vendor cargo vendor --versioned-dirs vendor
tar -cvzf $vendor_tar vendor tar -cvzf $vendor_tar vendor
# Then we move the tarball to the SOURCES directory. # Then we move the tarball to the SOURCES directory.
mv $source_tar ~/rpmbuild/SOURCES/ mv $source_tar $rpmbuild/SOURCES/
mv $vendor_tar ~/rpmbuild/SOURCES/ mv $vendor_tar $rpmbuild/SOURCES/
rpmbuild -ba $name.spec rpmbuild --define "_topdir $rpmbuild" -ba $name.spec