From b825738de2f33ffd893f4d1fd2c777d1a7436d32 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Thu, 31 Dec 2020 05:19:23 +0100 Subject: added debian packaging --- .github/workflows/yatr.yaml | 8 +++- .gitignore | 13 ++++++ .yatr.yml | 3 ++ build-aux/build-debian.sh | 94 +++++++++++++++++++++++++++++++++++++++ debian/blogc-git-receiver.install | 2 + debian/blogc-make.install | 3 ++ debian/blogc-runserver.install | 2 + debian/blogc.install | 6 +++ debian/changelog | 5 +++ debian/control | 41 +++++++++++++++++ debian/copyright | 61 +++++++++++++++++++++++++ debian/rules | 16 +++++++ debian/source/format | 1 + 13 files changed, 254 insertions(+), 1 deletion(-) create mode 100755 build-aux/build-debian.sh create mode 100644 debian/blogc-git-receiver.install create mode 100644 debian/blogc-make.install create mode 100644 debian/blogc-runserver.install create mode 100644 debian/blogc.install create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/.github/workflows/yatr.yaml b/.github/workflows/yatr.yaml index 427a174..74b23d2 100644 --- a/.github/workflows/yatr.yaml +++ b/.github/workflows/yatr.yaml @@ -28,6 +28,9 @@ jobs: - target: dist-srpm compiler: gcc image: ubuntu-20.04 + - target: debian + compiler: gcc + image: ubuntu-20.04 - target: static compiler: gcc image: ubuntu-20.04 @@ -50,7 +53,7 @@ jobs: if [[ "x${{ matrix.image }}" = xubuntu-* ]]; then sudo gem install ronn sudo apt-get update -y - if [[ "x${{ matrix.target }}" = *check* ]] || [[ "x${{ matrix.target }}" = xvalgrind ]]; then + if [[ "x${{ matrix.target }}" = *check* ]] || [[ "x${{ matrix.target }}" = xvalgrind ]] || [[ "x${{ matrix.target }}" = xdebian ]]; then sudo apt-get install -y libcmocka-dev fi if [[ "x${{ matrix.target }}" = xvalgrind ]]; then @@ -65,6 +68,9 @@ jobs: if [[ "x${{ matrix.target }}" = xwin64 ]]; then sudo apt-get install -y gcc-mingw-w64-x86-64 fi + if [[ "x${{ matrix.target }}" = xdebian ]]; then + sudo apt-get install -y cowbuilder debhelper pbuilder reprepro + fi elif [[ "x${{ matrix.image }}" = xmacos-* ]]; then gem install ronn brew install automake coreutils cmocka pkg-config diff --git a/.gitignore b/.gitignore index 659c5f2..a9a7f35 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,19 @@ Makefile.in !/build-aux/git-version-gen !/build-aux/valgrind.sh +# debian +debian/.debhelper +debian/autoreconf.* +debian/*.log +debian/*.substvars +debian/debhelper-build-stamp +debian/files +debian/blogc/ +debian/blogc-git-receiver/ +debian/blogc-make/ +debian/blogc-runserver/ +debian/tmp/ + # installed .m4 files /m4/*.m4 !/m4/ax_pthread.m4 diff --git a/.yatr.yml b/.yatr.yml index 5ce596e..03fd557 100644 --- a/.yatr.yml +++ b/.yatr.yml @@ -65,3 +65,6 @@ targets: - --disable-make - --disable-runserver task_script: build-aux/build-windows.sh + debian: + task_script: build-aux/build-debian.sh + archive_extract_filter: "blogc-deb-repo-*.tar.xz" diff --git a/build-aux/build-debian.sh b/build-aux/build-debian.sh new file mode 100755 index 0000000..1f9aa40 --- /dev/null +++ b/build-aux/build-debian.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +set -eo pipefail + +export DEBEMAIL="noreply@rafaelmartins.eng.br" +export DEBFULLNAME="Snapshot github-actions" + +download_pbuilder_chroots() { + local arch="amd64" + local os="$(uname -s | tr '[:upper:]' '[:lower:]')" + + local index="$(curl --silent https://distfiles.rgm.io/pbuilder-chroots/LATEST/)" + local archive="$(echo "${index}" | sed -n "s/.*\(pbuilder-chroots-${os}-${arch}-.*\)\.sha512.*/\1/p")" + local folder="$(echo "${index}" | sed -n "s/.*\(pbuilder-chroots-${os}-${arch}-.*\)\.tar.*\.sha512.*/\1/p")" + local p="$(echo "${folder}" | sed "s/pbuilder-chroots-${os}-${arch}-\(.*\)/pbuilder-chroots-\1/")" + + curl --fail --output "${archive}" "https://distfiles.rgm.io/pbuilder-chroots/${p}/${archive}" + curl --fail --output "${archive}.sha512" "https://distfiles.rgm.io/pbuilder-chroots/${p}/${archive}.sha512" + + sha512sum --check --status "${archive}.sha512" + + sudo rm -rf /tmp/pbuilder + fakeroot tar -xf "${archive}" -C /tmp +} + +create_reprepro_conf() { + for dist in "$@"; do + echo "Origin: blogc-snapshot" + echo "Label: blogc-snapshot" + echo "Codename: ${dist}" + echo "Architectures: amd64" + echo "Components: ${dist}" + echo "Description: Apt repository containing blogc snapshots" + echo + done +} + +download_pbuilder_chroots + +${MAKE_CMD:-make} dist-xz + +MY_PV="$(echo ${PV} | sed -e 's/-dirty//g' -e 's/-/./g')" +MY_P="${PN}_${MY_PV}" + +mv ${P}.tar.xz "../${MY_P}.orig.tar.xz" + +for dir in /tmp/pbuilder/*/base.cow; do + export DIST="$(basename "$(dirname "${dir}")" | cut -d- -f1)" + RES="${BUILDDIR}/deb/${DIST}" + mkdir -p "${RES}" + + rm -rf "../${P}" + tar -xf "../${MY_P}.orig.tar.xz" -C .. + cp -r ../debian "../${P}/" + + pushd "../${P}" > /dev/null + + # do not mess with changelog for releases, it should be done manually during version bump + if [[ ${PV} == *-* ]]; then + dch \ + --distribution "${DIST}" \ + --newversion "${MY_PV}-1" \ + "snapshot" + fi + + pdebuild \ + --pbuilder cowbuilder \ + --buildresult "${RES}" \ + -- --basepath "${dir}" + + popd > /dev/null + +done + +DISTS="$(ls -1 "${BUILDDIR}/deb")" + +mkdir -p "${BUILDDIR}/deb-repo/conf" +create_reprepro_conf ${DISTS} > "${BUILDDIR}/deb-repo/conf/distributions" + +pushd "${BUILDDIR}/deb-repo" > /dev/null + +for dist in ${DISTS}; do + for deb in "../deb/${dist}"/*.deb; do + reprepro includedeb "${dist}" "${deb}" + done +done + +popd > /dev/null + +tar \ + -cJf "blogc-deb-repo-${PV}.tar.xz" \ + --exclude ./deb-repo/conf \ + --exclude ./deb-repo/db \ + ./deb-repo diff --git a/debian/blogc-git-receiver.install b/debian/blogc-git-receiver.install new file mode 100644 index 0000000..ede6da4 --- /dev/null +++ b/debian/blogc-git-receiver.install @@ -0,0 +1,2 @@ +usr/bin/blogc-git-receiver +usr/share/man/man1/blogc-git-receiver.1 diff --git a/debian/blogc-make.install b/debian/blogc-make.install new file mode 100644 index 0000000..44c459a --- /dev/null +++ b/debian/blogc-make.install @@ -0,0 +1,3 @@ +usr/bin/blogc-make +usr/share/man/man1/blogc-make.1 +usr/share/man/man5/blogcfile.5 diff --git a/debian/blogc-runserver.install b/debian/blogc-runserver.install new file mode 100644 index 0000000..debadc7 --- /dev/null +++ b/debian/blogc-runserver.install @@ -0,0 +1,2 @@ +usr/bin/blogc-runserver +usr/share/man/man1/blogc-runserver.1 diff --git a/debian/blogc.install b/debian/blogc.install new file mode 100644 index 0000000..edb9ae3 --- /dev/null +++ b/debian/blogc.install @@ -0,0 +1,6 @@ +usr/bin/blogc +usr/share/man/man1/blogc.1 +usr/share/man/man7/blogc-pagination.7 +usr/share/man/man7/blogc-source.7 +usr/share/man/man7/blogc-template.7 +usr/share/man/man7/blogc-toctree.7 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..e9b7951 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +blogc (0.20.0-1) unstable; urgency=medium + + * Initial release + + -- Rafael G. Martins Fri, 25 Dec 2020 05:48:28 +0100 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..4f1b654 --- /dev/null +++ b/debian/control @@ -0,0 +1,41 @@ +Source: blogc +Section: text +Priority: optional +Maintainer: Rafael G. Martins +Build-Depends: debhelper-compat (= 12), + git, + libcmocka-dev, + pkg-config +Standards-Version: 4.5.1 +Homepage: https://blogc.rgm.io/ +Vcs-Browser: https://gio.rgm.io/debian/blogc +Vcs-Git: https://git.rgm.io/git/debian/blogc.git +Rules-Requires-Root: no + +Package: blogc +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Blog compiler + Main binary + +Package: blogc-git-receiver +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, + git, + make +Description: Blog compiler + blogc-git-receiver binary + +Package: blogc-make +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, + blogc, + blogc-runserver +Description: Blog compiler + blogc-make binary + +Package: blogc-runserver +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Blog compiler + blogc-runserver binary diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..0559f14 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,61 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: blogc +Upstream-Contact: Rafael G. Martins +Source: https://git.rgm.io/blogc + +Files: * +Copyright: 2014-2020, Rafael G. Martins +License: BSD-3-Clause + +Files: debian/* +Copyright: 2020 Rafael G. Martins +License: BSD-3-Clause + +Files: src/common/utf8.c +Copyright: 2008-2010 Bjoern Hoehrmann + 2014-2019 Rafael G. Martins +License: MIT + +License: BSD-3-Clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HOLDERS OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..ca63b74 --- /dev/null +++ b/debian/rules @@ -0,0 +1,16 @@ +#!/usr/bin/make -f + +#export DH_VERBOSE = 1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + +%: + dh $@ + +override_dh_auto_configure: + dh_auto_configure -- \ + --disable-ronn \ + --enable-git-receiver \ + --enable-make \ + --enable-runserver 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) -- cgit v1.2.3-18-g5258