add PKGBUILD, upd DEB builder
This commit is contained in:
		
							
								
								
									
										24
									
								
								packaging/debian/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								packaging/debian/Dockerfile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
FROM debian:bookworm-slim
 | 
			
		||||
WORKDIR /mnt/build
 | 
			
		||||
RUN apt-get update; \
 | 
			
		||||
    env DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
 | 
			
		||||
        build-essential \
 | 
			
		||||
        bash-completion \
 | 
			
		||||
        debhelper \
 | 
			
		||||
        quilt \
 | 
			
		||||
        dh-make \
 | 
			
		||||
        dh-python \
 | 
			
		||||
        pybuild-plugin-pyproject \
 | 
			
		||||
        python3-poetry-core \
 | 
			
		||||
        python3-all \
 | 
			
		||||
        python3-setuptools \
 | 
			
		||||
        python3-sphinx \
 | 
			
		||||
        python3-sphinx-multiversion \
 | 
			
		||||
        python3-sphinx-argparse \
 | 
			
		||||
        python3-libvirt \
 | 
			
		||||
        python3-lxml \
 | 
			
		||||
        python3-yaml \
 | 
			
		||||
        python3-pydantic; \
 | 
			
		||||
    apt clean; \
 | 
			
		||||
    echo "alias ll='ls -alFh'" >> /etc/bash.bashrc
 | 
			
		||||
USER 1000:1000
 | 
			
		||||
							
								
								
									
										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
 | 
			
		||||
							
								
								
									
										16
									
								
								packaging/debian/build.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								packaging/debian/build.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
set -o errexit
 | 
			
		||||
set -o xtrace
 | 
			
		||||
export USER=build
 | 
			
		||||
export HOME=/mnt
 | 
			
		||||
export DEBFULLNAME='%placeholder%'
 | 
			
		||||
export DEBEMAIL='%placeholder%'
 | 
			
		||||
mkdir -p /mnt/build && cd /mnt/build
 | 
			
		||||
tar xf compute-*[.tar.gz]
 | 
			
		||||
cd compute-*[^.tar.gz]
 | 
			
		||||
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,install} debian/
 | 
			
		||||
mv ../compute.bash-completion debian/
 | 
			
		||||
dpkg-buildpackage -us -uc
 | 
			
		||||
							
								
								
									
										53
									
								
								packaging/debian/files/control
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								packaging/debian/files/control
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
Source: compute
 | 
			
		||||
Section: admin
 | 
			
		||||
Priority: optional
 | 
			
		||||
Maintainer: ge <ge@nixhacks.net>
 | 
			
		||||
Rules-Requires-Root: no
 | 
			
		||||
Build-Depends:
 | 
			
		||||
 debhelper-compat (= 13),
 | 
			
		||||
 dh-sequence-python3,
 | 
			
		||||
 bash-completion,
 | 
			
		||||
 pybuild-plugin-pyproject,
 | 
			
		||||
 python3-poetry-core,
 | 
			
		||||
 python3-setuptools,
 | 
			
		||||
 python3-all,
 | 
			
		||||
 python3-sphinx,
 | 
			
		||||
 python3-sphinx-multiversion,
 | 
			
		||||
 python3-sphinx-argparse,
 | 
			
		||||
 python3-libvirt,
 | 
			
		||||
 python3-lxml,
 | 
			
		||||
 python3-yaml,
 | 
			
		||||
 python3-pydantic
 | 
			
		||||
Standards-Version: 4.6.2
 | 
			
		||||
Homepage: https://git.lulzette.ru/hstack/compute
 | 
			
		||||
 | 
			
		||||
Package: compute
 | 
			
		||||
Architecture: all
 | 
			
		||||
Depends:
 | 
			
		||||
 ${python3:Depends},
 | 
			
		||||
 ${misc:Depends},
 | 
			
		||||
 qemu-system,
 | 
			
		||||
 qemu-utils,
 | 
			
		||||
 libvirt-daemon,
 | 
			
		||||
 libvirt-daemon-system,
 | 
			
		||||
 libvirt-daemon-driver-qemu,
 | 
			
		||||
 libvirt-clients,
 | 
			
		||||
 python3-libvirt,
 | 
			
		||||
 python3-lxml,
 | 
			
		||||
 python3-yaml,
 | 
			
		||||
 python3-pydantic,
 | 
			
		||||
 mtools,
 | 
			
		||||
 dosfstools,
 | 
			
		||||
 dnsmasq,
 | 
			
		||||
 dnsmasq-base
 | 
			
		||||
Suggests:
 | 
			
		||||
 compute-doc
 | 
			
		||||
Description: Compute instances management library (Python 3)
 | 
			
		||||
 | 
			
		||||
Package: compute-doc
 | 
			
		||||
Section: doc
 | 
			
		||||
Architecture: all
 | 
			
		||||
Depends:
 | 
			
		||||
 ${sphinxdoc:Depends},
 | 
			
		||||
 ${misc:Depends},
 | 
			
		||||
Description: Compute instances management library (documentation)
 | 
			
		||||
							
								
								
									
										32
									
								
								packaging/debian/files/copyright
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								packaging/debian/files/copyright
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 | 
			
		||||
Source: https://git.lulzette.ru/hstack/compute
 | 
			
		||||
Upstream-Name: compute
 | 
			
		||||
 | 
			
		||||
Files:
 | 
			
		||||
 *
 | 
			
		||||
Copyright:
 | 
			
		||||
 2023 ge <ge@nixhacks.net>
 | 
			
		||||
License: GPL-3.0+
 | 
			
		||||
 | 
			
		||||
Files:
 | 
			
		||||
 debian/*
 | 
			
		||||
Copyright:
 | 
			
		||||
 2023 ge <ge@nixhacks.net>
 | 
			
		||||
License: GPL-3.0+
 | 
			
		||||
 | 
			
		||||
License: GPL-3.0+
 | 
			
		||||
 This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 it under the terms of the GNU General Public License as published by
 | 
			
		||||
 the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 (at your option) any later version.
 | 
			
		||||
 .
 | 
			
		||||
 This package is distributed in the hope that it will be useful,
 | 
			
		||||
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 GNU General Public License for more details.
 | 
			
		||||
 .
 | 
			
		||||
 You should have received a copy of the GNU General Public License
 | 
			
		||||
 along with this program. If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
Comment:
 | 
			
		||||
 On Debian systems, the complete text of the GNU General
 | 
			
		||||
 Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
 | 
			
		||||
							
								
								
									
										1
									
								
								packaging/debian/files/docs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								packaging/debian/files/docs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
README.md
 | 
			
		||||
							
								
								
									
										1
									
								
								packaging/debian/files/install
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								packaging/debian/files/install
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
computed.toml etc/compute/
 | 
			
		||||
							
								
								
									
										20
									
								
								packaging/debian/files/rules
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										20
									
								
								packaging/debian/files/rules
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
#!/usr/bin/make -f
 | 
			
		||||
 | 
			
		||||
export DH_VERBOSE = 1
 | 
			
		||||
export PYBUILD_DESTDIR_python3=debian/compute
 | 
			
		||||
 | 
			
		||||
%:
 | 
			
		||||
	dh $@ --with python3,sphinxdoc,bash-completion --buildsystem=pybuild
 | 
			
		||||
 | 
			
		||||
override_dh_auto_test:
 | 
			
		||||
	@echo No tests there
 | 
			
		||||
 | 
			
		||||
override_dh_sphinxdoc:
 | 
			
		||||
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
 | 
			
		||||
	http_proxy=127.0.0.1:9 https_proxy=127.0.0.1:9 \
 | 
			
		||||
	HTTP_PROXY=127.0.0.1:9 HTTPS_PROXY=127.0.0.1:9 \
 | 
			
		||||
	PYTHONPATH=. PYTHON=python3 python3 -m sphinx $(SPHINXOPTS) -b html \
 | 
			
		||||
		../docs/source \
 | 
			
		||||
		$(CURDIR)/debian/compute-doc/usr/share/doc/compute-doc/html
 | 
			
		||||
	dh_sphinxdoc
 | 
			
		||||
endif
 | 
			
		||||
		Reference in New Issue
	
	Block a user