Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpm fixups (resolves #380) #379

Merged
merged 10 commits into from
Feb 15, 2025
62 changes: 47 additions & 15 deletions .github/workflows/build-umu-fedora-40.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
workflow_call:
inputs:
version:
required: true
required: false
type: string
shasum:
required: true
required: false
type: string

jobs:
Expand All @@ -22,30 +22,62 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git safe directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Install build dependencies
run: dnf install -y rpm-build meson ninja-build cmake g++ gcc-c++ scdoc git python3-devel python3-build python3-installer python3-hatchling python python3 cargo python3-hatch-vcs python3-wheel libzstd-devel
run: dnf install -y rpm-build meson ninja-build cmake g++ gcc-c++ scdoc git python3-devel python3-build python3-installer python3-hatchling python python3 cargo python3-hatch-vcs python3-wheel libzstd-devel python3-pyzstd python3-xlib wget

- name: Extract Version and SHA
run: |
# Get version from git tags (assuming semantic versioning format)
VERSION=$(git describe --tags --abbrev=0 || echo "unknown")

# Get current commit SHA
COMMIT_SHA=$(git rev-parse HEAD)

# Store values in environment file
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV

- name: Build the project
env:
VERSION: ${{ env.VERSION }}
run: |
# Use either provided input or extracted value
VERSION=${VERSION}
COMMIT_SHA=${COMMIT_SHA}

echo $VERSION
git submodule update --init --recursive
./configure.sh --prefix=/usr
make
mkdir -p ~/rpmbuild/SOURCES
cp -r . ~/rpmbuild/SOURCES/umu-launcher
sed -re '/^#%global manual_commit/s|^# ?(.*)|\1|' packaging/rpm/umu-launcher.spec \
-e 's|(manual_commit\s+\w+)|manual_commit ${{ inputs.shasum }}|g' \
-i
cat packaging/rpm/umu-launcher.spec | grep manual_commit
sed -i "s|^VERSION := .*$|VERSION := ${VERSION}|g" Makefile.in

cd ..
mkdir -p ~/rpmbuild/SOURCES/
cp -R umu-launcher umu-launcher-$VERSION/
tar -cvzf umu-launcher-$VERSION.tar.gz umu-launcher-$VERSION
mv umu-launcher-$VERSION.tar.gz ~/rpmbuild/SOURCES/
rm -Rf umu-launcher-$VERSION/
wget https://github.com/urllib3/urllib3/releases/download/2.3.0/urllib3-2.3.0.tar.gz
mv urllib3-2.3.0.tar.gz ~/rpmbuild/SOURCES/
cd umu-launcher/

sed -i "s|^%global tag .*|%global tag ${VERSION}|g" packaging/rpm/umu-launcher.spec
cat packaging/rpm/umu-launcher.spec | grep tag

echo $COMMIT_SHA
sed -i "s|^%global commit .*|%global commit ${COMMIT_SHA}|g" packaging/rpm/umu-launcher.spec
cat packaging/rpm/umu-launcher.spec | grep commit

rpmbuild -ba packaging/rpm/umu-launcher.spec
mv ~/rpmbuild/RPMS/x86_64/umu-launcher-${{ inputs.version }}*.rpm \
~/rpmbuild/RPMS/x86_64/umu-launcher-${{ inputs.version }}.fc40.rpm
mv ~/rpmbuild/RPMS/x86_64/umu-launcher-$VERSION*.rpm \
~/rpmbuild/RPMS/x86_64/umu-launcher-$VERSION.fc40.rpm

- name: Fedora-40
uses: actions/upload-artifact@v4
with:
name: umu-launcher-${{ inputs.version }}.fc40.rpm
path: ~/rpmbuild/RPMS/x86_64/umu-launcher-${{ inputs.version }}.fc40.rpm
name: umu-launcher-${{ env.VERSION }}.fc40.rpm
path: ~/rpmbuild/RPMS/x86_64/umu-launcher-${{ env.VERSION }}.fc40.rpm
62 changes: 47 additions & 15 deletions .github/workflows/build-umu-fedora-41.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
workflow_call:
inputs:
version:
required: true
required: false
type: string
shasum:
required: true
required: false
type: string

jobs:
Expand All @@ -22,30 +22,62 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git safe directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Install build dependencies
run: dnf install -y rpm-build meson ninja-build cmake g++ gcc-c++ scdoc git python3-devel python3-build python3-installer python3-hatchling python python3 cargo python3-hatch-vcs python3-wheel libzstd-devel
run: dnf install -y rpm-build meson ninja-build cmake g++ gcc-c++ scdoc git python3-devel python3-build python3-installer python3-hatchling python python3 cargo python3-hatch-vcs python3-wheel libzstd-devel python3-pyzstd python3-xlib wget

- name: Extract Version and SHA
run: |
# Get version from git tags (assuming semantic versioning format)
VERSION=$(git describe --tags --abbrev=0 || echo "unknown")

# Get current commit SHA
COMMIT_SHA=$(git rev-parse HEAD)

# Store values in environment file
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV

- name: Build the project
env:
VERSION: ${{ env.VERSION }}
run: |
# Use either provided input or extracted value
VERSION=${VERSION}
COMMIT_SHA=${COMMIT_SHA}

echo $VERSION
git submodule update --init --recursive
./configure.sh --prefix=/usr
make
mkdir -p ~/rpmbuild/SOURCES
cp -r . ~/rpmbuild/SOURCES/umu-launcher
sed -re '/^#%global manual_commit/s|^# ?(.*)|\1|' packaging/rpm/umu-launcher.spec \
-e 's|(manual_commit\s+\w+)|manual_commit ${{ inputs.shasum }}|g' \
-i
cat packaging/rpm/umu-launcher.spec | grep manual_commit
sed -i "s|^VERSION := .*$|VERSION := ${VERSION}|g" Makefile.in

cd ..
mkdir -p ~/rpmbuild/SOURCES/
cp -R umu-launcher umu-launcher-$VERSION/
tar -cvzf umu-launcher-$VERSION.tar.gz umu-launcher-$VERSION
mv umu-launcher-$VERSION.tar.gz ~/rpmbuild/SOURCES/
rm -Rf umu-launcher-$VERSION/
wget https://github.com/urllib3/urllib3/releases/download/2.3.0/urllib3-2.3.0.tar.gz
mv urllib3-2.3.0.tar.gz ~/rpmbuild/SOURCES/
cd umu-launcher/

sed -i "s|^%global tag .*|%global tag ${VERSION}|g" packaging/rpm/umu-launcher.spec
cat packaging/rpm/umu-launcher.spec | grep tag

echo $COMMIT_SHA
sed -i "s|^%global commit .*|%global commit ${COMMIT_SHA}|g" packaging/rpm/umu-launcher.spec
cat packaging/rpm/umu-launcher.spec | grep commit

rpmbuild -ba packaging/rpm/umu-launcher.spec
mv ~/rpmbuild/RPMS/x86_64/umu-launcher-${{ inputs.version }}*.rpm \
~/rpmbuild/RPMS/x86_64/umu-launcher-${{ inputs.version }}.fc41.rpm
mv ~/rpmbuild/RPMS/x86_64/umu-launcher-$VERSION*.rpm \
~/rpmbuild/RPMS/x86_64/umu-launcher-$VERSION.fc41.rpm

- name: Fedora-41
uses: actions/upload-artifact@v4
with:
name: umu-launcher-${{ inputs.version }}.fc41.rpm
path: ~/rpmbuild/RPMS/x86_64/umu-launcher-${{ inputs.version }}.fc41.rpm
name: umu-launcher-${{ env.VERSION }}.fc41.rpm
path: ~/rpmbuild/RPMS/x86_64/umu-launcher-${{ env.VERSION }}.fc41.rpm
37 changes: 20 additions & 17 deletions packaging/rpm/umu-launcher.spec
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
%global tag %(git describe --abbrev=0 --tags)
# Tag is auto-inserted by workflow
%global tag 1.2.3

# Manual commit is auto-inserted by workflow
#%global manual_commit

%{!?manual_commit: %global commit %(git rev-list -n 1 %{tag} 2>/dev/null)}
%{?manual_commit: %global commit %{manual_commit}}
%global commit e8c6b737f54b24d1ea61ff82f78aa326c3df10b6

%global shortcommit %(c=%{commit}; echo ${c:0:7})

%global build_timestamp %(date +"%Y%m%d")

%global rel_build 1.%{build_timestamp}.%{shortcommit}%{?dist}

# F41 doesn't ship urllib3 >= 2.0 needed
%global urllib3 2.3.0

Name: umu-launcher
Version: %{tag}
Release: %{rel_build}
Summary: A tool for launching non-steam games with proton

License: GPLv3
URL: https://github.com/Open-Wine-Components/umu-launcher
Source0: %{url}/archive/refs/tags/%{tag}.tar.gz#/%{name}-%{tag}.tar.gz
Source1: https://github.com/urllib3/urllib3/releases/download/%{urllib3}/urllib3-%{urllib3}.tar.gz

BuildArch: x86_64
BuildRequires: meson >= 0.54.0
Expand All @@ -38,20 +41,21 @@ BuildRequires: python3-pip
BuildRequires: libzstd-devel
BuildRequires: python3-hatch-vcs
BuildRequires: python3-wheel
BuildRequires: python3-xlib
BuildRequires: python3-pyzstd
BuildRequires: cargo

# Can't use these yet, F41 doesn't ship urllib3 >= 2.0 needed
#BuildRequires: python3-urllib3
#BuildRequires: python3-pyzstd

Requires: python
Requires: python3
Requires: python3-xlib
Requires: python3-filelock
Requires: python3-pyzstd

# Can't use these yet, F41 doesn't ship urllib3 >= 2.0 needed
#Requires: python3-urllib3
#Requires: python3-pyzstd

Recommends: python3-cbor2
Recommends: python3-xxhash
Expand All @@ -66,23 +70,22 @@ AutoReqProv: no
%{name} A tool for launching non-steam games with proton

%prep
git clone https://github.com/Open-Wine-Components/umu-launcher.git
cd umu-launcher
# Check if tag exists and is valid
git checkout %{commit}


git submodule update --init --recursive
%autosetup -p 1
if ! find subprojects/urllib3/ -mindepth 1 -maxdepth 1 | read; then
# Directory is empty, perform action
mv %{SOURCE1} .
tar -xf urllib3-%{urllib3}.tar.gz
rm *.tar.gz
mv urllib3-%{urllib3}/* subprojects/urllib3/
fi

%build
cd umu-launcher
# Update this when fedora ships urllib3 >= 2.0
#./configure.sh --prefix=/usr --use-system-pyzstd --use-system-urllib
./configure.sh --prefix=/usr
./configure.sh --prefix=/usr --use-system-pyzstd
make

%install
cd umu-launcher
make DESTDIR=%{buildroot} PYTHONDIR=%{python3_sitelib} install

%files
Expand Down
Loading