Am Dienstag, den 03.07.2007, 21:51 +0900 schrieb Junichi Uekawa: [Bug report about --debianonly and possible usage of PACKAGENAME and UPSTREAMVERSION] > Could you craft a full patch?
Hi, Attached you will find two patches: dpatch_debianonly_patch.diff: This patch IMHO is safe. It makes the suggested change, that --debianonly accepts a path with or without the tarball name. In the latter case, it automatically guesses the tarball name. Included is the fixed documentation too. dpatch_conf_variables.diff: This patch affects the determination of PACKAGENAME and UPSTREAMVERSION in dpatch-edit-patch and dpatch-cowdancer-patch. It simply moves the variable determintaion before the inclusion of the configuration files. This allows e.g. conf_origtargzpath="/usr/local/src/packages/${PACKAGENAME}" in the configuration files. The change itself is safe IMHO. But you are right, that it might be possible that this usage of the configuration file may lead to an undefined variable. But that's not caused by the proposed code change. It's caused by the usage of variables inside the configuration files. And this is IMHO the users turn to make sure, that any used variables are determined. Maybe it would be nice to have a manpage for the configuration files to explain such things. However, if you feel unsafe about this special change, then you can safely reject it. Regards, Daniel
diff --git a/dpep/dpatch-cowdancer-patch b/dpep/dpatch-cowdancer-patch index 4ab6572..a89d4c8 100755 --- a/dpep/dpatch-cowdancer-patch +++ b/dpep/dpatch-cowdancer-patch @@ -10,6 +10,11 @@ set -e # CLI option parsing comes later, and # will blindly set it to the option given therein; CLI options trump all. +# Defining these vaiables here, allows users to set e.g. +# conf_origtargzpath="/usr/local/src/packages/${PACKAGENAME}" +PACKAGENAME="$(dpkg-parsechangelog | sed -n '/^Source:/{s/^Source:[[:space:]]\+\(.*\)/\1/;p;q}')" +UPSTREAMVERSION="$(dpkg-parsechangelog | sed -n '/^Version:/{s/^Version:[[:space:]]\+\([0-9]\+:\)\?\([^-]\+\).*/\2/;p;q}')" + # Read in the package's configuration file, should it exist. [[ -f debian/patches/00dpatch.conf ]] && . debian/patches/00dpatch.conf unset conf_sourcedir @@ -200,8 +205,6 @@ else if [ -n "$DPEP_DEBIANONLY" ]; then dpep_message norm "* debian/-only layout selected" if [ -z "$DPEP_ORIGTARGZ" ]; then - PACKAGENAME="$(dpkg-parsechangelog | sed -n '/^Source:/{s/^Source:[[:space:]]\+\(.*\)/\1/;p;q}')" - UPSTREAMVERSION="$(dpkg-parsechangelog | sed -n '/^Version:/{s/^Version:[[:space:]]\+\([0-9]\+:\)\?\([^-]\+\).*/\2/;p;q}')" ORIGTARGZ="${PACKAGENAME}_${UPSTREAMVERSION}.orig.tar.gz" export DPGO_ORIGTARGZPATH="$DPEP_ORIGTARGZPATH" if ! eval "$DPEP_GETORIGTARGZ $REFPDIR"; then diff --git a/dpep/dpatch-edit-patch b/dpep/dpatch-edit-patch index d177b4c..4d88115 100755 --- a/dpep/dpatch-edit-patch +++ b/dpep/dpatch-edit-patch @@ -10,6 +10,11 @@ set -e # CLI option parsing comes later, and # will blindly set it to the option given therein; CLI options trump all. +# Defining these vaiables here, allows users to set e.g. +# conf_origtargzpath="/usr/local/src/packages/${PACKAGENAME}" +PACKAGENAME="$(dpkg-parsechangelog | sed -n '/^Source:/{s/^Source:[[:space:]]\+\(.*\)/\1/;p;q}')" +UPSTREAMVERSION="$(dpkg-parsechangelog | sed -n '/^Version:/{s/^Version:[[:space:]]\+\([0-9]\+:\)\?\([^-]\+\).*/\2/;p;q}')" + # Read in the package's configuration file, should it exist. [[ -f debian/patches/00dpatch.conf ]] && . debian/patches/00dpatch.conf unset conf_sourcedir @@ -177,8 +182,6 @@ else if [ -n "$DPEP_DEBIANONLY" ]; then dpep_message norm "* debian/-only layout selected" if [ -z "$DPEP_ORIGTARGZ" ]; then - PACKAGENAME="$(dpkg-parsechangelog | sed -n '/^Source:/{s/^Source:[[:space:]]\+\(.*\)/\1/;p;q}')" - UPSTREAMVERSION="$(dpkg-parsechangelog | sed -n '/^Version:/{s/^Version:[[:space:]]\+\([0-9]\+:\)\?\([^-]\+\).*/\2/;p;q}')" ORIGTARGZ="${PACKAGENAME}_${UPSTREAMVERSION}.orig.tar.gz" export DPGO_ORIGTARGZPATH="$DPEP_ORIGTARGZPATH" if ! eval "$DPEP_GETORIGTARGZ $REFPDIR"; then
diff --git a/dpep/dpatch-edit-patch.1 b/dpep/dpatch-edit-patch.1 index 2141e97..b003fe7 100644 --- a/dpep/dpatch-edit-patch.1 +++ b/dpep/dpatch-edit-patch.1 @@ -134,8 +134,12 @@ Indicate to that the current work directory only contains a debian subdirectory and that an upstream tarball is to be unpacked in the reference directory before copying the current work directory there. The -optional argument is the path to the upstream tarball. If no value -is given, +optional argument is the path to the upstream tarball - including +or excluding the tarball name. If the given path is only a directory, +.B dpatch\-edit\-patch +tries to determine the \fI.orig.tar.gz\fR tarball name from +\fBdpkg\-parsechangelog\fR. Otherwise it will unpack and use the given +tarball. If no value is given, .B dpatch\-edit\-patch will use .B dpatch\-get\-origtargz diff --git a/dpep/dpatch-edit-patch.functions b/dpep/dpatch-edit-patch.functions index f5dc5be..9641eec 100755 --- a/dpep/dpatch-edit-patch.functions +++ b/dpep/dpatch-edit-patch.functions @@ -124,7 +124,10 @@ dpep_parse_options() { -t|--tmpdir) DPEP_TMPDIR="$2"; shift 2;; -p|--stampdir) DPEP_STAMPDIR="$2"; shift 2;; -e|--exclude) DPEP_EXCLUDE="$2"; shift 2;; - -b|--debianonly) DPEP_DEBIANONLY=1; DPEP_ORIGTARGZ="$2"; shift 2;; + -b|--debianonly) DPEP_DEBIANONLY=1; \ + [[ -d $2 ]] && DPEP_ORIGTARGZPATH="$2" || DPEP_ORIGTARGZ="$2"; \ + shift 2;; + DPEP_DEBIANONLY=1; DPEP_ORIGTARGZ="$2"; shift 2;; -P|--origtargzpath) DPEP_ORIGTARGZPATH="$2"; shift 2;; -k|--keeptemp) DPEP_KEEPTEMP=1; shift;; -c|--clean) DPEP_CLEAN=1; shift;;