Compare commits
No commits in common. "build" and "fedora" have entirely different histories.
5 changed files with 93 additions and 55 deletions
17
.drone.yml
17
.drone.yml
|
@ -2,16 +2,25 @@ kind: pipeline
|
|||
type: docker
|
||||
name: default
|
||||
|
||||
environment:
|
||||
RPM_PACKAGER_NAME: 'askiiart'
|
||||
RPM_PACKAGER_EMAIL: 'rpm@askiiart.net'
|
||||
|
||||
steps:
|
||||
- name: Build cavif
|
||||
image: debian
|
||||
- name: Build cavif fedora package
|
||||
image: fedora
|
||||
commands:
|
||||
- '/drone/src/compilation.sh'
|
||||
- '/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
|
||||
path: /mnt/user/files/repos/archives/
|
||||
- name: fedora-repo
|
||||
host:
|
||||
path: /mnt/user/files/repos/fedora/x86_64/
|
||||
|
|
19
README.md
19
README.md
|
@ -1,17 +1,10 @@
|
|||
# Cavif build
|
||||
# Cavif (fedora)
|
||||
|
||||
- Builds [cavif](https://github.com/kornelski/cavif-rs) and places it in `$COMPILED_DIR/cavif/cavif.tar.zst`
|
||||
- Version file at `$COMPILED_DIR/cavif/version`
|
||||
TODO: Add proper changelog updates
|
||||
|
||||
## Archive details
|
||||
## Environment variables
|
||||
|
||||
```
|
||||
.
|
||||
├── cavif
|
||||
```
|
||||
**REQUIRED**
|
||||
|
||||
Recommended:
|
||||
|
||||
| File | Location | Permissions |
|
||||
| --------------- | -------------------------------------- | ----------- |
|
||||
| `./cavif` | `/usr/bin/cavif` | 755 |
|
||||
- RPM packager name - `RPM_PACKAGER_NAME`
|
||||
- RPM packager email - `RPM_PACKAGER_EMAIL`
|
||||
|
|
29
cavif.spec
Normal file
29
cavif.spec
Normal 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
|
|
@ -1,38 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
workdir=$(mktemp -d)
|
||||
built_dir=${COMPILED_DIR:-/compiled}/cavif
|
||||
mkdir -p $built_dir
|
||||
version_file=$built_dir/version
|
||||
touch $version_file
|
||||
|
||||
apt update
|
||||
apt install curl jq -y
|
||||
|
||||
# clone and check whether it's up-to-date
|
||||
mkdir -p $workdir/cavif/
|
||||
cd $workdir/cavif/
|
||||
# check version
|
||||
version=$(curl -L 'https://crates.io/api/v1/crates/cavif' | jq '.crate.default_version' -r)
|
||||
if grep -q $version $version_file; then
|
||||
echo "already up to date, exiting"
|
||||
exit
|
||||
fi
|
||||
# get build deps
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
. ~/.cargo/env
|
||||
apt install gcc nasm -y
|
||||
|
||||
# build cavif
|
||||
cargo install cavif
|
||||
cp ~/.cargo/bin/cavif $workdir/cavif/
|
||||
|
||||
# crate .tar.zst archive
|
||||
cd $workdir/cavif/
|
||||
mkdir -p ${COMPILED_DIR:-/compiled}/cavif/
|
||||
apt install zstd -y
|
||||
tar --zstd -cf $built_dir/cavif.tar.zst .
|
||||
echo $version >$version_file
|
||||
|
||||
echo "cavif updated to $version"
|
45
run.sh
Executable file
45
run.sh
Executable 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 $repo_dir/cavif-tmp
|
||||
if $(ls $repo_dir/cavif-* | grep -q "$version"); then
|
||||
rm $repo_dir/cavif-tmp
|
||||
echo "package is already up to date, exiting"
|
||||
exit
|
||||
fi
|
||||
rm $repo_dir/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-0.rpm
|
||||
rm $(ls cavif-*.rpm | sort --version-sort | sed '$d')
|
||||
rm cavif-0.rpm || true
|
||||
|
||||
# update repo
|
||||
createrepo_c .
|
||||
|
||||
echo "package is at $repo_dir/$(ls $repo_dir/cavif-*.rpm)"
|
Loading…
Add table
Reference in a new issue