commit dfcf3ed487150ed93e093eaaa313b924547147c1 Author: askiiart Date: Tue Apr 15 00:23:40 2025 -0500 initial commit diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..a56ef48 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,22 @@ +kind: pipeline +type: docker +name: default + +steps: + - name: Build 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/ diff --git a/PLACEHOLDER.spec b/PLACEHOLDER.spec new file mode 100644 index 0000000..87de7fb --- /dev/null +++ b/PLACEHOLDER.spec @@ -0,0 +1,33 @@ +Name: +Version: 1.1.1 +Release: %autorelease +Summary: + +License: +URL: + +BuildRequires: tar zstd +Requires: glibc +Recommends: dbus + +%description + + +%prep +program_name="" +mkdir ./$program_name +cd ./$program_name/ +tar --zstd -xf ${COMPILED_DIR:-/compiled}/$program_name/$program_name.tar.zst + +%install +program_name="" +cd ./$program_name/ +mkdir -p %{buildroot}%{_bindir} +cp ./ %{buildroot}%{_bindir}/ + +%files +%{_bindir}/ + +%changelog +* Tue Apr 15 2025 askiiart +- Initial version diff --git a/README.md b/README.md new file mode 100644 index 0000000..b4c4601 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# [Placeholder](https://github.com/PLACEHOLDER_AUTHOR/PLACEHOLDER_REPO) (fedora) diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..ab8a6ce --- /dev/null +++ b/run.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +set -euo pipefail + +program_name="" + +built_dir=${COMPILED_DIR:-/compiled}/$program_name +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 -aaaaaa thing below +touch $repo_dir/$program_name-tmp +if $(ls $repo_dir/$program_name-* | grep -q "$version"); then + rm $repo_dir/$program_name-tmp + echo "package is already up to date, exiting" + exit +fi +rm $repo_dir/$program_name-tmp + +# prep +dnf install fedora-packager rpmdevtools createrepo_c -y +rpmdev-setuptree + +sed -i "s/Version:.*/Version: $version/g" $program_name.spec + +# build package and move to the repo +rpmbuild -bb $program_name.spec +mv ~/rpmbuild/RPMS/x86_64/$program_name-$version-* $repo_dir/ + +# remove old versions +cd $repo_dir +# this is the easiest way to make sure it doesn't just fail because no -* exists +# (which only happens on first run) +touch $program_name-0.rpm +rm $(ls $program_name-*.rpm | sort --version-sort | sed '$d') +rm $program_name-0.rpm || true + +# update repo +createrepo_c . + +cd $repo_dir +echo "package is at $repo_dir/$(ls $program_name-*.rpm)"