From a049dd2953a1fb655d33ca2cf2f90cf85646d8d7 Mon Sep 17 00:00:00 2001 From: Kevin Gallagher Date: Wed, 26 Oct 2016 15:36:24 -0700 Subject: [PATCH 1/9] Use fakeroot to build Debian package --- zcutil/build-debian-package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zcutil/build-debian-package.sh b/zcutil/build-debian-package.sh index 07c0e0e2..4d2dc58f 100755 --- a/zcutil/build-debian-package.sh +++ b/zcutil/build-debian-package.sh @@ -29,7 +29,7 @@ cp $SRC_PATH/src/zcash-cli $BUILD_DIR/usr/bin/ cp $SRC_PATH/zcutil/fetch-params.sh $BUILD_DIR/usr/bin/zcash-fetch-params # Create the deb package -dpkg-deb --build $BUILD_DIR +fakeroot dpkg-deb --build $BUILD_DIR cp $BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-amd64.deb $SRC_PATH exit 0 From b37870bbf3ffd65e8c85ef0c38647188891c2c62 Mon Sep 17 00:00:00 2001 From: Kevin Gallagher Date: Wed, 26 Oct 2016 15:59:32 -0700 Subject: [PATCH 2/9] Update Debian package maintainer scripts --- contrib/DEBIAN/postinst | 6 ++++-- contrib/DEBIAN/postrm | 14 ++++---------- contrib/DEBIAN/preinst | 10 ++++------ contrib/DEBIAN/prerm | 7 ++----- 4 files changed, 14 insertions(+), 23 deletions(-) mode change 100755 => 100644 contrib/DEBIAN/postinst mode change 100755 => 100644 contrib/DEBIAN/postrm mode change 100755 => 100644 contrib/DEBIAN/preinst mode change 100755 => 100644 contrib/DEBIAN/prerm diff --git a/contrib/DEBIAN/postinst b/contrib/DEBIAN/postinst old mode 100755 new mode 100644 index 43294f71..2e6ff8a8 --- a/contrib/DEBIAN/postinst +++ b/contrib/DEBIAN/postinst @@ -2,8 +2,9 @@ # postinst script for zcash # # see: dh_installdeb(1) + set -e -set -x + # summary of how this script can be called: # * `configure' # * `abort-upgrade' @@ -13,9 +14,10 @@ set -x # * `abort-deconfigure' `in-favour' # `removing' # -# for details, see http://www.debian.org/doc/debian-policy/ or +# for details, see https://www.debian.org/doc/debian-policy/ or # the debian-policy package + case "$1" in configure) ;; diff --git a/contrib/DEBIAN/postrm b/contrib/DEBIAN/postrm old mode 100755 new mode 100644 index f397166f..bb442a68 --- a/contrib/DEBIAN/postrm +++ b/contrib/DEBIAN/postrm @@ -4,7 +4,7 @@ # see: dh_installdeb(1) set -e -#set -x + # summary of how this script can be called: # * `remove' # * `purge' @@ -15,18 +15,12 @@ set -e # * `abort-upgrade' # * `disappear' # -# for details, see http://www.debian.org/doc/debian-policy/ or +# for details, see https://www.debian.org/doc/debian-policy/ or # the debian-policy package -. /usr/share/debconf/confmodule + case "$1" in - upgrade|failed-upgrade) - ;; - - remove|abort-install|abort-upgrade|disappear) - ;; - - purge) + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; *) diff --git a/contrib/DEBIAN/preinst b/contrib/DEBIAN/preinst old mode 100755 new mode 100644 index f07c5a24..7587b4a8 --- a/contrib/DEBIAN/preinst +++ b/contrib/DEBIAN/preinst @@ -4,20 +4,18 @@ # see: dh_installdeb(1) set -e -#set -x + # summary of how this script can be called: # * `install' # * `install' # * `upgrade' # * `abort-upgrade' -# for details, see http://www.debian.org/doc/debian-policy/ or +# for details, see https://www.debian.org/doc/debian-policy/ or # the debian-policy package -case "$1" in - install) - ;; - upgrade) +case "$1" in + install|upgrade) ;; abort-upgrade) diff --git a/contrib/DEBIAN/prerm b/contrib/DEBIAN/prerm old mode 100755 new mode 100644 index 5b269782..6a4f8c03 --- a/contrib/DEBIAN/prerm +++ b/contrib/DEBIAN/prerm @@ -13,15 +13,12 @@ set -e # * `deconfigure' `in-favour' # `removing' # -# for details, see http://www.debian.org/doc/debian-policy/ or +# for details, see https://www.debian.org/doc/debian-policy/ or # the debian-policy package case "$1" in - remove|deconfigure) - ;; - - upgrade) + remove|upgrade|deconfigure) ;; failed-upgrade) From 8764ae0eb73949b942c47cbefd32989bf9a71fb9 Mon Sep 17 00:00:00 2001 From: Kevin Gallagher Date: Wed, 26 Oct 2016 16:10:34 -0700 Subject: [PATCH 3/9] Fixes executable mode of maintainer scripts --- contrib/DEBIAN/postinst | 0 contrib/DEBIAN/postrm | 0 contrib/DEBIAN/preinst | 0 contrib/DEBIAN/prerm | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 contrib/DEBIAN/postinst mode change 100644 => 100755 contrib/DEBIAN/postrm mode change 100644 => 100755 contrib/DEBIAN/preinst mode change 100644 => 100755 contrib/DEBIAN/prerm diff --git a/contrib/DEBIAN/postinst b/contrib/DEBIAN/postinst old mode 100644 new mode 100755 diff --git a/contrib/DEBIAN/postrm b/contrib/DEBIAN/postrm old mode 100644 new mode 100755 diff --git a/contrib/DEBIAN/preinst b/contrib/DEBIAN/preinst old mode 100644 new mode 100755 diff --git a/contrib/DEBIAN/prerm b/contrib/DEBIAN/prerm old mode 100644 new mode 100755 From 71cf68da488fda0dc82e612612e8bad171657e22 Mon Sep 17 00:00:00 2001 From: Kevin Gallagher Date: Wed, 26 Oct 2016 16:10:55 -0700 Subject: [PATCH 4/9] Add DEBIAN/rules file (required by policy) --- contrib/DEBIAN/rules | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 contrib/DEBIAN/rules diff --git a/contrib/DEBIAN/rules b/contrib/DEBIAN/rules new file mode 100755 index 00000000..b79cce59 --- /dev/null +++ b/contrib/DEBIAN/rules @@ -0,0 +1,25 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + + +%: + dh $@ --with autotools_dev + + +# dh_make generated override targets +# This is example for Cmake (See https://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) + From 590480bc750f59d1adc47153b6756baf2866e516 Mon Sep 17 00:00:00 2001 From: Kevin Gallagher Date: Wed, 26 Oct 2016 16:24:35 -0700 Subject: [PATCH 5/9] Adds zcash.examples and zcash.manpages --- contrib/DEBIAN/zcash.examples | 1 + contrib/DEBIAN/zcash.manpages | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 contrib/DEBIAN/zcash.examples create mode 100644 contrib/DEBIAN/zcash.manpages diff --git a/contrib/DEBIAN/zcash.examples b/contrib/DEBIAN/zcash.examples new file mode 100644 index 00000000..924659c0 --- /dev/null +++ b/contrib/DEBIAN/zcash.examples @@ -0,0 +1 @@ +DEBIAN/examples/zcash.conf diff --git a/contrib/DEBIAN/zcash.manpages b/contrib/DEBIAN/zcash.manpages new file mode 100644 index 00000000..a1115f67 --- /dev/null +++ b/contrib/DEBIAN/zcash.manpages @@ -0,0 +1,2 @@ +DEBIAN/manpages/zcash-cli.1 +DEBIAN/manpages/zcashd.1 From b7f7def877f839ad685a7a2f83b5e57fe7d97879 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 27 Oct 2016 08:43:07 -0700 Subject: [PATCH 6/9] Rework zcutil/build-debian-package.sh to place files correctly See http://www.tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/ for a guide on how to prepare a distribution for using dpkg-deb. --- zcutil/build-debian-package.sh | 37 +++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/zcutil/build-debian-package.sh b/zcutil/build-debian-package.sh index 4d2dc58f..0bf2b5a1 100755 --- a/zcutil/build-debian-package.sh +++ b/zcutil/build-debian-package.sh @@ -8,6 +8,7 @@ set -x BUILD_PATH="/tmp/zcbuild" PACKAGE_NAME="zcash" SRC_PATH=`pwd` +SRC_DEB=$SRC_PATH/contrib/DEBIAN umask 022 @@ -21,12 +22,38 @@ BUILD_DIR="$BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-amd64" if [ -d $BUILD_DIR ]; then rm -R $BUILD_DIR fi -mkdir -p $BUILD_DIR/DEBIAN $BUILD_DIR/usr/bin -cp -r $SRC_PATH/contrib/DEBIAN/* $BUILD_DIR/DEBIAN/ -cp $SRC_PATH/src/zcashd $BUILD_DIR/usr/bin/ -cp $SRC_PATH/src/zcash-cli $BUILD_DIR/usr/bin/ -cp $SRC_PATH/zcutil/fetch-params.sh $BUILD_DIR/usr/bin/zcash-fetch-params +DEB_BIN=$BUILD_DIR/usr/bin +DEB_DOC=$BUILD_DIR/usr/share/doc/$PACKAGE_NAME +DEB_MAN=$BUILD_DIR/usr/share/man/man1 +mkdir -p $BUILD_DIR/DEBIAN $DEB_BIN $DEB_DOC $DEB_MAN +chmod 0755 -R $BUILD_DIR/* + +# Copy control +cp $SRC_DEB/control $BUILD_DIR/DEBIAN +# Currently empty +#cp $SRC_DEB/postinst $BUILD_DIR/DEBIAN +#cp $SRC_DEB/postrm $BUILD_DIR/DEBIAN +#cp $SRC_DEB/preinst $BUILD_DIR/DEBIAN +#cp $SRC_DEB/prerm $BUILD_DIR/DEBIAN +cp $SRC_DEB/rules $BUILD_DIR/DEBIAN +# Copy binaries +cp $SRC_PATH/src/zcashd $DEB_BIN +cp $SRC_PATH/src/zcash-cli $DEB_BIN +cp $SRC_PATH/zcutil/fetch-params.sh $DEB_BIN/zcash-fetch-params +# Copy docs +cp $SRC_PATH/doc/release-notes/release-notes-$PACKAGE_VERSION.md $DEB_DOC/changelog +cp $SRC_DEB/changelog $DEB_DOC/changelog.Debian +cp $SRC_DEB/copyright $DEB_DOC +cp -r $SRC_DEB/examples $DEB_DOC +# Copy manpages +cp $SRC_DEB/manpages/zcashd.1 $DEB_MAN +cp $SRC_DEB/manpages/zcash-cli.1 $DEB_MAN +# Gzip files +gzip --best -n $DEB_DOC/changelog +gzip --best -n $DEB_DOC/changelog.Debian +gzip --best -n $DEB_MAN/zcashd.1 +gzip --best -n $DEB_MAN/zcash-cli.1 # Create the deb package fakeroot dpkg-deb --build $BUILD_DIR From acb8bbe4fe18c83e31dae0828425320e67671d30 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 27 Oct 2016 08:44:44 -0700 Subject: [PATCH 7/9] Add lintian check to zcutil/build-debian-package.sh --- zcutil/build-debian-package.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/zcutil/build-debian-package.sh b/zcutil/build-debian-package.sh index 0bf2b5a1..9e4fee11 100755 --- a/zcutil/build-debian-package.sh +++ b/zcutil/build-debian-package.sh @@ -57,6 +57,7 @@ gzip --best -n $DEB_MAN/zcash-cli.1 # Create the deb package fakeroot dpkg-deb --build $BUILD_DIR +lintian -i $BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-amd64.deb cp $BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-amd64.deb $SRC_PATH exit 0 From 31cc0d086119e597881e0e9875b6aa0d08abd6a0 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 27 Oct 2016 08:45:16 -0700 Subject: [PATCH 8/9] Fix DEBIAN/control errors raised by lintian --- contrib/DEBIAN/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/DEBIAN/control b/contrib/DEBIAN/control index 6d3b8d12..726a4440 100644 --- a/contrib/DEBIAN/control +++ b/contrib/DEBIAN/control @@ -7,13 +7,13 @@ Build-Depends: autoconf, automake, bsdmainutils, build-essential git, g++-multilib, libc6-dev, libtool m4, ncurses-dev, pkg-config, python unzip, wget, zlib1g-dev -Vcs-Git: git@github.com:zcash/zcash.git +Vcs-Git: https://github.com/zcash/zcash.git Vcs-Browser: https://github.com/zcash/zcash Package: zcash Version: 1.0.0-rc2 Architecture: amd64 Depends: libgomp1 -Description: Zcash is an implementation of the "Zerocash" protocol. +Description: An implementation of the "Zerocash" protocol. Based on Bitcoin's code, it intends to offer a far higher standard of privacy and anonymity through a sophisticiated zero-knowledge proving scheme which preserves confidentiality of transaction metadata. From fa7261bd442de05f6c48494e71086b7bb6d12a17 Mon Sep 17 00:00:00 2001 From: Kevin Gallagher Date: Thu, 27 Oct 2016 09:08:38 -0700 Subject: [PATCH 9/9] Run Lintian after built package is copied to $SRC_PATH Because of `set -e`, if there are any warnings, then the package won't be copied back to the source directory. For now, there are definitely going to remain some Lintian warnings which we'll want to ignore. Also updates comments to make them more descriptive. --- zcutil/build-debian-package.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zcutil/build-debian-package.sh b/zcutil/build-debian-package.sh index 9e4fee11..9b48b784 100755 --- a/zcutil/build-debian-package.sh +++ b/zcutil/build-debian-package.sh @@ -1,6 +1,6 @@ #!/bin/bash ## Usage: -## ./build_DEBIAN_package.sh +## ./zcutil/build-debian-package.sh set -e set -x @@ -29,9 +29,9 @@ DEB_MAN=$BUILD_DIR/usr/share/man/man1 mkdir -p $BUILD_DIR/DEBIAN $DEB_BIN $DEB_DOC $DEB_MAN chmod 0755 -R $BUILD_DIR/* -# Copy control +# Copy control file cp $SRC_DEB/control $BUILD_DIR/DEBIAN -# Currently empty +# Package maintainer scripts (currently empty) #cp $SRC_DEB/postinst $BUILD_DIR/DEBIAN #cp $SRC_DEB/postrm $BUILD_DIR/DEBIAN #cp $SRC_DEB/preinst $BUILD_DIR/DEBIAN @@ -55,9 +55,9 @@ gzip --best -n $DEB_DOC/changelog.Debian gzip --best -n $DEB_MAN/zcashd.1 gzip --best -n $DEB_MAN/zcash-cli.1 -# Create the deb package +# Create the Debian package fakeroot dpkg-deb --build $BUILD_DIR -lintian -i $BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-amd64.deb cp $BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-amd64.deb $SRC_PATH - +# Analyze with Lintian, reporting bugs and policy violations +lintian -i $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-amd64.deb exit 0