From bbb5840e03b53d95a7c6e70403bc5f0c5b489f3b Mon Sep 17 00:00:00 2001 From: Dmitriy Zabolotskiy Date: Thu, 27 Oct 2022 16:50:54 +0300 Subject: [PATCH] [#11] Add Debian packaging - uses "make all" to download and build database - packages it to debian package to be placed in /var/lib/neofs/ir Using: ```make debpackage``` Signed-off-by: Dmitriy Zabolotskiy --- .gitignore | 4 +++- Makefile | 21 ++++++++++++++++++++- debian/changelog | 6 ++++++ debian/control | 17 +++++++++++++++++ debian/copyright | 11 +++++++++++ debian/neofs-locode-db.install | 1 + debian/rules | 17 +++++++++++++++++ debian/source/format | 1 + 8 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/neofs-locode-db.install create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/.gitignore b/.gitignore index de9e96a..35dc291 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ tmp/ in/ -locode_db \ No newline at end of file +locode_db +# debhelpers +**/.debhelper diff --git a/Makefile b/Makefile index 19f7c80..ad211bc 100644 --- a/Makefile +++ b/Makefile @@ -3,12 +3,18 @@ VERSION ?= "$(shell git describe --tags --match "v*" --dirty --always --abbrev=8 2>/dev/null || cat VERSION 2>/dev/null || echo "develop")" NEOFSCLI ?= neofs-cli -.PHONY: all clean version help unlocode +.PHONY: all clean version help unlocode debpackage DIRS = in tmp space := $(subst ,, ) +# .deb package versioning +OS_RELEASE = $(shell lsb_release -cs) +PKG_VERSION ?= $(shell echo $(VERSION) | sed "s/^v//" | \ + sed -E "s/(.*)-(g[a-fA-F0-9]{6,8})(.*)/\1\3~\2/" | \ + sed "s/-/~/")-${OS_RELEASE} + all: $(DIRS) locode_db $(DIRS): @@ -56,3 +62,16 @@ clean: rm -f in/* rm -f tmp/* rm -f locode_db + +# Package for Debian +debpackage: + dch --package neofs-locode-db \ + --controlmaint \ + --newversion $(PKG_VERSION) \ + --force-bad-version \ + --distribution $(OS_RELEASE) \ + "Please see CHANGELOG.md for code changes for $(VERSION)" + dpkg-buildpackage --no-sign -b + +debclean: + dh clean diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..5712531 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +neofs-locode-db (0.2.1) stable; urgency=medium + + * Initial change. + + -- NeoSPCC Wed, 19 Oct 2022 12:33:04 +0300 + diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..7875bd5 --- /dev/null +++ b/debian/control @@ -0,0 +1,17 @@ +Source: neofs-locode-db +Section: misc +Priority: optional +Maintainer: NeoSPCC +Build-Depends: debhelper-compat (= 13), git, devscripts, wget, neofs-cli +Standards-Version: 4.5.1 +Homepage: https://fs.neo.org/ +Vcs-Git: https://github.com/nspcc-dev/neofs-locode-db.git +Vcs-Browser: https://github.com/nspcc-dev/neofs-locode-db + +Package: neofs-locode-db +Architecture: any +Depends: ${misc:Depends} +Description: Compiled UN/LOCODE database for NeoFS + NeoFS uses UN/LOCODE in storage node attributes and storage policies. + Inner ring nodes converts UN/LOCODE into human-readable set of attributes + such as continent, country name, etc. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..a2dffe6 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,11 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: neofs-locode-db +Upstream-Contact: tech@nspcc.ru +Source: https://github.com/nspcc-dev/neofs-locode-db + +Files: * +Copyright: 2018-2022 NeoSPCC (@nspcc-dev) + +License: CC-BY-SA-4.0 + This project is licensed under the CC Attribution-ShareAlike 4.0 International + https://creativecommons.org/licenses/by-sa/4.0/legalcode diff --git a/debian/neofs-locode-db.install b/debian/neofs-locode-db.install new file mode 100644 index 0000000..9b15438 --- /dev/null +++ b/debian/neofs-locode-db.install @@ -0,0 +1 @@ +locode_db var/lib/neofs/ir diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..d80f961 --- /dev/null +++ b/debian/rules @@ -0,0 +1,17 @@ +#!/usr/bin/make -f + +export DEB_BUILD_OPTIONS := nostrip nocheck + +%: + dh $@ + +override_dh_auto_build: + $(MAKE) all + +override_dh_installchangelogs: + dh_installchangelogs -k CHANGELOG.md + +override_dh_clean: + dh_clean + rm -f locode_db + \ No newline at end of file diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt)