From 41e67f8beb3c5c910f9c8a52718da7c427439adc Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Tue, 24 Feb 2026 11:34:31 +0100 Subject: [PATCH] Use dots in version --- autover.sh | 18 ++++++++++++------ configure.ac | 3 --- makerpm.sh.in | 34 ++++------------------------------ pkg/slack-desc | 8 ++++++++ pkg/snapraid.spec.in | 2 +- 5 files changed, 25 insertions(+), 40 deletions(-) diff --git a/autover.sh b/autover.sh index 27b7a2c3..8e94b2bb 100755 --- a/autover.sh +++ b/autover.sh @@ -1,24 +1,30 @@ #!/bin/sh # -if [ -d .git ]; then - # Get version from git tags, removing the 'v' prefix - VERSION=$(git describe --match 'v*' 2>/dev/null | sed 's/^v//') -fi - if [ -f .version ]; then # Get version from the .version file VERSION=$(cat .version) fi +if [ -z "$VERSION" ] && [ -d .git ]; then + # Get version from git tags, removing the 'v' prefix + VERSION=$(git describe --match 'v*' 2>/dev/null | sed 's/^v//') +fi + if [ -z "$VERSION" ] && [ -d .git ]; then # Fall back to short commit hash VERSION=0-$(git rev-parse --short HEAD 2>/dev/null) fi -if [ -z $VERSION ]; then +if [ -z "$VERSION" ]; then # No version, but still use a number VERSION="0" fi +# Apply common rules to all outputs: +# 1. Replace "rc-" with "rc" +# 2. Replace "beta-" with "beta" +# 3. Replace all remaining dashes with "+" +VERSION=$(echo "$VERSION" | sed 's/rc-/rc/g; s/beta-/beta/g; s/-/+/g') + printf '%s' "$VERSION" diff --git a/configure.ac b/configure.ac index 1eaedfec..22c5be3f 100644 --- a/configure.ac +++ b/configure.ac @@ -391,9 +391,6 @@ AC_ARG_VAR([TESTENV_SSSE3], [Test environment for SSSE3]) AC_ARG_VAR([TESTENV_SSE42], [Test environment for SSE42]) AC_ARG_VAR([TESTENV_AVX2], [Test environment for AVX2]) -PACKAGE_VERSION_UNDERSCORE=`echo "$PACKAGE_VERSION" | sed 's/-/_/g'` -AC_SUBST([PACKAGE_VERSION_UNDERSCORE]) - AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([pkg/snapraid.info pkg/control pkg/snapraid.spec]) AC_CONFIG_FILES([makeslackware.sh], [chmod a+x makeslackware.sh]) diff --git a/makerpm.sh.in b/makerpm.sh.in index 6438291c..42001131 100644 --- a/makerpm.sh.in +++ b/makerpm.sh.in @@ -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" diff --git a/pkg/slack-desc b/pkg/slack-desc index edec148d..b7030b10 100644 --- a/pkg/slack-desc +++ b/pkg/slack-desc @@ -1,3 +1,11 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| snapraid: snapraid (Disk array backup for many large rarely-changed files) snapraid: snapraid: SnapRAID is a backup program for disk arrays. It stores parity diff --git a/pkg/snapraid.spec.in b/pkg/snapraid.spec.in index 51f91583..b843b5ec 100644 --- a/pkg/snapraid.spec.in +++ b/pkg/snapraid.spec.in @@ -1,6 +1,6 @@ Name: @PACKAGE@ Summary: Disk array backup for many large rarely-changed files -Version: @PACKAGE_VERSION_UNDERSCORE@ +Version: @PACKAGE_VERSION@ Release: 1%{?dist} License: GPL-3.0-or-later Group: Applications/System