Remove curl fallback from packaging scripts and require local tarball

This commit is contained in:
Andrea Mazzoleni 2026-08-12 12:54:25 +02:00
parent cd4e06a215
commit bb1a08e950
4 changed files with 14 additions and 37 deletions

View file

@ -2,10 +2,6 @@
# #
# Script to build a Arch .pkg package for @PACKAGE_NAME@ # Script to build a Arch .pkg package for @PACKAGE_NAME@
# #
# This version:
# - Prefers a source tarball already present in the current directory
# - Only downloads it if not found locally
#
# Requirements: # Requirements:
# - Run as root (or with sudo) for proper ownership/permissions in package # - Run as root (or with sudo) for proper ownership/permissions in package
@ -13,7 +9,6 @@ set -euo pipefail
VERSION="@PACKAGE_VERSION@" VERSION="@PACKAGE_VERSION@"
TARBALL="@PACKAGE@-${VERSION}.tar.gz" TARBALL="@PACKAGE@-${VERSION}.tar.gz"
SOURCE_URL="https://github.com/amadvance/@PACKAGE@/releases/download/v${VERSION}/${TARBALL}"
PKG_NAME="@PACKAGE@" PKG_NAME="@PACKAGE@"
PKG_ROOT="${PKG_NAME}-arch-root" PKG_ROOT="${PKG_NAME}-arch-root"
@ -22,12 +17,9 @@ if [[ ! -f "pkg/.PKGINFO" ]]; then
exit 1 exit 1
fi fi
# Prefer local tarball if [[ ! -f "${TARBALL}" ]]; then
if [[ -f "./${TARBALL}" ]]; then echo "Error: ${TARBALL} not found in the current directory."
echo "Found ${TARBALL} locally." exit 1
else
echo "Downloading ${TARBALL}..."
curl -L -O "$SOURCE_URL"
fi fi
# Clean previous builds # Clean previous builds

View file

@ -14,17 +14,12 @@ set -euo pipefail
VERSION="@PACKAGE_VERSION@" VERSION="@PACKAGE_VERSION@"
TARBALL="@PACKAGE@-${VERSION}.tar.gz" TARBALL="@PACKAGE@-${VERSION}.tar.gz"
SOURCE_URL="https://github.com/amadvance/@PACKAGE@/releases/download/v${VERSION}/${TARBALL}"
PKG_NAME="@PACKAGE@" PKG_NAME="@PACKAGE@"
PKG_ROOT="${PKG_NAME}-deb-root" PKG_ROOT="${PKG_NAME}-deb-root"
CONTROL_FILE="${PKG_ROOT}/DEBIAN/control"
# Prefer local tarball if [[ ! -f "${TARBALL}" ]]; then
if [[ -f "./${TARBALL}" ]]; then echo "Error: ${TARBALL} not found in the current directory."
echo "Using local ${TARBALL}" exit 1
else
echo "Downloading ${TARBALL}..."
curl -L -O "$SOURCE_URL"
fi fi
# Clean previous builds # Clean previous builds

View file

@ -6,8 +6,6 @@
# #
# This version: # This version:
# - Works without rpmdevtools # - Works without rpmdevtools
# - Prefers a source tarball already present in the current directory
# - Only downloads it if not found locally
# #
# Requirements: # Requirements:
# - rpmbuild available # - rpmbuild available
@ -32,7 +30,6 @@ fi
echo "SnapRAID version: $VERSION" echo "SnapRAID version: $VERSION"
TARBALL="@PACKAGE@-${VERSION}.tar.gz" TARBALL="@PACKAGE@-${VERSION}.tar.gz"
SOURCE_URL="https://github.com/amadvance/@PACKAGE@/releases/download/v${VERSION}/${TARBALL}"
# Set up rpmbuild tree manually in ~/rpmbuild if it doesn't exist # Set up rpmbuild tree manually in ~/rpmbuild if it doesn't exist
RPMBUILD_DIR="$HOME/rpmbuild" RPMBUILD_DIR="$HOME/rpmbuild"
@ -43,15 +40,13 @@ else
echo "rpmbuild directory structure already exists in $RPMBUILD_DIR" echo "rpmbuild directory structure already exists in $RPMBUILD_DIR"
fi fi
# Look for the tarball first in the current directory, then in ~/rpmbuild/SOURCES # Look for the tarball in the current directory
if [[ -f "./$TARBALL" ]]; then if [[ -f "./$TARBALL" ]]; then
echo "Found $TARBALL in the current directory. Copying to ~/rpmbuild/SOURCES..." echo "Found $TARBALL in the current directory. Copying to ~/rpmbuild/SOURCES..."
cp "./$TARBALL" "$RPMBUILD_DIR/SOURCES/" cp "./$TARBALL" "$RPMBUILD_DIR/SOURCES/"
elif [[ ! -f "$RPMBUILD_DIR/SOURCES/$TARBALL" ]]; then
echo "Downloading $TARBALL (not found locally or in ~/rpmbuild/SOURCES)..."
curl -L -o "$RPMBUILD_DIR/SOURCES/$TARBALL" "$SOURCE_URL"
else else
echo "$TARBALL already present in ~/rpmbuild/SOURCES" echo "Error: $TARBALL not found in the current directory."
exit 1
fi fi
# Copy spec file to SPECS directory (preserving the original filename) # Copy spec file to SPECS directory (preserving the original filename)

View file

@ -4,8 +4,6 @@
# using the @PACKAGE@.SlackBuild and related files in the current directory. # using the @PACKAGE@.SlackBuild and related files in the current directory.
# #
# This version: # This version:
# - Prefers a source tarball already present in the current directory
# - Only downloads it if not found locally
# - Runs the SlackBuild (as root recommended for makepkg) # - Runs the SlackBuild (as root recommended for makepkg)
# #
# Requirements: # Requirements:
@ -15,7 +13,6 @@ set -euo pipefail
VERSION="@PACKAGE_VERSION@" VERSION="@PACKAGE_VERSION@"
TARBALL="@PACKAGE@-${VERSION}.tar.gz" TARBALL="@PACKAGE@-${VERSION}.tar.gz"
SOURCE_URL="https://github.com/amadvance/@PACKAGE@/releases/download/v${VERSION}/${TARBALL}"
if [[ ! -f "pkg/@PACKAGE@.SlackBuild" ]]; then if [[ ! -f "pkg/@PACKAGE@.SlackBuild" ]]; then
echo "Error: @PACKAGE@.SlackBuild not found in the current directory." echo "Error: @PACKAGE@.SlackBuild not found in the current directory."
@ -27,15 +24,13 @@ if [[ ! -f "pkg/slack-desc" ]]; then
exit 1 exit 1
fi fi
# Prefer local tarball if [[ ! -f "${TARBALL}" ]]; then
if [[ -f "./${TARBALL}" ]]; then echo "Error: ${TARBALL} not found in the current directory."
echo "Found ${TARBALL} locally." exit 1
cp ${TARBALL} pkg/
else
echo "Downloading ${TARBALL}..."
curl -L -O "$SOURCE_URL"
fi fi
cp ${TARBALL} pkg/
# Set environment variables for SlackBuild # Set environment variables for SlackBuild
export VERSION BUILD=1 TAG=_am OUTPUT=$(pwd) # Package output in current dir export VERSION BUILD=1 TAG=_am OUTPUT=$(pwd) # Package output in current dir