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:52:49 -0700
User-agent: Mutt/1.5.9i

On Mon, Jul 11, 2005 at 10:06:27AM -0700, Tom Rini wrote:
> 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>

Once more, with pipes, which is a lot cleaner looking, and only a small
jump in speed (with ~670 patches on my system, everything jumped by ~1s,
compared to 4s wall, 3s sys, 1s user, with the previous).

--- scripts/patchfns.orig       2005-07-11 08:53:25.000000000 -0700
+++ scripts/patchfns    2005-07-11 10:43:37.000000000 -0700
@@ -164,6 +164,8 @@
 
        if [ -e $SERIES ]
        then
+               (([ -f $QUILT_PC/included-patches ] && cat \
+                       $QUILT_PC/included-patches $SERIES) || cat $SERIES) | \
                /usr/bin/gawk '
                $1 == "'"$patch"'" \
                        { if (NF >= 2)
@@ -173,7 +175,7 @@
                                print "-p1" ;
                          exit
                        }
-               ' $SERIES
+               '
        fi
 }
 
@@ -243,7 +245,9 @@
        then
                return 1
        else
-               grep -q -E "^$(quote_re $patch)([ \t]|$)" $SERIES
+               (([ -f $QUILT_PC/included-patches ] && cat \
+                       $QUILT_PC/included-patches $SERIES) || cat $SERIES) | \
+               grep -q -E "^$(quote_re $patch)([ \t]|$)"
        fi
 }
 
@@ -393,8 +397,10 @@
 {
        if [ -e $SERIES ]
        then
+               (([ -f $QUILT_PC/included-patches ] && cat \
+                       $QUILT_PC/included-patches $SERIES) || cat $SERIES) | \
                sed -e '/^$/d' -e '/^#/d' -e 's/^[ '$'\t'']*//' \
-                     -e 's/[ '$'\t''].*//' $SERIES
+                     -e 's/[ '$'\t''].*//'
        else
                return 1
        fi
@@ -527,8 +533,10 @@
        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)
+               set -- $((([ -f $QUILT_PC/included-patches ] && cat \
+                       $QUILT_PC/included-patches $SERIES) || cat $SERIES) | \
+                       sed -e 
"/^$bre\(\|\.patch\|\.diff\?\)\(\|\.gz\|\.bz2\)\([ "$'\t'"]\|$\)/!d" \
+                              -e 's/[ '$'\t''].*//')
                if [ $# -eq 1 ]
                then
                        echo $1
--- setup.orig  2005-07-11 08:38:35.000000000 -0700
+++ setup       2005-07-11 10:18:19.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]