initial commit

This commit is contained in:
askiiart 2025-03-06 13:30:17 -06:00
commit fa3eb28847
Signed by untrusted user who does not match committer: askiiart
GPG key ID: 6A32977DAF31746A
4 changed files with 110 additions and 0 deletions

26
.drone.yml Normal file
View file

@ -0,0 +1,26 @@
kind: pipeline
type: docker
name: default
environment:
RPM_PACKAGER_NAME: 'askiiart'
RPM_PACKAGER_EMAIL: 'rpm@askiiart.net'
steps:
- name: Build cavif fedora package
image: fedora
commands:
- '/drone/src/run.sh'
volumes:
- name: program-archives
path: /compiled
- name: fedora-repo
path: /repo
volumes:
- name: program-archives
host:
path: /mnt/user/files/repos/archives/
- name: fedora-repo
host:
path: /mnt/user/files/repos/fedora/x86_64/

10
README.md Normal file
View file

@ -0,0 +1,10 @@
# Cavif (fedora)
TODO: Add proper changelog updates
## Environment variables
**REQUIRED**
- RPM packager name - `RPM_PACKAGER_NAME`
- RPM packager email - `RPM_PACKAGER_EMAIL`

29
cavif.spec Normal file
View file

@ -0,0 +1,29 @@
Name: cavif
Version: 6.6.6
Release: %autorelease
Summary: AVIF image creator in pure Rust
License: BSD-3-Clause
URL: https://github.com/kornelski/cavif-rs
BuildRequires: tar zstd
%description
An AVIF image creator in pure Rust
%prep
mkdir ./cavif/
cd ./cavif/
tar --zstd -xf ${COMPILED_DIR:-/compiled}/cavif/cavif.tar.zst
%install
cd ./cavif/
mkdir -p %{buildroot}%{_bindir}
install -Dm755 ./cavif %{buildroot}%{_bindir}/cavif
%files
%{_bindir}/cavif
%changelog
* DATE_HERE RPM_PACKAGER_NAME <RPM_PACKAGER_EMAIL>
- CHANGELOG_MESSAGE_HERE

45
run.sh Normal file
View file

@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -euo pipefail
built_dir=${COMPILED_DIR:-/compiled}/cavif
version=$(cat $built_dir/version)
repo_dir=${REPO_DIR:-/repo}
# skip if already up-to-date
# TODO: use the repo instead and check the version with dnf
# yeah this is bad; see also the cavif-aaaaaa thing below
touch cavif-tmp
if $(ls $repo_dir/cavif-* | grep -q "$version"); then
rm cavif-tmp
echo "package is already up to date, exiting"
exit
fi
rm cavif-tmp
# prep
dnf install fedora-packager rpmdevtools createrepo_c -y
rpmdev-setuptree
# update spec file
sed -i "s/Version:.*/Version: $version/g" cavif.spec
sed -i "s/DATE_HERE/$(date '+%a %b %d %Y')/g" cavif.spec
sed -i "s/CHANGELOG_MESSAGE_HERE/Update to $version/g" cavif.spec
sed -i "s/RPM_PACKAGER_NAME/$RPM_PACKAGER_NAME/g" cavif.spec
sed -i "s/RPM_PACKAGER_EMAIL/$RPM_PACKAGER_EMAIL/g" cavif.spec
# build package and move to the repo
rpmbuild -bb cavif.spec
mv ~/rpmbuild/RPMS/x86_64/cavif-$version-* $repo_dir/
# remove old versions
cd $repo_dir
# this is the easiest way to make sure it doesn't just fail because no cavif-* exists
# (which only happens on first run)
touch cavif-aaaaaa.rpm
rm $(ls cavif-*.rpm | sort --version-sort | sed '$d')
rm cavif-aaaaaa.rpm
# update repo
createrepo_c .
echo "package is at $repo_dir/$(ls $repo_dir/cavif-*.rpm)"