quilt-dev
[Top][All Lists]
Advanced

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

Re: [Quilt-dev] Extending on the grouping feature - recursive series


From: Tom Rini
Subject: Re: [Quilt-dev] Extending on the grouping feature - recursive series
Date: Mon, 11 Jul 2005 10:06:27 -0700
User-agent: Mutt/1.5.9i

On Mon, Jul 11, 2005 at 08:27:47AM -0700, Tom Rini wrote:
[snip]
> The same day I wrote this, a coworker came up with a partial fix, for our
> needs at least.  The problem of "where does a new patch go?" is much
> simpiler as any included file is frozen, so we wouldn't want a patch going
> in there.  But right now it only lets you modify the parsed series,
> which isn't completely useful.

The following, which is vs 0.35 (we plan to move our internal version up
soon, and since this isn't for inclusion, I didn't try to move just this
up) solves the problem set of needing to include 1 or more static and
unchangable series files, with one changable on top.  This isn't perfect
as 'quilt delete foo' will delete foo, and just fail to remove it from
the mock series file.  It also assumes that the first series file with a
patch in it has also defined Patchdir.

Signed-off-by: Tom Rini <address@hidden>

--- scripts/patchfns.orig       2005-07-11 08:53:25.000000000 -0700
+++ scripts/patchfns    2005-07-11 10:05:16.000000000 -0700
@@ -160,9 +160,14 @@
 # The -pN option and possibly others that should be passed to patch.
 patch_args()
 {
-       local patch=$1
+       local patch=$1 trueseries=$SERIES
 
-       if [ -e $SERIES ]
+       if [ -f $QUILT_PC/included-patches ]
+       then
+               trueseries=$(gen_tempfile)
+               cat $QUILT_PC/included-patches $SERIES > $trueseries
+       fi
+       if [ -e $trueseries ]
        then
                /usr/bin/gawk '
                $1 == "'"$patch"'" \
@@ -173,7 +178,11 @@
                                print "-p1" ;
                          exit
                        }
-               ' $SERIES
+               ' $trueseries
+       fi
+       if [ "$SERIES" != "$trueseries" ]
+       then
+               rm -f $trueseries
        fi
 }
 
@@ -237,13 +246,22 @@
 
 patch_in_series()
 {
-       local patch=$1
+       local patch=$1 trueseries=$SERIES
 
-       if ! [ -e $SERIES ]
+       if [ -f $QUILT_PC/included-patches ]
+       then
+               trueseries=$(gen_tempfile)
+               cat $QUILT_PC/included-patches $SERIES > $trueseries
+       fi
+       if ! [ -e $trueseries ]
        then
                return 1
        else
-               grep -q -E "^$(quote_re $patch)([ \t]|$)" $SERIES
+               grep -q -E "^$(quote_re $patch)([ \t]|$)" $trueseries
+       fi
+       if [ "$SERIES" != "$trueseries" ]
+       then
+               rm -f $trueseries
        fi
 }
 
@@ -391,13 +409,24 @@
 
 cat_series()
 {
-       if [ -e $SERIES ]
+       local trueseries=$SERIES
+
+       if [ -f $QUILT_PC/included-patches ]
+       then
+               trueseries=$(gen_tempfile)
+               cat $QUILT_PC/included-patches $SERIES > $trueseries
+       fi
+       if [ -e $trueseries ]
        then
                sed -e '/^$/d' -e '/^#/d' -e 's/^[ '$'\t'']*//' \
-                     -e 's/[ '$'\t''].*//' $SERIES
+                     -e 's/[ '$'\t''].*//' $trueseries
        else
                return 1
        fi
+       if [ "$SERIES" != "$trueseries" ]
+       then
+               rm -f $trueseries
+       fi
 }
 
 top_patch()
@@ -522,13 +551,20 @@
 
 find_patch()
 {
+       local trueseries=$SERIES
+
+       if [ -f $QUILT_PC/included-patches ]
+       then
+               trueseries=$(gen_tempfile)
+               cat $QUILT_PC/included-patches $SERIES > $trueseries
+       fi
        set -- $*
-       if [ $# -eq 1 -a -n "$1" -a -e "$SERIES" ]
+       if [ $# -eq 1 -a -n "$1" -a -e "$trueseries" ]
        then
                local patch="${1#$SUBDIR_DOWN$QUILT_PATCHES/}"
                local bre=$(quote_bre "$patch")
                set -- $(sed -e 
"/^$bre\(\|\.patch\|\.diff\?\)\(\|\.gz\|\.bz2\)\([ "$'\t'"]\|$\)/!d" \
-                              -e 's/[ '$'\t''].*//' $SERIES)
+                              -e 's/[ '$'\t''].*//' $trueseries)
                if [ $# -eq 1 ]
                then
                        echo $1
@@ -547,6 +583,10 @@
                        done
                fi
        fi
+       if [ "$SERIES" != "$trueseries" ]
+       then
+               rm -f $trueseries
+       fi
        return 1
 }
 
--- setup.orig  2005-07-11 08:38:35.000000000 -0700
+++ setup       2005-07-11 09:40:46.000000000 -0700
@@ -132,26 +132,41 @@
        return $status
 }
 
-tmpfile=$(gen_tempfile)
-trap "rm -f $tmpfile" EXIT
-
-if ! [ "$sourcedir" ] ; then
-       sourcedir=$(dirname "$1")
-fi
+parse_include_series_file() {
+       local line
+       # Note that tar_dir and patch_dir need to be global
 
-case "$1" in
-*.spec)
-       spec_file="$1"
+       while read line; do
+               set -- $line
+               case "$@" in
+               "# Sourcedir: "*)
+                       shift 2
+                       tar_dir="$@" ;;
+               "# Source: "*)
+                       shift 2
+                       echo "tar ${tar_dir:-.} $@" ;;
+               "# Patchdir: "*)
+                       shift 2
+                       patch_dir="$@"
+                       # Make this now.
+                       (mkdir -p $patch_dir && cd $patch_dir && create_db)
+                       echo "patchdir $patch_dir" ;;
+               "# Include: "*)
+                       shift 2
+                       parse_include_series_file < $sourcedir/$1 ;;
+               ''|'#'*)
+                       ;;
+               *)
+                       echo $@ >> $patch_dir/$QUILT_PC/included-patches
+                       echo "patch ${patch_dir:-.} $@" ;;
+               esac
+       done
+}
 
-       if ! /usr/share/quilt/scripts/inspect $verbose "$spec_file" > $tmpfile
-       then
-               exit 1
-       fi
-       ;;
-*)
-       seriesfile="$1"
+parse_series_file() {
+       local line
+       # Note that tar_dir and patch_dir need to be global
 
-       # parse series file
        while read line; do
                set -- $line
                case "$@" in
@@ -165,12 +180,37 @@
                        shift 2
                        patch_dir="$@"
                        echo "patchdir $patch_dir" ;;
+               "# Include: "*)
+                       shift 2
+                       parse_include_series_file < $sourcedir/$1 ;;
                ''|'#'*)
                        ;;
                *)
                        echo "patch ${patch_dir:-.} $@" ;;
                esac
-       done < "$1" > $tmpfile
+       done
+}
+
+tmpfile=$(gen_tempfile)
+trap "rm -f $tmpfile" EXIT
+
+if ! [ "$sourcedir" ] ; then
+       sourcedir=$(dirname "$1")
+fi
+
+case "$1" in
+*.spec)
+       spec_file="$1"
+
+       if ! /usr/share/quilt/scripts/inspect $verbose "$spec_file" > $tmpfile
+       then
+               exit 1
+       fi
+       ;;
+*)
+       seriesfile="$1"
+
+       parse_series_file < "$1" > $tmpfile
        ;;
 esac

-- 
Tom




reply via email to

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