Use dots in version
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-win (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run

This commit is contained in:
Andrea Mazzoleni 2026-02-24 11:34:31 +01:00
parent 8639c8b479
commit 41e67f8beb
5 changed files with 25 additions and 40 deletions

View file

@ -21,7 +21,6 @@
set -euo pipefail
VERSION=@PACKAGE_VERSION@
VERSION_UNDERSCORE=@PACKAGE_VERSION_UNDERSCORE@
SPEC_FILE="@PACKAGE@.spec"
if [[ ! -f "pkg/$SPEC_FILE" ]]; then
@ -55,41 +54,16 @@ else
echo "$TARBALL already present in ~/rpmbuild/SOURCES"
fi
ORIGINAL_TARBALL="$RPMBUILD_DIR/SOURCES/@PACKAGE@-${VERSION}.tar.gz"
UNDERSCORE_TARBALL="$RPMBUILD_DIR/SOURCES/@PACKAGE@-${VERSION_UNDERSCORE}.tar.gz"
if [[ "$VERSION" == "$VERSION_UNDERSCORE" ]]; then
echo "Version does not contain '-', no repack needed."
else
if [[ ! -f "$UNDERSCORE_TARBALL" ]]; then
echo "Repacking tarball with underscore version..."
WORKDIR=$(mktemp -d)
tar -xzf "$ORIGINAL_TARBALL" -C "$WORKDIR"
mv "$WORKDIR/@PACKAGE@-${VERSION}" \
"$WORKDIR/@PACKAGE@-${VERSION_UNDERSCORE}"
tar -czf "$UNDERSCORE_TARBALL" -C "$WORKDIR" \
"@PACKAGE@-${VERSION_UNDERSCORE}"
rm -rf "$WORKDIR"
else
echo "Underscore tarball already exists."
fi
fi
# Copy spec file to SPECS directory (preserving the original filename)
cp "pkg/$SPEC_FILE" "$RPMBUILD_DIR/SPECS/"
echo "Building RPMs using rpmbuild -ba..."
rpmbuild -ba --nodeps --nocheck "$RPMBUILD_DIR/SPECS/$SPEC_FILE"
cp $RPMBUILD_DIR/RPMS/*/@PACKAGE@-${VERSION_UNDERSCORE}*.rpm .
cp $RPMBUILD_DIR/RPMS/*/@PACKAGE@-${VERSION}*.rpm .
echo "Package created: $RPMBUILD_DIR/RPMS/@PACKAGE@-${VERSION_UNDERSCORE}*.rpm"
echo "Package created: $RPMBUILD_DIR/RPMS/@PACKAGE@-${VERSION}*.rpm"
echo ""
echo "You can install the RPM with:"
echo " sudo dnf install @PACKAGE@-${VERSION_UNDERSCORE}*.rpm # Fedora"
echo " sudo rpm -ivh @PACKAGE@-${VERSION_UNDERSCORE}*.rpm # Others"
echo " sudo dnf install @PACKAGE@-${VERSION}*.rpm # Fedora"
echo " sudo rpm -ivh @PACKAGE@-${VERSION}*.rpm # Others"