add PKGBUILD, upd DEB builder
This commit is contained in:
@ -1,24 +0,0 @@
|
||||
DOCKER_CMD ?= docker
|
||||
DOCKER_IMG = pybuilder:bookworm
|
||||
DEBBUILDDIR = build
|
||||
|
||||
all: docker-build build
|
||||
|
||||
clean:
|
||||
test -d $(DEBBUILDDIR) && rm -rf $(DEBBUILDDIR) || true
|
||||
|
||||
docker-build:
|
||||
$(DOCKER_CMD) build -f Dockerfile -t $(DOCKER_IMG) .
|
||||
|
||||
build: clean
|
||||
mkdir -p $(DEBBUILDDIR)
|
||||
cp -v ../dist/compute-*[.tar.gz] $(DEBBUILDDIR)/
|
||||
cp -r ../docs $(DEBBUILDDIR)/
|
||||
if [ -f build.sh.bak ]; then mv build.sh{.bak,}; fi
|
||||
cp build.sh{,.bak}
|
||||
awk '/authors/{gsub(/[\[\]]/,"");print $$3" "$$4}' ../pyproject.toml \
|
||||
| sed "s/['<>]//g" \
|
||||
| tr ' ' '\n' \
|
||||
| xargs -I {} sed "0,/%placeholder%/s//{}/" -i build.sh
|
||||
$(DOCKER_CMD) run --rm -i -v $$PWD:/mnt $(DOCKER_IMG) bash < build.sh
|
||||
mv build.sh{.bak,}
|
10
packaging/archlinux/Dockerfile
Normal file
10
packaging/archlinux/Dockerfile
Normal file
@ -0,0 +1,10 @@
|
||||
FROM archlinux:latest
|
||||
WORKDIR /mnt
|
||||
RUN chown 1000:1000 /mnt; \
|
||||
pacman -Sy --noconfirm \
|
||||
fakeroot \
|
||||
binutils \
|
||||
python \
|
||||
python-pip; \
|
||||
echo "alias ll='ls -alFh'" >> /etc/bash.bashrc
|
||||
USER 1000:1000
|
22
packaging/archlinux/Makefile
Normal file
22
packaging/archlinux/Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
DOCKER_CMD ?= docker
|
||||
DOCKER_IMG = computebuilder:archlinux
|
||||
BUILDDIR = build
|
||||
|
||||
all: docker-build build
|
||||
|
||||
clean:
|
||||
test -d $(BUILDDIR) && rm -rf $(BUILDDIR) || true
|
||||
|
||||
docker-build:
|
||||
$(DOCKER_CMD) build -f Dockerfile -t $(DOCKER_IMG) .
|
||||
|
||||
build: clean
|
||||
mkdir -p $(BUILDDIR)
|
||||
VERSION=$$(awk '/^version/{print $$3}' ../../pyproject.toml | sed s'/-/\./'); \
|
||||
sed "s/pkgver=.*/pkgver=$$VERSION/" PKGBUILD > $(BUILDDIR)/PKGBUILD
|
||||
cp -v ../../dist/compute-*[.tar.gz] $(BUILDDIR)/
|
||||
cp ../../extra/completion.bash $(BUILDDIR)/
|
||||
$(DOCKER_CMD) run --rm -i -v $$PWD/$(BUILDDIR):/mnt --ulimit "nofile=1024:1048576" \
|
||||
$(DOCKER_IMG) makepkg --nodeps --clean
|
||||
# Remove unwanted files from build dir
|
||||
rm $(BUILDDIR)/compute*.tar.gz $(BUILDDIR)/PKGBUILD
|
16
packaging/archlinux/PKGBUILD
Normal file
16
packaging/archlinux/PKGBUILD
Normal file
@ -0,0 +1,16 @@
|
||||
pkgname=compute
|
||||
pkgver='0.1.0-dev4'
|
||||
pkgrel=1
|
||||
pkgdesc='Compute instances management library'
|
||||
arch=(any)
|
||||
url=https://get.lulzette.ru/hstack/compute
|
||||
license=('GPL-3-or-later')
|
||||
makedepends=(python python-pip)
|
||||
depends=(python libvirt libvirt-python qemu-base qemu-system-x86 qemu-img dnsmasq iptables-nft)
|
||||
provides=(compute)
|
||||
conflicts=()
|
||||
|
||||
package() {
|
||||
pip install --no-cache-dir --no-deps --root $pkgdir ../$pkgname-*.tar.gz
|
||||
install -Dm644 ../completion.bash $pkgdir/usr/share/bash-completion/completions/compute
|
||||
}
|
29
packaging/debian/Makefile
Normal file
29
packaging/debian/Makefile
Normal file
@ -0,0 +1,29 @@
|
||||
DOCKER_CMD ?= docker
|
||||
DOCKER_IMG = computebuilder:debian-bookworm
|
||||
BUILDDIR = build
|
||||
KEEP_BUILDFILES ?=
|
||||
|
||||
all: docker-build build
|
||||
|
||||
clean:
|
||||
test -d $(BUILDDIR) && rm -rf $(BUILDDIR) || true
|
||||
|
||||
docker-build:
|
||||
$(DOCKER_CMD) build -f Dockerfile -t $(DOCKER_IMG) .
|
||||
|
||||
build: clean
|
||||
mkdir -p $(BUILDDIR)
|
||||
cp -v ../../dist/compute-*[.tar.gz] $(BUILDDIR)/
|
||||
cp -r ../../docs $(BUILDDIR)/
|
||||
cp ../../extra/completion.bash $(BUILDDIR)/compute.bash-completion
|
||||
if [ -f build.sh.bak ]; then mv build.sh{.bak,}; fi
|
||||
cp build.sh{,.bak}
|
||||
awk '/authors/{gsub(/[\[\]]/,"");print $$3" "$$4}' ../pyproject.toml \
|
||||
| sed "s/['<>]//g" \
|
||||
| tr ' ' '\n' \
|
||||
| xargs -I {} sed "0,/%placeholder%/s//{}/" -i build.sh
|
||||
$(DOCKER_CMD) run --rm -i -v $$PWD:/mnt $(DOCKER_IMG) bash < build.sh
|
||||
mv build.sh{.bak,}
|
||||
# Remove unwanted files from build dir
|
||||
find $(BUILDDIR) -mindepth 1 -type d -exec rm -rf {} +
|
||||
[ -z $(KEEP_BUILDFILES) ] && find $(BUILDDIR) ! -name '*.deb' -type f -exec rm -f {} + || true
|
@ -11,5 +11,6 @@ sed -e "s%\.\./\.\.%$PWD%" -i ../docs/source/conf.py
|
||||
dh_make --copyright gpl3 --yes --python --file ../compute-*[.tar.gz]
|
||||
rm debian/*.ex debian/README.{Debian,source} debian/*.docs
|
||||
sed -e 's/\* Initial release.*/\* This is the development build, see commits in upstream repo for info./' -i debian/changelog
|
||||
cp -v ../../files/{control,rules,copyright,docs,compute.bash-completion,install} debian/
|
||||
cp -v ../../files/{control,rules,copyright,docs,install} debian/
|
||||
mv ../compute.bash-completion debian/
|
||||
dpkg-buildpackage -us -uc
|
@ -1,116 +0,0 @@
|
||||
# compute bash completion script
|
||||
|
||||
_compute_global_opts="--connect --log-level"
|
||||
_compute_root_cmd="
|
||||
$_compute_global_opts
|
||||
--version
|
||||
init
|
||||
exec
|
||||
ls
|
||||
lsdisks
|
||||
start
|
||||
shutdown
|
||||
reboot
|
||||
reset
|
||||
powrst
|
||||
pause
|
||||
resume
|
||||
status
|
||||
setvcpus
|
||||
setmem
|
||||
setpass
|
||||
setcdrom
|
||||
setcloudinit
|
||||
delete"
|
||||
_compute_init_opts="$_compute_global_opts --test --start"
|
||||
_compute_exec_opts="$_compute_global_opts
|
||||
--timeout
|
||||
--executable
|
||||
--env
|
||||
--no-join-args"
|
||||
_compute_ls_opts="$_compute_global_opts"
|
||||
_compute_lsdisks_opts="$_compute_global_opts --persistent"
|
||||
_compute_start_opts="$_compute_global_opts"
|
||||
_compute_shutdown_opts="$_compute_global_opts --soft --normal --hard --unsafe"
|
||||
_compute_reboot_opts="$_compute_global_opts"
|
||||
_compute_reset_opts="$_compute_global_opts"
|
||||
_compute_powrst_opts="$_compute_global_opts"
|
||||
_compute_pause_opts="$_compute_global_opts"
|
||||
_compute_resume_opts="$_compute_global_opts"
|
||||
_compute_status_opts="$_compute_global_opts"
|
||||
_compute_setvcpus_opts="$_compute_global_opts"
|
||||
_compute_setmem_opts="$_compute_global_opts"
|
||||
_compute_setpass_opts="$_compute_global_opts --encrypted"
|
||||
_compute_setcdrom_opts="$_compute_global_opts --detach"
|
||||
_compute_setcloudinit_opts="$_compute_global_opts
|
||||
--user-data
|
||||
--vendor-data
|
||||
--meta-data
|
||||
--network-config"
|
||||
_compute_delete_opts="$_compute_global_opts --yes --save-volumes"
|
||||
|
||||
_compute_complete_instances()
|
||||
{
|
||||
local base_name
|
||||
for file in /etc/libvirt/qemu/*.xml; do
|
||||
base_name="${file##*/}"
|
||||
printf '%s ' "${base_name//\.xml}"
|
||||
done
|
||||
}
|
||||
|
||||
_compute_compreply()
|
||||
{
|
||||
local cgopts=
|
||||
|
||||
if [[ "$1" == '-f' ]]; then
|
||||
cgopts="-f"
|
||||
shift
|
||||
fi
|
||||
|
||||
if [[ "$current" = [a-z]* ]]; then
|
||||
_compute_compwords="$(_compute_complete_instances)"
|
||||
else
|
||||
_compute_compwords="$*"
|
||||
fi
|
||||
COMPREPLY=($(compgen $cgopts -W "$_compute_compwords" -- "$current"))
|
||||
}
|
||||
|
||||
_compute_complete()
|
||||
{
|
||||
local current previous nshift
|
||||
current="${COMP_WORDS[COMP_CWORD]}"
|
||||
case "$COMP_CWORD" in
|
||||
1) COMPREPLY=($(compgen -W "$_compute_root_cmd" -- "$current"))
|
||||
;;
|
||||
2|3|4|5)
|
||||
nshift=$((COMP_CWORD-1))
|
||||
previous="${COMP_WORDS[COMP_CWORD-nshift]}"
|
||||
case "$previous" in
|
||||
init) COMPREPLY=($(compgen -f -W "$_compute_init_opts" -- "$current"));;
|
||||
exec) _compute_compreply "$_compute_exec_opts";;
|
||||
ls) COMPREPLY=($(compgen -W "$_compute_ls_opts" -- "$current"));;
|
||||
lsdisks) _compute_compreply "$_compute_lsdisks_opts";;
|
||||
start) _compute_compreply "$_compute_start_opts";;
|
||||
shutdown) _compute_compreply "$_compute_shutdown_opts";;
|
||||
reboot) _compute_compreply "$_compute_reboot_opts";;
|
||||
reset) _compute_compreply "$_compute_reset_opts";;
|
||||
powrst) _compute_compreply "$_compute_powrst_opts";;
|
||||
pause) _compute_compreply "$_compute_pause_opts";;
|
||||
resume) _compute_compreply "$_compute_resume_opts";;
|
||||
status) _compute_compreply "$_compute_status_opts";;
|
||||
setvcpus) _compute_compreply "$_compute_setvcpus_opts";;
|
||||
setmem) _compute_compreply "$_compute_setmem_opts";;
|
||||
setpass) _compute_compreply "$_compute_setpass_opts";;
|
||||
setcdrom) _compute_compreply "$_compute_setcdrom_opts";;
|
||||
setcloudinit) _compute_compreply -f "$_compute_setcloudinit_opts";;
|
||||
delete) _compute_compreply "$_compute_delete_opts";;
|
||||
*) COMPREPLY=()
|
||||
esac
|
||||
;;
|
||||
*) COMPREPLY=($(compgen -W "$_compute_compwords" -- "$current"))
|
||||
esac
|
||||
}
|
||||
|
||||
complete -F _compute_complete compute
|
||||
|
||||
# vim: ft=bash
|
Reference in New Issue
Block a user