>From 2dbc9aef09df4d3e8fdcef79dd4ccb67324a387e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= Date: Wed, 30 Dec 2009 21:29:35 +0100 Subject: [PATCH 1/2] Remember QUILT_PATCHES and QUILT_SERIES by storing them in .pc When the quilt db is created/initialized, QUILT_PATCHES and QUILT_SERIES are written down in .pc/.quilt_{patches,series} and in subsequent invocations of quilt those values are reused if the environmement variables are no longer set. When identifying the root directory, quilt now also looks for the existence of .pc and not only of QUILT_PATCHES since that value might not be set and we must be able to look it up from .pc/.quilt_patches instead. Based on a preliminary patch made by Goswin von Brederlow (see http://bugs.debian.org/557623). --- doc/main.tex | 8 ++++++-- quilt/scripts/patchfns.in | 26 ++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/doc/main.tex b/doc/main.tex index 28d407d..1ba083d 100644 --- a/doc/main.tex +++ b/doc/main.tex @@ -175,7 +175,9 @@ The remainder of this document discusses the script collection With quilt, all work occurs within a single directory tree. Since version 0.30, commands can be invoked from anywhere within the source -tree. Commands are of the form ``\quilt{cmd}'', similar to CVS +tree (the directory tree is scanned upwards until either the +\textsf{.pc} or the \textsf{patches} directory is found). +Commands are of the form ``\quilt{cmd}'', similar to CVS commands. They can be abbreviated as long as the specified part of the command is unique. All commands print some help text with ``\quilt{cmd -h}''. @@ -198,7 +200,9 @@ After the refresh, the patch and the working state are the same. Patch files are located in the \textsf{patches} sub-directory of the source tree (see Figure~\ref{fig:dir-layout}). The \textsf{QUILT\_PATCHES} -environment variable can be used to override this location. The +environment variable can be used to override this location and quilt +will remember this location by storing its value in the +\textsf{.pc/.quilt\_patches} file. The \textsf{patches} directory may contain sub-directories. \textsf{patches} may also be a symbolic link instead of a directory. diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in index fbe8f7b..9528d2c 100644 --- a/quilt/scripts/patchfns.in +++ b/quilt/scripts/patchfns.in @@ -20,7 +20,6 @@ export LANG=POSIX export QUILT_PATCHES QUILT_PC SUBDIR SERIES DB DB_VERSION=2 -: ${QUILT_PATCHES:=patches} : ${QUILT_PC:=.pc} # Support compatibility layer @@ -950,6 +949,14 @@ create_db() { mkdir -p $QUILT_PC echo $DB_VERSION > $QUILT_PC/.version fi + if ! [ -e $QUILT_PC/.quilt_patches ] + then + echo "$QUILT_PATCHES" > $QUILT_PC/.quilt_patches + fi + if ! [ -e $QUILT_PC/.quilt_series ] + then + echo "$QUILT_SERIES" > $QUILT_PC/.quilt_series + fi } version_check() { @@ -1052,14 +1059,14 @@ setup_pager() # drivers/net/. unset SUBDIR SUBDIR_DOWN -if ! [ -d "$QUILT_PATCHES" ] +if ! [ -d "$QUILT_PC" -o -d "${QUILT_PATCHES:-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:-patches}" ] then SUBDIR="${PWD#$basedir/}/" SUBDIR_DOWN=$down @@ -1074,7 +1081,18 @@ then unset basedir down fi -: ${QUILT_SERIES:=series} +if [ -r $QUILT_PC/.quilt_patches ] +then + : ${QUILT_PATCHES:=$(< $QUILT_PC/.quilt_patches)} +else + : ${QUILT_PATCHES:=patches} +fi +if [ -r $QUILT_PC/.quilt_series ] +then + : ${QUILT_SERIES:=$(< $QUILT_PC/.quilt_series)} +else + : ${QUILT_SERIES:=series} +fi if [ "${QUILT_SERIES:0:1}" = / ] then -- 1.6.5.7