From f424e03a445080b937605515210a061061c7906b Mon Sep 17 00:00:00 2001 From: Michael Shuler Date: Sat, 8 Sep 2018 15:16:04 -0500 Subject: [PATCH] Switch Debian packaging to quilt patches Future Debian package patching guide: https://wiki.debian.org/UsingQuilt#Making_a_new_patch https://wiki.debian.org/UsingQuilt#Editing_an_existing_patch Patch by Michael Shuler; Reviewed by Jon Haddad for CASSANDRA-14707 --- debian/control | 2 +- debian/patches/001cassandra_yaml_dirs.dpatch | 36 ------------------- debian/patches/002cassandra_logdir_fix.dpatch | 31 ---------------- debian/patches/00list | 2 -- debian/patches/cassandra_logdir_fix.diff | 34 ++++++++++++++++++ debian/patches/cassandra_yaml_dirs.diff | 28 +++++++++++++++ debian/patches/series | 2 ++ debian/rules | 5 +-- 8 files changed, 68 insertions(+), 72 deletions(-) delete mode 100644 debian/patches/001cassandra_yaml_dirs.dpatch delete mode 100644 debian/patches/002cassandra_logdir_fix.dpatch delete mode 100644 debian/patches/00list create mode 100644 debian/patches/cassandra_logdir_fix.diff create mode 100644 debian/patches/cassandra_yaml_dirs.diff create mode 100644 debian/patches/series diff --git a/debian/control b/debian/control index 6a0128e447..816d8f0ee1 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: misc Priority: extra Maintainer: Eric Evans Uploaders: Sylvain Lebresne -Build-Depends: debhelper (>= 5), openjdk-8-jdk | java8-jdk, ant (>= 1.9), ant-optional (>= 1.9), dh-python, python-dev (>= 2.7), dpatch, bash-completion +Build-Depends: debhelper (>= 5), openjdk-8-jdk | java8-jdk, ant (>= 1.9), ant-optional (>= 1.9), dh-python, python-dev (>= 2.7), quilt, bash-completion Homepage: http://cassandra.apache.org Vcs-Git: http://git-wip-us.apache.org/repos/asf/cassandra.git Vcs-Browser: https://git-wip-us.apache.org/repos/asf?p=cassandra.git diff --git a/debian/patches/001cassandra_yaml_dirs.dpatch b/debian/patches/001cassandra_yaml_dirs.dpatch deleted file mode 100644 index 72580a31f1..0000000000 --- a/debian/patches/001cassandra_yaml_dirs.dpatch +++ /dev/null @@ -1,36 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 001cassandra_yaml_dirs.dpatch by Tyler Hobbs -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: No description. - -@DPATCH@ -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' cassandra~/conf/cassandra.yaml cassandra/conf/cassandra.yaml ---- cassandra~/conf/cassandra.yaml 2014-06-05 13:36:22.000000000 -0500 -+++ cassandra/conf/cassandra.yaml 2014-06-05 13:39:20.569034040 -0500 -@@ -94,13 +94,13 @@ - # will spread data evenly across them, subject to the granularity of - # the configured compaction strategy. - # If not set, the default directory is $CASSANDRA_HOME/data/data. --# data_file_directories: --# - /var/lib/cassandra/data -+data_file_directories: -+ - /var/lib/cassandra/data - - # commit log. when running on magnetic HDD, this should be a - # separate spindle than the data directories. - # If not set, the default directory is $CASSANDRA_HOME/data/commitlog. --# commitlog_directory: /var/lib/cassandra/commitlog -+commitlog_directory: /var/lib/cassandra/commitlog - - # policy for data disk failures: - # stop_paranoid: shut down gossip even for single-sstable errors. -@@ -203,7 +203,7 @@ - - # saved caches - # If not set, the default directory is $CASSANDRA_HOME/data/saved_caches. --# saved_caches_directory: /var/lib/cassandra/saved_caches -+saved_caches_directory: /var/lib/cassandra/saved_caches - - # commitlog_sync may be either "periodic" or "batch." - # When in batch mode, Cassandra won't ack writes until the commit log diff --git a/debian/patches/002cassandra_logdir_fix.dpatch b/debian/patches/002cassandra_logdir_fix.dpatch deleted file mode 100644 index 87387b9c67..0000000000 --- a/debian/patches/002cassandra_logdir_fix.dpatch +++ /dev/null @@ -1,31 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## cassandra_logdir_fix.dpatch by Michael Shuler -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: No description. - -@DPATCH@ -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' cassandra~/bin/cassandra cassandra/bin/cassandra ---- cassandra~/bin/cassandra 2015-10-27 14:35:22.000000000 -0500 -+++ cassandra/bin/cassandra 2015-10-27 14:41:38.000000000 -0500 -@@ -139,7 +139,7 @@ - props="$3" - class="$4" - cassandra_parms="-Dlogback.configurationFile=logback.xml" -- cassandra_parms="$cassandra_parms -Dcassandra.logdir=$CASSANDRA_HOME/logs" -+ cassandra_parms="$cassandra_parms -Dcassandra.logdir=/var/log/cassandra" - cassandra_parms="$cassandra_parms -Dcassandra.storagedir=$cassandra_storagedir" - - if [ "x$pidpath" != "x" ]; then -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' cassandra~/conf/cassandra-env.sh cassandra/conf/cassandra-env.sh ---- cassandra~/conf/cassandra-env.sh 2015-10-27 14:40:39.000000000 -0500 -+++ cassandra/conf/cassandra-env.sh 2015-10-27 14:42:40.647449856 -0500 -@@ -204,7 +204,7 @@ - esac - - #GC log path has to be defined here because it needs to access CASSANDRA_HOME --JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_HOME}/logs/gc.log" -+JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc.log" - - # Here we create the arguments that will get passed to the jvm when - # starting cassandra. diff --git a/debian/patches/00list b/debian/patches/00list deleted file mode 100644 index 59b0d8b8b4..0000000000 --- a/debian/patches/00list +++ /dev/null @@ -1,2 +0,0 @@ -001cassandra_yaml_dirs.dpatch -002cassandra_logdir_fix.dpatch diff --git a/debian/patches/cassandra_logdir_fix.diff b/debian/patches/cassandra_logdir_fix.diff new file mode 100644 index 0000000000..d75553c11a --- /dev/null +++ b/debian/patches/cassandra_logdir_fix.diff @@ -0,0 +1,34 @@ +--- a/bin/cassandra ++++ b/bin/cassandra +@@ -171,7 +171,7 @@ + props="$3" + class="$4" + cassandra_parms="-Dlogback.configurationFile=logback.xml" +- cassandra_parms="$cassandra_parms -Dcassandra.logdir=$CASSANDRA_HOME/logs" ++ cassandra_parms="$cassandra_parms -Dcassandra.logdir=/var/log/cassandra" + cassandra_parms="$cassandra_parms -Dcassandra.storagedir=$cassandra_storagedir" + + if [ "x$pidpath" != "x" ]; then +--- a/conf/cassandra-env.sh ++++ b/conf/cassandra-env.sh +@@ -93,16 +93,16 @@ + echo "$JVM_OPTS" | grep -q "^-[X]log:gc" + if [ "$?" = "1" ] ; then # [X] to prevent ccm from replacing this line + # only add -Xlog:gc if it's not mentioned in jvm-server.options file +- mkdir -p ${CASSANDRA_HOME}/logs +- JVM_OPTS="$JVM_OPTS -Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=${CASSANDRA_HOME}/logs/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760" ++ mkdir -p /var/log/cassandra ++ JVM_OPTS="$JVM_OPTS -Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=/var/log/cassandra/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760" + fi + else + # Java 8 + echo "$JVM_OPTS" | grep -q "^-[X]loggc" + if [ "$?" = "1" ] ; then # [X] to prevent ccm from replacing this line + # only add -Xlog:gc if it's not mentioned in jvm-server.options file +- mkdir -p ${CASSANDRA_HOME}/logs +- JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_HOME}/logs/gc.log" ++ mkdir -p /var/log/cassandra ++ JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc.log" + fi + fi + diff --git a/debian/patches/cassandra_yaml_dirs.diff b/debian/patches/cassandra_yaml_dirs.diff new file mode 100644 index 0000000000..84219d0633 --- /dev/null +++ b/debian/patches/cassandra_yaml_dirs.diff @@ -0,0 +1,28 @@ +--- a/conf/cassandra.yaml ++++ b/conf/cassandra.yaml +@@ -197,13 +197,13 @@ + # directories are specified, Cassandra will spread data evenly across + # them by partitioning the token ranges. + # If not set, the default directory is $CASSANDRA_HOME/data/data. +-# data_file_directories: +-# - /var/lib/cassandra/data ++data_file_directories: ++ - /var/lib/cassandra/data + + # commit log. when running on magnetic HDD, this should be a + # separate spindle than the data directories. + # If not set, the default directory is $CASSANDRA_HOME/data/commitlog. +-# commitlog_directory: /var/lib/cassandra/commitlog ++commitlog_directory: /var/lib/cassandra/commitlog + + # Enable / disable CDC functionality on a per-node basis. This modifies the logic used + # for write path allocation rejection (standard: never reject. cdc: reject Mutation +@@ -366,7 +366,7 @@ + + # saved caches + # If not set, the default directory is $CASSANDRA_HOME/data/saved_caches. +-# saved_caches_directory: /var/lib/cassandra/saved_caches ++saved_caches_directory: /var/lib/cassandra/saved_caches + + # commitlog_sync may be either "periodic", "group", or "batch." + # diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000000..3c16596ec8 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +cassandra_logdir_fix.diff +cassandra_yaml_dirs.diff diff --git a/debian/rules b/debian/rules index 5fa164a856..53874c2180 100755 --- a/debian/rules +++ b/debian/rules @@ -3,7 +3,7 @@ # Uncomment to enable verbose mode. #export DH_VERBOSE=1 -include /usr/share/dpatch/dpatch.make +include /usr/share/quilt/quilt.make ANT = /usr/bin/ant VERSION = $(shell dpkg-parsechangelog | sed -ne 's/^Version: \([^-|~|+]*\).*/\1/p') @@ -13,6 +13,7 @@ test: $(ANT) test clean: unpatch + dh_clean build-stamp dh_testdir dh_testroot $(ANT) realclean @@ -24,7 +25,7 @@ clean: unpatch dh_clean build: build-stamp -build-stamp: patch-stamp +build-stamp: $(QUILT_STAMPFN) dh_testdir printf "version=%s" $(VERSION) > build.properties