build rpm
All checks were successful
build-rpm / rpm (push) Successful in 11s

This commit is contained in:
Danilo Reyes
2026-02-19 10:37:36 -06:00
parent f7b65d0b8f
commit 0b65727f85
4 changed files with 122 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
name: build-rpm
on:
push:
branches:
- main
- master
tags:
- 'v*'
jobs:
rpm:
runs-on: nixos
env:
NIX_CONFIG: builders =
steps:
- uses: actions/checkout@v4
- name: Build RPM
run: nix run .#build-rpm
- name: Upload RPM artifact
uses: actions/upload-artifact@v3
with:
name: prem2resolve-rpm
path: rpmbuild/RPMS/**/*.rpm

View File

@@ -25,11 +25,25 @@
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.ffmpeg ]}
'';
};
build-rpm = pkgs.writeShellApplication {
name = "build-rpm";
runtimeInputs = [
pkgs.git
pkgs.gzip
pkgs.python3
pkgs.rpm
];
text = ''
exec ${pkgs.bash}/bin/bash ${./scripts/build-rpm.sh}
'';
};
in
{
packages = {
default = prem2resolve-wrapped;
prem2resolve = prem2resolve-wrapped;
build-rpm = build-rpm;
};
apps = {
@@ -37,6 +51,10 @@
type = "app";
program = "${prem2resolve-wrapped}/bin/prem2resolve";
};
build-rpm = {
type = "app";
program = "${build-rpm}/bin/build-rpm";
};
};
devShells.default = pkgs.mkShell {
@@ -45,6 +63,15 @@
pkgs.ffmpeg
];
};
devShells.rpm = pkgs.mkShell {
buildInputs = [
pkgs.git
pkgs.gzip
pkgs.python3
pkgs.rpm
];
};
}
);
}

View File

@@ -0,0 +1,32 @@
Name: prem2resolve
Version: 0.1.0
Release: 1%{?dist}
Summary: Convert Premiere Pro XML exports for DaVinci Resolve on Linux
License: 0BSD
BuildArch: noarch
Source0: %{name}-%{version}.tar.gz
BuildRequires: python3
Requires: python3
Requires: ffmpeg
%description
Command-line tool that updates Adobe Premiere Pro XML exports for DaVinci Resolve
on Linux, optionally re-encoding MP4 media into Resolve-friendly MOV codecs.
%prep
%setup -q
%build
# No build step required for this Python script.
%install
install -D -m 0755 premiere_to_resolve.py %{buildroot}%{_bindir}/prem2resolve
%files
%{_bindir}/prem2resolve
%changelog
* Thu Feb 19 2026 Danilo Reyes <danilo.reyes.251@proton.me> - 0.1.0-1
- Initial RPM packaging

37
scripts/build-rpm.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -euo pipefail
if ROOT_DIR=$(git -C "${PWD}" rev-parse --show-toplevel 2>/dev/null); then
ROOT_DIR="$ROOT_DIR"
else
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
fi
SPEC_FILE="$ROOT_DIR/packaging/prem2resolve.spec"
if ! command -v rpmspec >/dev/null 2>&1; then
echo "rpmspec not found. Install rpm-build." >&2
exit 1
fi
VERSION=$(rpmspec -q --qf '%{version}\n' "$SPEC_FILE" | head -n1)
NAME=$(rpmspec -q --qf '%{name}\n' "$SPEC_FILE" | head -n1)
DIST_DIR="$ROOT_DIR/dist"
TOPDIR="$ROOT_DIR/rpmbuild"
TARBALL="$DIST_DIR/${NAME}-${VERSION}.tar.gz"
mkdir -p "$DIST_DIR" "$TOPDIR/BUILD" "$TOPDIR/RPMS" "$TOPDIR/SOURCES" "$TOPDIR/SPECS" "$TOPDIR/SRPMS"
if ! git -C "$ROOT_DIR" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "Not a git repository; cannot create source archive." >&2
exit 1
fi
git -C "$ROOT_DIR" archive --format=tar --prefix="${NAME}-${VERSION}/" HEAD | gzip -n > "$TARBALL"
cp "$SPEC_FILE" "$TOPDIR/SPECS/"
cp "$TARBALL" "$TOPDIR/SOURCES/"
rpmbuild --define "_topdir $TOPDIR" -ba "$TOPDIR/SPECS/$(basename "$SPEC_FILE")"
echo "Built RPM(s) in: $TOPDIR/RPMS"