quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] [patch 5/8]


From: gary
Subject: [Quilt-dev] [patch 5/8]
Date: Tue, 13 Sep 2005 22:25:51 +0100

Mac OS X 10.4 (I'm running 10.4.2) ships with a cp command that does
not understand the `-l' option.  Darwin ports has a coreutils port with
GNU cp, but installs it as gcp so as not to overshadow Apple's cp
command.

Similarly OS X's date command doesn't understand --rfc-822 among other
options used by quilt, and coreutils installs gdate.

Okay, so I relent, quilt needs coreutils.  This patch searches for and uses
gcp in preference to cp, and gdate in preference to date to workaround
these problems, provided there is an installed GNU cp called gcp etc.

 Makefile.in         |   16 ++++++++++------
 configure.ac        |    8 +++++---
 quilt/diff.in       |    8 ++++----
 quilt/fork.in       |    2 +-
 quilt/import.in     |    2 +-
 quilt/mail.in       |   12 ++++++------
 quilt/pop.in        |   16 ++++++++--------
 scripts/patchfns.in |   10 +++++-----
 8 files changed, 40 insertions(+), 34 deletions(-)

Index: quilt-HEAD/Makefile.in
===================================================================
--- quilt-HEAD.orig/Makefile.in
+++ quilt-HEAD/Makefile.in
@@ -20,6 +20,8 @@ LIB_DIR =     $(libdir)/$(PACKAGE)
 INSTALL :=     @INSTALL@
 PERL :=                @PERL@
 BASH :=                @BASH@
+CP :=          @CP@
+DATE :=                @DATE@
 SED :=         @SED@
 AWK :=         @AWK@
 TAC :=         @TAC@
@@ -80,7 +82,7 @@ LIB :=                backup-files$(EXEEXT)
 SRC +=         $(LIB_SRC:%=lib/%)
 DIRT +=                lib/backup-files$(EXEEXT) $(LIB_SRC:%.c=lib/%.o)
 
-DOC_IN :=      README 
+DOC_IN :=      README
 DOC_SRC :=     $(DOC_IN:%=doc/%.in)
 DOC :=         $(DOC_IN)
 SRC +=         $(DOC_SRC)
@@ -91,7 +93,7 @@ DIRT +=               $(DOC_IN:%=doc/%) doc/quilt.1
 MAN1 :=                bin/guards.1 doc/quilt.1
 DIRT +=                $(MAN1)
 
-#DEBIAN :=     changelog control copyright rules 
+#DEBIAN :=     changelog control copyright rules
 #
 #SRC +=                $(DEBIAN:%=debian/%)
 
@@ -135,7 +137,7 @@ doc/README : doc/README.in
                        ;; \
                esac ; \
        done 2>&1 < $< > $@
-       
+
 doc/quilt.1: doc/quilt.1.in $(QUILT:%=quilt/%)
        @echo "quilt.1.in -> quilt.1"
        @here=`pwd`;                                     \
@@ -214,6 +216,8 @@ $(PACKAGE).spec : $(PACKAGE).spec.in $(P
             -e 's:@SCRIPTS''@:$(SCRIPTS_DIR):g' \
             -e 's:@PERL''@:$(PERL):g' \
             -e 's:@BASH''@:$(BASH):g' \
+            -e 's:@CP''@:$(CP):g' \
+            -e 's:@DATE''@:$(DATE):g' \
             -e 's:@SED''@:$(SED):g' \
             -e 's:@AWK''@:$(AWK):g' \
             -e "s:@TAC""@:$(TAC):g" \
@@ -241,7 +245,7 @@ install : scripts
 
        @INSTALL@ -d $(BUILD_ROOT)$(QUILT_DIR)
        @INSTALL@ -m 755 $(QUILT:%=quilt/%) $(BUILD_ROOT)$(QUILT_DIR)/
-       
+
        @INSTALL@ -d $(BUILD_ROOT)$(SCRIPTS_DIR)
        @INSTALL@ -m 755 $(patsubst %,scripts/%, \
                             $(filter-out patchfns,$(SCRIPTS))) \
@@ -259,7 +263,7 @@ install : scripts
 
        @INSTALL@ -d $(BUILD_ROOT)$(mandir)/man1
        @INSTALL@ -m 644 $(MAN1) $(BUILD_ROOT)$(mandir)/man1/
-       
+
        $(MAKE_NLS) -C po install BUILD_ROOT=$(BUILD_ROOT) \
                LINGUAS="$(LINGUAS)" localedir=$(localedir)
 
@@ -282,7 +286,7 @@ uninstall:
 
 clean :
        rm -f $(DIRT)
-       
+
 distclean : clean
        rm -f config.log config.status Makefile
        rm -rf autom4te.cache/
Index: quilt-HEAD/configure.ac
===================================================================
--- quilt-HEAD.orig/configure.ac
+++ quilt-HEAD/configure.ac
@@ -25,13 +25,15 @@ AC_SUBST(EXEEXT)
 
 AC_PROG_INSTALL
 
+AC_PATH_PROGS(CP, gcp cp)
+AC_PATH_PROGS(DATE, gdate date)
 AC_PATH_PROG(TAC, tac, [perl -e 'print reverse <>'])
 
 AC_SYS_INTERPRETER
 if test "$interpval" != yes ; then
        AC_MSG_WARN([no
 
-bash/perl scripts may not be invoked correctly due to problems with your 
+bash/perl scripts may not be invoked correctly due to problems with your
 systems implementation of #! being either broken or non-existant.
 ])
 fi
@@ -182,8 +184,8 @@ elif $PATCH --version 2>&1 | grep -q "pa
 Sorry, the version of patch you are using can cause severe problems when a 
patch
 creates a directory.  $PACKAGE_NAME may well function correctly with this 
version
 of patch or small problems could creep in.
-Please consider upgrading your patch to a more recent version, if you already 
-have a more recent version of patch then you can supply its path with the 
+Please consider upgrading your patch to a more recent version, if you already
+have a more recent version of patch then you can supply its path with the
 '--with-patch=' option.
 ])
 else
Index: quilt-HEAD/quilt/diff.in
===================================================================
--- quilt-HEAD.orig/quilt/diff.in
+++ quilt-HEAD/quilt/diff.in
@@ -22,7 +22,7 @@ setup_colors
 usage()
 {
        printf $"Usage: quilt diff [-p n] [-u|-U num|-c|-C num] [--combine 
patch|-z] [-R] [-P patch] [--snapshot] [--diff=utility] [--no-timestamps] 
[--no-index] [--sort] [--color] [file ...]\n"
-       
+
        if [ x$1 = x-h ]
        then
                printf $"
@@ -111,7 +111,7 @@ do_diff()
                new_file=$old_file
                old_file=$f
        fi
-       
+
        if [ -n "$opt_diff" ]
        then
                [ -s "$old_file" ] || old_file=/dev/null
@@ -338,7 +338,7 @@ then
 
        if [ address@hidden -gt 0 ] \
           && ! ( cd $QUILT_PC/$last_patch &&
-                 cp -l --parents "address@hidden" $workdir/ )
+                 @CP@ -l --parents "address@hidden" $workdir/ )
        then
                printf $"Failed to copy files to temporary directory\n" >&2
                die 1
@@ -360,7 +360,7 @@ then
                        # the patch will fail. Also, if a patch was force
                        # applied, we know that it won't apply cleanly. In
                        # all other cases, print a warning.
-                       
+
                        if [ ! -e $QUILT_PC/$last_patch~refresh -a \
                               address@hidden -eq 0 ]
                        then
Index: quilt-HEAD/quilt/fork.in
===================================================================
--- quilt-HEAD.orig/quilt/fork.in
+++ quilt-HEAD/quilt/fork.in
@@ -105,7 +105,7 @@ if ! rename_in_db "$top_patch" "$new_pat
    ! rename_in_series "$top_patch" "$new_patch" || \
    ! mv "$QUILT_PC/$top_patch" "$QUILT_PC/$new_patch" || \
    ( [ -e "$(patch_file_name $top_patch)" ] && \
-     ! cp -p "$(patch_file_name $top_patch)" \
+     ! @CP@ -p "$(patch_file_name $top_patch)" \
             "$(patch_file_name $new_patch)" )
 then
        printf $"Fork of patch %s to patch %s failed\n" \
Index: quilt-HEAD/quilt/import.in
===================================================================
--- quilt-HEAD.orig/quilt/import.in
+++ quilt-HEAD/quilt/import.in
@@ -110,7 +110,7 @@ do
        fi
        dest=$QUILT_PATCHES/$patch
        mkdir -p "${dest%/*}"
-       if ! cp "$patch_file" "$dest"
+       if ! @CP@ "$patch_file" "$dest"
        then
                printf $"Failed to import patch %s\n" "$(print_patch $patch)" 
>&2
                exit 1
Index: quilt-HEAD/quilt/pop.in
===================================================================
--- quilt-HEAD.orig/quilt/pop.in
+++ quilt-HEAD/quilt/pop.in
@@ -80,18 +80,18 @@ files_may_have_changed()
 {
        local patch=$1 file
        local patch_file=$(patch_file_name $patch)
-       
+
        if [ $? -ne 0 -o ! -e "$patch_file" \
             -o ! -e "$QUILT_PC/$patch/.timestamp" \
             -o "$QUILT_PC/$patch/.timestamp" -ot "$patch_file" ]
        then
                return 0
        fi
-       
-       local apply_ts=$(date -r "$QUILT_PC/$patch/.timestamp" '+%s') ts
+
+       local apply_ts=$(@DATE@ -r "$QUILT_PC/$patch/.timestamp" '+%s') ts
        for file in $(files_in_patch $patch)
        do
-               ts=$(date -r $file '+%s' 2> /dev/null)
+               ts=$(@DATE@ -r $file '+%s' 2> /dev/null)
                [ -z "$ts" ] && return 0
                [ "$ts" -gt $apply_ts ] && return 0
        done
@@ -109,7 +109,7 @@ check_for_pending_changes()
        if [ -d $QUILT_PC/$patch ]
        then
                if ! rmdir $workdir ||  # note that this is racey...
-                  ! cp -rl $QUILT_PC/$patch $workdir
+                  ! @CP@ -rl $QUILT_PC/$patch $workdir
                then
                        printf $"Failed to copy files to temporary directory\n" 
>&2
                        rm -rf $workdir
@@ -124,7 +124,7 @@ check_for_pending_changes()
                find $workdir -type f -size 0 -exec rm -f '{}' ';'
 
        fi
-       
+
        if [ -s $patch_file ]
        then
                if ! cat_file $patch_file \
@@ -141,7 +141,7 @@ check_for_pending_changes()
                        fi
                fi
        fi
-       
+
        local file failed
        for file2 in $(files_in_patch $patch)
        do
@@ -150,7 +150,7 @@ check_for_pending_changes()
                [ -e $file2 ] || file2=/dev/null
                @DIFF@ -q $file $file2 > /dev/null || failed=1
        done
-       
+
        if [ -n "$failed" ]
        then
                printf $"Patch %s does not remove cleanly (refresh it or 
enforce with -f)\n" \
Index: quilt-HEAD/quilt/mail.in
===================================================================
--- quilt-HEAD.orig/quilt/mail.in
+++ quilt-HEAD/quilt/mail.in
@@ -52,7 +52,7 @@ with a template for the introductory mes
 
 msgid()
 {
-       local timestamp=$(date --utc "+%Y%m%d%H%M%S.%N")
+       local timestamp=$(@DATE@ --utc "+%Y%m%d%H%M%S.%N")
        echo "address@hidden(hostname -f)"
 }
 
@@ -72,7 +72,7 @@ process_mail()
                                 --remove-header Bcc "$@" < $tmpfile \
                | @MTA@ "$@"
        else
-               local from_date=$(date "+%a %b %e %H:%M:%S %Y")
+               local from_date=$(@DATE@ "+%a %b %e %H:%M:%S %Y")
                echo "From ${LOGNAME:-$(whoami)address@hidden(hostname -f) 
$from_date"
                @SED@ -e 's/^From />From /' $tmpfile
                echo
@@ -154,7 +154,7 @@ introduction=$(gen_tempfile)
 (
        cat <<-EOF
        Message-Id: <$(msgid)>
-       Date: $(date --rfc-822)
+       Date: $(@DATE@ --rfc-822)
        From: $opt_from
        To: $(IFS=,; echo "${opt_to[*]}")
        Cc: $(IFS=,; echo "${opt_cc[*]}")
@@ -198,18 +198,18 @@ fi
 # increment the timestamp by one second and wait with sending until
 # that time has arrived. This allows MUAs to show the messages in the
 # correct order.
-last_ts=$(date '+%s' -d "$(@SED@ -ne $'s/^Date:[ \t]*//p' $introduction)")
+last_ts=$(@DATE@ '+%s' -d "$(@SED@ -ne $'s/^Date:[ \t]*//p' $introduction)")
 
 num=1
 body=$(gen_tempfile)
 for patch in "$@"; do
        #echo -n '.' >&2
        # Timestamps that are a few seconds in the future don't hurt usually
-       #while [ $(date '+%s') -le $last_ts ]; do
+       #while [ $(@DATE@ '+%s') -le $last_ts ]; do
        #       sleep 1
        #done
        ((last_ts++))
-       new_date="$(date --rfc-822 -d "1970/01/01 UTC $last_ts seconds")"
+       new_date="$(@DATE@ --rfc-822 -d "1970/01/01 UTC $last_ts seconds")"
 
        cat_file $(patch_file_name $patch) \
        | quilt_mail_patch_filter $patch > $body
Index: quilt-HEAD/scripts/patchfns.in
===================================================================
--- quilt-HEAD.orig/scripts/patchfns.in
+++ quilt-HEAD/scripts/patchfns.in
@@ -341,7 +341,7 @@ applied_before()
                ' $DB
        fi
 }
-               
+
 patches_before()
 {
        local patch=$1
@@ -528,7 +528,7 @@ diff_file()
                new_hdr=$dir/$file
        fi
        index=$new_hdr
-       
+
        if ! [ -s "$old_file" ]
        then
                old_file=/dev/null
@@ -537,7 +537,7 @@ diff_file()
                || old_date=$'\t'"1970-01-01 00:00:00.000000000 +0000"
        else
                [ -n "$QUILT_NO_DIFF_TIMESTAMPS" ] \
-               || old_date=$'\t'$(date +'%Y-%m-%d %H:%M:%S.%N %z' \
+               || old_date=$'\t'$(@DATE@ +'%Y-%m-%d %H:%M:%S.%N %z' \
                                        -r "$old_file")
        fi
        if ! [ -s "$new_file" ]
@@ -548,7 +548,7 @@ diff_file()
                || new_date=$'\t'"1970-01-01 00:00:00.000000000 +0000"
        else
                [ -n "$QUILT_NO_DIFF_TIMESTAMPS" ] \
-               || new_date=$'\t'$(date +'%Y-%m-%d %H:%M:%S.%N %z' \
+               || new_date=$'\t'$(@DATE@ +'%Y-%m-%d %H:%M:%S.%N %z' \
                                        -r "$new_file")
        fi
 
@@ -569,7 +569,7 @@ diff_file()
 cat_file()
 {
        local filename
-       
+
        for filename in "$@"
        do
                if [ -e "$filename" ]

--
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook




reply via email to

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