diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml index a12c210..b2f8c11 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/packaging.yml @@ -26,9 +26,6 @@ jobs: - name: Install setuptools-scm run: pip install setuptools-scm - - name: Generate RPM spec file - run: python generate_spec.py - - name: Get version from spec id: version run: | @@ -58,17 +55,23 @@ jobs: timeout-minutes: 10 run: | dnf update -y - dnf install -y git rpm-build rpm-devel python3-pip python3-devel python3-setuptools - dnf install -y python3-requests python3-dateutil python3-cryptography + dnf install -y git rpm-build rpm-devel # Enable PowerTools/CRB for additional packages if [ "${{ matrix.alma-version }}" = "8" ]; then dnf config-manager --set-enabled powertools || true + # need epel for python38-dateutil + dnf install -y epel-release + PYV=python38 else dnf config-manager --set-enabled crb || true dnf install -y python3-pyproject-rpm-macros || true + PYV=python3 fi + dnf install -y $PYV $PYV-pip $PYV-setuptools $PYV-rpm-macros + dnf install -y $PYV-requests $PYV-dateutil $PYV-cryptography + # No build tools needed - installing from pre-built source distribution - name: Download source distribution @@ -79,6 +82,10 @@ jobs: - name: Build RPM from spec file run: | + # Define cache space to keep pip happy + export PIP_CACHE_DIR=$PWD/pipcache + mkdir -p $PIP_CACHE_DIR + # Extract version from spec file VERSION=$(grep "^Version:" rpm/python-cvmfsutils.spec | awk '{print $2}') echo "Building version: $VERSION" @@ -86,10 +93,14 @@ jobs: # Setup RPM build tree mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} - # Copy source tarball to SOURCES (renamed to match spec version) - cp "dist/cvmfsutils-${VERSION}.tar.gz" ~/rpmbuild/SOURCES/ + # Rename source paths and make source tarball in SOURCES + cd dist + tar xzf cvmfsutils-${VERSION}.tar.gz + mv cvmfsutils-${VERSION} python-cvmfsutils-${VERSION} + tar czf ~/rpmbuild/SOURCES/python-cvmfsutils-${VERSION}.tar.gz python-cvmfsutils-${VERSION} + cd .. - # Copy spec file to SPECS (now includes version, no macros needed) + # Copy spec file to SPECS cp rpm/python-cvmfsutils.spec ~/rpmbuild/SPECS/ # Build the RPM (no version macro needed since it's in the spec file) @@ -190,10 +201,14 @@ jobs: # Setup RPM build tree mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} - # Copy source tarball to SOURCES (renamed to match spec version) - cp "dist/cvmfsutils-${VERSION}.tar.gz" ~/rpmbuild/SOURCES/ + # Rename source paths and make source tarball in SOURCES + cd dist + tar xzf cvmfsutils-${VERSION}.tar.gz + mv cvmfsutils-${VERSION} python-cvmfsutils-${VERSION} + tar czf ~/rpmbuild/SOURCES/python-cvmfsutils-${VERSION}.tar.gz python-cvmfsutils-${VERSION} + cd .. - # Copy spec file to SPECS (already has version embedded) + # Copy spec file to SPECS cp rpm/python-cvmfsutils.spec ~/rpmbuild/SPECS/ # Build the RPM (set topdir since SUSE defaults to /usr/src/packages) diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml index b7345d0..598a5e1 100644 --- a/.github/workflows/version-check.yml +++ b/.github/workflows/version-check.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - name: Install pixi - uses: prefix-dev/setup-pixi@v0.8.1 + uses: prefix-dev/setup-pixi@v0.10.0 - name: Verify checked-in spec matches generated run: | @@ -33,13 +33,3 @@ jobs: diff /tmp/checked-in.spec rpm/python-cvmfsutils.spec || true exit 1 fi - - - name: Verify spec file has no external macros - run: | - # Check that the spec file doesn't use %{version} macro - if grep -q "%{version}" rpm/python-cvmfsutils.spec; then - echo "✗ Spec file still contains %{version} macro - should be replaced with actual version" - exit 1 - else - echo "✓ Spec file does not use external version macro" - fi diff --git a/rpm/python-cvmfsutils.spec b/rpm/python-cvmfsutils.spec index 54f6e22..a8c6144 100644 --- a/rpm/python-cvmfsutils.spec +++ b/rpm/python-cvmfsutils.spec @@ -5,7 +5,7 @@ Summary: Inspect CernVM-FS repositories Name: python-cvmfsutils Version: 0.6.0 Release: %{release_prefix}%{?dist} -Source0: cvmfsutils-0.6.0.tar.gz +Source0: %{name}-0.6.0.tar.gz License: (c) 2015 CERN - BSD License Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-0.6.0-%{release}-buildroot @@ -14,14 +14,19 @@ BuildArch: noarch Vendor: Rene Meusel Url: http://cernvm.cern.ch -BuildRequires: python3 -BuildRequires: python3-rpm-macros -BuildRequires: python3-pip -BuildRequires: python3-setuptools +%if 0%{?rhel} == 8 +%define PYV python38 +%else +%define PYV python3 +%endif +BuildRequires: %{PYV} +BuildRequires: %{PYV}-rpm-macros +BuildRequires: %{PYV}-pip +BuildRequires: %{PYV}-setuptools -Requires: python3-dateutil -Requires: python3-requests -Requires: python3-cryptography +Requires: %{PYV}-dateutil +Requires: %{PYV}-requests +Requires: %{PYV}-cryptography %description The CernVM-FS python package allows for the inspection of CernVM-FS @@ -31,13 +36,16 @@ files) and the history of named snapshots inside any CernVM-FS repository. %prep #%%setup -n %{name}-0.6.0 -n %{name}-0.6.0 -%autosetup -n cvmfsutils-0.6.0 +%autosetup -n %{name}-0.6.0 %build # No build step needed - pip install handles everything %install -python3 -m pip install --no-deps --root=%{buildroot} %{_sourcedir}/cvmfsutils-0.6.0.tar.gz +%if 0%{?rhel} == 9 +export SETUPTOOLS_SCM_PRETEND_VERSION=0.6.0 +%endif +python3 -m pip install --no-deps -v --root=%{buildroot} %{_sourcedir}/%{name}-0.6.0.tar.gz %clean rm -rf $RPM_BUILD_ROOT diff --git a/rpm/python-cvmfsutils.spec.in b/rpm/python-cvmfsutils.spec.in index 8b170de..b8e3b91 100644 --- a/rpm/python-cvmfsutils.spec.in +++ b/rpm/python-cvmfsutils.spec.in @@ -5,7 +5,7 @@ Summary: Inspect CernVM-FS repositories Name: python-cvmfsutils Version: @VERSION@ Release: %{release_prefix}%{?dist} -Source0: cvmfsutils-@VERSION@.tar.gz +Source0: %{name}-@VERSION@.tar.gz License: (c) 2015 CERN - BSD License Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-@VERSION@-%{release}-buildroot @@ -14,14 +14,19 @@ BuildArch: noarch Vendor: Rene Meusel Url: http://cernvm.cern.ch -BuildRequires: python3 -BuildRequires: python3-rpm-macros -BuildRequires: python3-pip -BuildRequires: python3-setuptools +%if 0%{?rhel} == 8 +%define PYV python38 +%else +%define PYV python3 +%endif +BuildRequires: %{PYV} +BuildRequires: %{PYV}-rpm-macros +BuildRequires: %{PYV}-pip +BuildRequires: %{PYV}-setuptools -Requires: python3-dateutil -Requires: python3-requests -Requires: python3-cryptography +Requires: %{PYV}-dateutil +Requires: %{PYV}-requests +Requires: %{PYV}-cryptography %description The CernVM-FS python package allows for the inspection of CernVM-FS @@ -31,13 +36,16 @@ files) and the history of named snapshots inside any CernVM-FS repository. %prep #%%setup -n %{name}-@VERSION@ -n %{name}-@VERSION@ -%autosetup -n cvmfsutils-@VERSION@ +%autosetup -n %{name}-@VERSION@ %build # No build step needed - pip install handles everything %install -python3 -m pip install --no-deps --root=%{buildroot} %{_sourcedir}/cvmfsutils-@VERSION@.tar.gz +%if 0%{?rhel} == 9 +export SETUPTOOLS_SCM_PRETEND_VERSION=@VERSION@ +%endif +python3 -m pip install --no-deps -v --root=%{buildroot} %{_sourcedir}/%{name}-@VERSION@.tar.gz %clean rm -rf $RPM_BUILD_ROOT diff --git a/setup.cfg b/setup.cfg index e14a1b1..6eb2d94 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,7 @@ name = cvmfsutils description = Inspect CernVM-FS repositories long_description = file: README.md long_description_content_type = text/markdown -license = (c) 2015 CERN - BSD License +license = BSD author = Rene Meusel author_email = rene.meusel@cern.ch url = http://cernvm.cern.ch @@ -12,7 +12,6 @@ classifiers = Environment :: Console Intended Audience :: Developers Intended Audience :: System Administrators - License :: OSI Approved :: BSD License Natural Language :: English Operating System :: POSIX :: Linux Operating System :: MacOS :: MacOS X