quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Quilt-dev] quilt new broken when called from subdirs


From: Joe Green
Subject: Re: [Quilt-dev] quilt new broken when called from subdirs
Date: Mon, 09 Aug 2004 11:36:26 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113

Martin Quinson wrote:
When calling quilt new from a subdirectory, I get:
Warning: directory ../../patches exists; ignoring

Mmm. If the right directory is detected, why is it ignored? Did I do
something wrong here?

Martin,

Andreas and I had a discussion about this a few weeks ago:

http://lists.gnu.org/archive/html/quilt-dev/2004-07/msg00019.html

I suggested that it should be safe to trust the $SUBDIR if $SERIES already exists in the correct location as well, as shown in the first patch attached.

I also suggested maybe "-f" should be specified when adding the first patch in a new root, to make sure you're not just in the wrong directory. The second patch attached does this.

I don't think Andreas likes these solutions, though.

That issue seems related to the debian bug:
 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=260664
Even if I failed to recognize it at the first glance :-/

I'm not sure if the initial bug mentioned is related ("quilt files"). I think this issue only affects "new".

By the way, referring to a different part of the that thread, I think you should be able to set QUILT_PATCHES to "debian/patches" rather than having to create a symlink.

--
Joe Green <address@hidden>
MontaVista Software, Inc.
Source: MontaVista Software, Inc. (address@hidden)
Type: Defect Fix
Disposition: merge to http://savannah.nongnu.org/projects/quilt
Description:
    Allow "new" and "import" in a SUBDIR if both "$QUILT_PATCHES"
    and "$SERIES" already exist.

Index: quilt-0.35/quilt/import.in
===================================================================
--- quilt-0.35.orig/quilt/import.in
+++ quilt-0.35/quilt/import.in
@@ -75,6 +75,14 @@ then
        exit 1
 fi
 
+if [ -n "$SUBDIR" -a ! -e "$SERIES" ]
+then
+       printf $"Warning: directory %s exists; ignoring\n" \
+              "$SUBDIR_DOWN$QUILT_PATCHES" >&2
+       cd $SUBDIR
+       unset SUBDIR
+fi
+
 [ -n "$opt_strip" ] && patch_args="-p$opt_strip"
 
 status=
Index: quilt-0.35/quilt/new.in
===================================================================
--- quilt-0.35.orig/quilt/new.in
+++ quilt-0.35/quilt/new.in
@@ -59,7 +59,7 @@ fi
 
 patch=${1#$QUILT_PATCHES/}
 
-if [ -n "$SUBDIR" ]
+if [ -n "$SUBDIR" -a ! -e "$SERIES" ]
 then
        printf $"Warning: directory %s exists; ignoring\n" \
               "$SUBDIR_DOWN$QUILT_PATCHES" >&2
Source: MontaVista Software, Inc (address@hidden)
Type: Enhancement
Description:
    As a protection against creating a new quilt root in the wrong
    place, "-f" must be used with "new" and "import" for the first patch.

Index: quilt-0.35/quilt/new.in
===================================================================
--- quilt-0.35.orig/quilt/new.in
+++ quilt-0.35/quilt/new.in
@@ -19,12 +19,14 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt new {patchname}\n"
+       printf $"Usage: quilt new [-f] {patchname}\n"
        if [ x$1 = x-h ]
        then
                printf $"
 Create a new patch with the specified file name, and insert it after the
 topmost patch in the patch series file.
+
+-f     Force creation of initial quilt tree root in the current directory.
 "
                exit 0
        else
@@ -32,7 +34,7 @@ topmost patch in the patch series file.
        fi
 }
 
-options=`getopt -o h -- "$@"`
+options=`getopt -o fh -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -44,6 +46,9 @@ eval set -- "$options"
 while true
 do
        case "$1" in
+       -f)
+               opt_force=1
+               shift ;;
        -h)
                usage -h ;;
        --)
@@ -59,12 +64,20 @@ fi
 
 patch=${1#$QUILT_PATCHES/}
 
-if [ -n "$SUBDIR" -a ! -e "$SERIES" ]
-then
-       printf $"Warning: directory %s exists; ignoring\n" \
-              "$SUBDIR_DOWN$QUILT_PATCHES" >&2
-       cd $SUBDIR
-       unset SUBDIR
+if ! [ -e "$QUILT_PATCHES" -a -e "$SERIES" ] ; then
+       if [ "$SUBDIR" ] ; then
+               printf $"Warning: directory %s exists; ignoring\n" \
+                      "$SUBDIR_DOWN$QUILT_PATCHES" >&2
+       fi
+
+       if [ ! "$opt_force" ] ; then
+               printf $"Cannot locate root directory.  If this is the first 
patch,\n" >&2
+               printf $"use \"new -f\" to create a new root in the current 
directory.\n" >&2
+               exit 1
+       elif [ "$SUBDIR" ] ; then
+               cd "$SUBDIR"
+               unset SUBDIR
+       fi
 fi
 
 if patch_in_series $patch
Index: quilt-0.35/quilt/import.in
===================================================================
--- quilt-0.35.orig/quilt/import.in
+++ quilt-0.35/quilt/import.in
@@ -32,7 +32,8 @@ Import external patches.
        Patch filename to use inside quilt. This option can only be
        used when importing a single patch.
 
--f     Overwite/update existing patches.
+-f     Overwite/update existing patches, or force creation of initial
+       root directory.
 "
                exit 0
        else
@@ -75,12 +76,20 @@ then
        exit 1
 fi
 
-if [ -n "$SUBDIR" -a ! -e "$SERIES" ]
-then
-       printf $"Warning: directory %s exists; ignoring\n" \
-              "$SUBDIR_DOWN$QUILT_PATCHES" >&2
-       cd $SUBDIR
-       unset SUBDIR
+if ! [ -e "$QUILT_PATCHES" -a -e "$SERIES" ] ; then
+       if [ "$SUBDIR" ] ; then
+               printf $"Warning: directory %s exists; ignoring\n" \
+                      "$SUBDIR_DOWN$QUILT_PATCHES" >&2
+       fi
+
+       if [ ! "$opt_force" ] ; then
+               printf $"Cannot locate root directory.  If this is the first 
patch,\n" >&2
+               printf $"use \"import -f\" to create a new root in the current 
directory.\n" >&2
+               exit 1
+       elif [ "$SUBDIR" ] ; then
+               cd "$SUBDIR"
+               unset SUBDIR
+       fi
 fi
 
 [ -n "$opt_strip" ] && patch_args="-p$opt_strip"
Index: quilt-0.35/bash_completion
===================================================================
--- quilt-0.35.orig/bash_completion
+++ quilt-0.35/bash_completion
@@ -182,6 +182,7 @@ _quilt_completion()
           esac
           ;;
        new)
+          COMPREPLY=( $( compgen -W "-f -h" -- $cur ) )
           ;;
        next|previous)
           COMPREPLY=( $( compgen -W "-n $(quilt series)" -- $cur ) )

reply via email to

[Prev in Thread] Current Thread [Next in Thread]