On 29/11/2009, Raphael Hertzog <[email protected]> wrote:
> Hello,
>
> among the requests we have, there's one to let quilt remember the
> locations of the patch dir and of the series file. It makes a lot of sense
> for us since we tend to store patches on debian packages in debian/patches
> and the series file is debian/patches/series. It would be nice to be able
> to set QUILT_PATCHES only at the first invocation and then have quilt
> reuse the setting for the following commands.
I've done this by allowing a local version of .pc/quiltrc. I'm
attaching two patches against quilt-0.48 that are related to this that
you can use if you want:
find-pc.diff
Searches up in the directory hierarchy for .pc as well as patches (so
that my quilt finds the .pc directory I made for it with
QUILT_PATCHES=../patches before it finds the patches directory one
level up)
pc-quiltrc.diff
Makes quilt read in .pc/quiltrc in addition to the original quiltrc
files. I think I changed the behavious slightly so that it would read
all of the files one after the other rather than reading only one
quiltrc file. I guess some people may not be too happy about that.
> A contributor submitted us the attached patch, please share your comments
> and consider including it if it's fine.
I didn't see any attached patch; did you forget to add it?
-Martin
Index: quilt-0.48/quilt/scripts/patchfns.in
===================================================================
--- quilt-0.48.orig/quilt/scripts/patchfns.in 2009-01-31 02:28:06.000000000 +0000
+++ quilt-0.48/quilt/scripts/patchfns.in 2009-07-07 12:55:18.000000000 +0000
@@ -970,10 +970,10 @@ quilt_command()
}
#
-# If the working directory does not contain a $QUILT_PATCHES directory,
-# quilt searches for its base directory up the directory tree. If no
-# $QUILT_PATCHES directory exists, the quilt operations that create
-# patches will create $QUILT_PATCHES in the current working directory.
+# Search for a base directory up the directory tree. The base directory must
+# contain the $QUILT_PATCHES or $QUILT_PC directories. If no such base
+# directory is found, the $QUILT_PATCHES and $QUILT_PC directories will be
+# created in the current working directory.
#
# When quilt is invoked from a directory below the base directory, it
# changes into the base directory, and sets $SUBDIR to the relative
@@ -983,14 +983,14 @@ quilt_command()
# drivers/net/.
unset SUBDIR SUBDIR_DOWN
-if ! [ -d "$QUILT_PATCHES" ]
+if ! [ -d "$QUILT_PC" -o -d "$QUILT_PATCHES" ]
then
basedir=$PWD
while [ -n "$basedir" ]
do
basedir=${basedir%/*}
down=$down../
- if [ -d "$basedir/$QUILT_PATCHES" ]
+ if [ -d "$basedir/$QUILT_PC" -o -d "$basedir/$QUILT_PATCHES" ]
then
SUBDIR="${PWD#$basedir/}/"
SUBDIR_DOWN=$down
Index: quilt-0.48/bin/quilt.in
===================================================================
--- quilt-0.48.orig/bin/quilt.in 2009-07-07 12:44:06.000000000 +0000
+++ quilt-0.48/bin/quilt.in 2009-07-08 10:19:40.000000000 +0000
@@ -14,14 +14,6 @@ export textdomaind...@localedir@
: ${QUILT_DIR="$b...@quilt_dir@"} ${QUILT_LIB="$b...@quilt_lib@"}
export QUILT_DIR QUILT_LIB
-if [ -z "$QUILTRC" ]
-then
- for QUILTRC in $HOME/.quiltrc /etc/quilt.quiltrc; do
- [ -e $QUILTRC ] && break
- done
- export QUILTRC
-fi
-
# Support compatibility layer
if [ -d $QUILT_DIR/compat ]
then
@@ -46,11 +38,10 @@ Global options:
Runs the command in bash trace mode (-x). For internal debugging.
--quiltrc file
- Use the specified configuration file instead of ~/.quiltrc (or
- /etc/quilt.quiltrc if ~/.quiltrc does not exist). See the pdf
- documentation for details about its possible contents. The
- special value \"-\" causes quilt not to read any configuration
- file.
+ Use the specified configuration file instead of \"\$QUILTRC\", or
+ \"/etc/quilt.quiltrc\", \"~/.quiltrc\", and \".pc/quiltrt\". See the
+ pdf documentation for details about its possible contents. The
+ special value \"-\" causes quilt not to read any configuration file.
--version
Print the version number and exit immediately."
@@ -89,11 +80,11 @@ do
# Use a resource file other than ~/.quiltrc
--quiltrc=*)
QUILTRC=${1#--quiltrc=}
- [ "$QUILTRC" = - ] && unset QUILTRC ;;
+ if [ "$QUILTRC" = "-" ]; then QUILTRC=""; fi ;;
--quiltrc)
QUILTRC=$2
- [ "$QUILTRC" = - ] && unset QUILTRC
- shift ;;
+ shift
+ if [ "$QUILTRC" = "-" ]; then QUILTRC=""; fi ;;
# Trace execution of commands
--trace*)
BASH_OPTS="${BASH_OPTS:+$BASH_OPTS }-x"
Index: quilt-0.48/quilt/scripts/patchfns.in
===================================================================
--- quilt-0.48.orig/quilt/scripts/patchfns.in 2009-07-07 12:55:18.000000000 +0000
+++ quilt-0.48/quilt/scripts/patchfns.in 2009-07-08 10:27:48.000000000 +0000
@@ -32,16 +32,17 @@ fi
unset CDPATH
shopt -s dotglob
-if [ -e "$QUILTRC" ]
+if [ -z "${QUILTRC+set}" ]
then
- source "$QUILTRC"
-fi
-
-# Add default arguments for this command
-if [ -n "$QUILT_COMMAND" ]; then
- args="QUILT_$(echo $QUILT_COMMAND | tr a-z A-Z)_ARGS"
- eval set -- ${!args} \"\...@\"
- unset args
+ if [ -e "/etc/quilt.quiltrc" ]
+ then
+ source "/etc/quilt.quiltrc"
+ fi
+
+ if [ -e "$HOME/.quiltrc" ]
+ then
+ source "$HOME/.quiltrc"
+ fi
fi
# ========================================================
@@ -1005,6 +1006,19 @@ then
unset basedir down
fi
+: "${QUILTRC=$QUILT_PC/quiltrc}"
+if [ -e "$QUILTRC" ]
+then
+ source "$QUILTRC"
+fi
+
+# Add default arguments for this command
+if [ -n "$QUILT_COMMAND" ]; then
+ args="QUILT_$(echo $QUILT_COMMAND | tr a-z A-Z)_ARGS"
+ eval set -- ${!args} \"\...@\"
+ unset args
+fi
+
: ${QUILT_SERIES:=series}
if [ "${QUILT_SERIES:0:1}" = / ]
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev