]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
Build: Allow to build debian packages of pakfire debian-build
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 26 Apr 2023 09:57:52 +0000 (11:57 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Fri, 28 Apr 2023 19:51:41 +0000 (21:51 +0200)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
12 files changed:
Makefile.am
debian/build.sh [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/genchangelog.sh [new file with mode: 0755]
debian/gensymbols.sh [new file with mode: 0755]
debian/libpakfire-dev.install [new file with mode: 0644]
debian/libpakfire0.install [new file with mode: 0644]
debian/pakfire.install [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/source/format [new file with mode: 0644]

index e70b08ce5b237c28b987fcc220b5ad740cda2ec8..365be9288066c345396b8ea2b23cdd3bbb231906 100644 (file)
@@ -932,3 +932,19 @@ EXTRA_DIST += \
 .PHONY: clean-local-check
 clean-local-check:
        -rm -rf $(TEST_ROOTFS)/*
+
+EXTRA_DIST += \
+       debian/build.sh \
+       debian/changelog \
+       debian/control \
+       debian/copyright \
+       debian/genchangelog.sh \
+       debian/libpakfire0.install \
+       debian/libpakfire-dev.install \
+       debian/pakfire.install \
+       debian/rules \
+       debian/source/format
+
+.PHONY: debian
+debian: dist
+       $(SHELL) debian/build.sh $(PACKAGE_NAME)-$(PACKAGE_VERSION) $(distdir).tar.gz
diff --git a/debian/build.sh b/debian/build.sh
new file mode 100644 (file)
index 0000000..4b955b8
--- /dev/null
@@ -0,0 +1,88 @@
+#!/bin/bash
+
+ARCHITECTURES=( amd64 )
+RELEASES=( bullseye )
+
+CHROOT_PATH="/var/tmp"
+
+main() {
+    if [ $# -lt 2 ]; then
+        echo "Not enough arguments" >&2
+        return 2
+    fi
+
+    # Get host architecture
+    local host_arch="$(dpkg --print-architecture)"
+    if [ -z "${host_arch}" ]; then
+        echo "Could not discover host architecture" >&2
+        return 1
+    fi
+
+    local package="${1}"
+    local sources="${2}"
+
+    # Create some temporary directory
+    local tmp="$(mktemp -d)"
+
+    # Extract the sources into it
+    mkdir -p "${tmp}/sources"
+    tar xvfa "${sources}" -C "${tmp}/sources"
+
+    # Copy the tarball under the correct Debian name
+    cp -vf "${sources}" "${tmp}/sources/${package//-/_}.orig.tar.gz"
+
+    # Change into temporary directory
+    pushd "${tmp}"
+
+    # Build the package for each release
+    local release
+    for release in ${RELEASES[@]}; do
+        local chroot="${release}-${host_arch}-sbuild"
+
+        mkdir -p "${release}"
+        pushd "${release}"
+
+        # Create a chroot environment
+        if [ ! -d "/etc/sbuild/chroot/${chroot}" ]; then
+            if ! sbuild-createchroot --arch="${host_arch}" "${release}" \
+                    "${CHROOT_PATH}/${chroot}"; then
+                echo "Could not create chroot for ${release} on ${host_arch}" >&2
+                rm -rf "${tmp}"
+                return 1
+            fi
+        fi
+
+        # And for each architecture we want to support
+        local arch
+        for arch in ${ARCHITECTURES[@]}; do
+            mkdir -p "${arch}"
+            pushd "${arch}"
+
+            # Copy sources
+            cp -r "${tmp}/sources" .
+
+            # Run the build process
+            if ! sbuild --dist="${release}" --host="${arch}" --source "sources/${package}"; then
+                echo "Could not build package for ${release} on ${arch}" >&2
+                rm -rf "${tmp}"
+                return 1
+            fi
+
+            # Remove the sources
+            rm -rf "sources/${package}"
+            popd
+        done
+        popd
+    done
+
+    # Remove sources
+    rm -rf "${tmp}/sources"
+    popd
+
+    # Done!
+    echo "SUCCESS!"
+    echo "  You can find your Debian packages in ${tmp}"
+    return 0
+}
+
+main "$@" || exit $?
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..5e6284d
--- /dev/null
@@ -0,0 +1,5 @@
+pakfire (0.9.28-1) unstable; urgency=medium
+
+  * Initial release.
+
+ -- Stefan Schantl <stefan.schantl@ipfire.org>  Sun, 27 Oct 2019 18:55:44 +0100
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..789fb95
--- /dev/null
@@ -0,0 +1,88 @@
+Source: pakfire
+Maintainer: Stefan Schantl <stefan.schantl@ipfire.org>
+Section: misc
+Priority: optional
+Standards-Version: 4.6.1
+Build-Depends:
+ debhelper-compat (= 13),
+ dh-sequence-python3,
+ asciidoc,
+ autoconf,
+ automake,
+ bison,
+ flex,
+ intltool,
+ libarchive-dev,
+ libcap-dev,
+ libcurl4-openssl-dev,
+ libelf-dev,
+ libgpgme-dev,
+ libjson-c-dev,
+ liblzma-dev,
+ libmagic-dev,
+ libmount-dev,
+ libpcre2-dev,
+ libseccomp-dev,
+ libsolv-dev,
+ libsqlite3-dev,
+ libssl-dev,
+ libsystemd-dev,
+ libzstd-dev,
+ pkg-config,
+ python3-all-dev,
+ python3-cpuinfo,
+ python3-kerberos,
+ python3-systemd,
+ python3-tornado,
+ python3-psutil,
+ python3-setproctitle,
+ systemd,
+ uuid-dev,
+ xsltproc,
+ docbook-xsl,
+ git,
+Rules-Requires-Root: no
+Homepage: https://pakfire.ipfire.org/
+Vcs-Git: https://git.ipfire.org/pub/git/pakfire/pakfire.git
+Vcs-Browser: https://git.ipfire.org/pub/git/pakfire/pakfire.git
+Description: Package management and build system for IPFire 3.x.
+ Pakfire combines the package management and the build system for IPFire 3.x
+ in one tool.
+
+Package: libpakfire0
+Architecture: any
+Section: libs
+Depends:
+ ${shlibs:Depends},
+ ${misc:Depends},
+Recommends:
+ pakfire,
+Multi-Arch: same
+Description: ${source:Synopsis}
+ ${source:Extended-Description}
+ .
+ This package provides the shared library.
+
+Package: libpakfire-dev
+Architecture: any
+Section: libdevel
+Depends:
+ libpakfire0 (= ${binary:Version}),
+ ${misc:Depends},
+Multi-Arch: same
+Description: ${source:Synopsis} (development files)
+ ${source:Extended-Description}
+ .
+ This package provides the headers and development files needed to use
+ libpakfire in your own programs.
+
+Package: pakfire
+Architecture: any
+Depends:
+ ${misc:Depends},
+ ${python3:Depends},
+ ${shlibs:Depends},
+Description: ${source:Synopsis}
+ ${source:Extended-Description}
+ .
+ This package provides the pakfire tools.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..e4c3a2d
--- /dev/null
@@ -0,0 +1,26 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: pakfire
+Upstream-Contact: Michael Tremer <michael.tremer@ipfire.org>
+Source: https://source.ipfire.org/releases/pakfire/
+
+Files: *
+Copyright: 2017-2023 IPFire Development team <info@ipfire.org>
+License: LGPL-2.1
+
+Files: debian/*
+Copyright: 2023 Stefan Schantl <stefan.schantl@ipfire.org>
+License: LGPL-2.1
+
+License: LGPL-2.1
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; version 2.1 of the License, or (at
+ your option) any later version.
+ .
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ .
+ The complete text of the GNU General Public License
+ can be found in /usr/share/common-licenses/LGPL-2.1 file.
+ .
diff --git a/debian/genchangelog.sh b/debian/genchangelog.sh
new file mode 100755 (executable)
index 0000000..ab1c198
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/bash -e
+gitshow () {
+  local format=$1
+  local commit=$2
+
+  git show --no-patch --format=format:"$format" "$commit"
+}
+
+main () {
+  if [ $# -lt 1 ]; then
+    local bn="$(basename $0)"
+    echo "Usage:    $bn  <commit range>" >&2
+    echo "Example:  $bn  0.9.7..HEAD" >&2
+    echo "Example:  $bn  0.9.5..0.9.6^" >&2
+    return 1
+  fi
+
+  local commitrange=$1
+
+  local commit
+  for commit in $(git rev-list --reverse "$commitrange"); do
+    # Skip commits with diffs that only have Makefile.am or d/ changes.
+    if [ "$(git diff --name-only "${commit}^..${commit}" -- . ':^Makefile.am' ':^debian/' | wc -l)" == 0 ]; then
+      continue
+    fi
+
+    local author_name="$(gitshow %an "$commit")"
+    local author_email="$(gitshow %ae "$commit")"
+    local subject="$(gitshow %s "$commit")"
+
+    echo "$author_name <$author_email>  $subject"
+    DEBFULLNAME="$author_name" DEBEMAIL="$author_email" debchange --upstream --multimaint-merge "$subject"
+  done
+
+  debchange --release ''
+}
+
+main "$@" || exit $?
diff --git a/debian/gensymbols.sh b/debian/gensymbols.sh
new file mode 100755 (executable)
index 0000000..8523556
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/bash
+SYMBOLS_PKG=libloc1
+LOCAL_FILE=debian/libloc1.symbols
+TEMP_FILE="$(mktemp --tmpdir libloc1.XXXXXX.symbols)"
+trap "rm -f ${TEMP_FILE}" EXIT
+
+generate () {
+  intltoolize --force --automake
+  autoreconf --install --symlink
+  ./configure CFLAGS='-g -O0' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
+
+  make
+
+  dpkg-gensymbols -p"$SYMBOLS_PKG" -O"$TEMP_FILE" -esrc/.libs/libloc.so.*
+  sed -i -E -e 's/( [0-9\.]+)-.+$/\1/' "$TEMP_FILE"
+
+  make clean
+}
+
+main () {
+  local maxver='0.0.0'
+  if [ -f "$LOCAL_FILE" ]; then
+    cp "$LOCAL_FILE" "$TEMP_FILE"
+    maxver="$(grep -E '^ ' "$LOCAL_FILE" | cut -d' ' -f3 | sort -Vru | head -n1)"
+    echo "Latest version checked: $maxver"
+  fi
+
+
+  local tag
+  for tag in $(git tag -l --sort=version:refname)
+  do
+    if [ "$(echo -e "${maxver}\n${tag}" | sort -Vr | head -n1)" == "$maxver" ]; then
+      echo "Tag $tag -- skip"
+      continue
+    fi
+
+    echo "Tag $tag -- checking"
+    git switch --quiet --detach "$tag" || return 1
+    generate || return 1
+    git switch --quiet - || return 1
+  done
+
+  echo "Current -- checking"
+  generate || return 1
+
+  mv "$TEMP_FILE" "$LOCAL_FILE"
+  chmod 644 "$LOCAL_FILE"
+}
+
+main "$@" || exit $?
diff --git a/debian/libpakfire-dev.install b/debian/libpakfire-dev.install
new file mode 100644 (file)
index 0000000..5ca3138
--- /dev/null
@@ -0,0 +1,2 @@
+usr/include/pakfire
+usr/lib/*/libpakfire.so
diff --git a/debian/libpakfire0.install b/debian/libpakfire0.install
new file mode 100644 (file)
index 0000000..47facd7
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/*/libpakfire.so.*
diff --git a/debian/pakfire.install b/debian/pakfire.install
new file mode 100644 (file)
index 0000000..1f75915
--- /dev/null
@@ -0,0 +1,6 @@
+etc/pakfire/*
+lib/systemd/*
+usr/bin/*
+usr/lib/pakfire/*
+usr/lib/python3*
+usr/share/*
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..ce35ff2
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/make -f
+
+export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+
+export PYBUILD_SYSTEM=custom
+
+export PYBUILD_CLEAN_ARGS=dh_auto_clean
+
+export PYBUILD_CONFIGURE_ARGS=intltoolize --force --automake; \
+       PYTHON={interpreter} dh_auto_configure --
+
+export PYBUILD_BUILD_ARGS=dh_auto_build
+
+export PYBUILD_INSTALL_ARGS=dh_auto_install --destdir={destdir}; \
+       mkdir -p {destdir}/usr/lib/python{version}/dist-packages; \
+       mv -v {destdir}/usr/lib/python3/dist-packages/pakfire {destdir}/usr/lib/python{version}/dist-packages/pakfire; \
+       rm -vf {destdir}/usr/lib/python*/*-packages/pakfire/_pakfire.la; \
+       rm -vf {destdir}/usr/lib/*/libpakfire.la
+
+#export PYBUILD_TEST_ARGS=dh_auto_test
+
+%:
+       dh $@ --buildsystem=pybuild
diff --git a/debian/source/format b/debian/source/format
new file mode 100644 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)