[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] prefer-gnu-coreutils.diff [re-done against HEAD]
From: |
Gary V. Vaughan |
Subject: |
[Quilt-dev] prefer-gnu-coreutils.diff [re-done against HEAD] |
Date: |
Sun, 18 Sep 2005 12:53:11 +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 | 4 ++++
configure.ac | 47 +++++++++++++++++++++++++++++++++++++++++++----
quilt/diff.in | 8 ++++----
quilt/fork.in | 2 +-
quilt/import.in | 2 +-
quilt/mail.in | 12 ++++++------
quilt/pop.in | 16 ++++++++--------
scripts/patchfns.in | 4 ++--
8 files changed, 69 insertions(+), 26 deletions(-)
Index: quilt-HEAD/Makefile.in
===================================================================
--- quilt-HEAD.orig/Makefile.in
+++ quilt-HEAD/Makefile.in
@@ -18,6 +18,8 @@ SCRIPTS_DIR = $(QUILT_DIR)/scripts
COMPAT_DIR = $(QUILT_DIR)/compat
LIB_DIR = $(libdir)/$(PACKAGE)
+CP := @CP@
+DATE := @DATE@
INSTALL := @INSTALL@
POD2MAN := @POD2MAN@
COLUMN := @COLUMN@
@@ -236,6 +238,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:@DIFF''@:$(DIFF):g' \
Index: quilt-HEAD/configure.ac
===================================================================
--- quilt-HEAD.orig/configure.ac
+++ quilt-HEAD/configure.ac
@@ -30,7 +30,7 @@ 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
@@ -61,8 +61,47 @@ QUILT_COMPAT_PROG_PATH(SED, sed)
QUILT_COMPAT_PROG_PATH(AWK, awk, [gawk awk])
QUILT_COMPAT_PROG_PATH(POD2MAN, pod2man)
QUILT_COMPAT_PROG_PATH(COLUMN, column)
-QUILT_COMPAT_PROG_PATH(GETOPT, getopt)
+QUILT_COMPAT_PROG_PATH(CP, cp, gcp cp)
+if test -n "$CP"; then
+ AC_MSG_CHECKING(whether $CP -l works)
+ touch conftest.source
+ $CP -l conftest.source conftest.target 2>/dev/null
+ cp_l_errors=$?
+ echo "$$" >> conftest.source
+ grep -q "^$$$" conftest.target
+ cp_l_works=$?
+ if test $cp_l_errors -eq 0 -a $cp_l_works -eq 0; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([
+$CP does not support the -l option.
+If you have a version of cp that supports linking files, you can specify
+'--with-cp=/path/to/cpwith-l', or else install GNU coreutils and use the
+cp command it ships.
+])
+ fi
+fi
+
+QUILT_COMPAT_PROG_PATH(DATE, cp, gdate date)
+if test -n "$DATE"; then
+ AC_MSG_CHECKING(whether $DATE --rfc-822 works)
+ $DATE --rfc-822 >/dev/null 2>&1
+ if test $? -eq 0; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([
+$DATE does not support the --rfc-822 option.
+If you have a version of date that supports rfc822 dates, you can specify
+'--with-date=/path/to/date-with-rfc-822', or else install GNU coreutils and
+use the date command it ships.
+])
+ fi
+fi
+
+QUILT_COMPAT_PROG_PATH(GETOPT, getopt)
if test -n "$GETOPT"; then
AC_MSG_CHECKING(for getopt --long syntax)
dnl check GNU syntax
@@ -120,8 +159,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
@@ -67,18 +67,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
@@ -96,7 +96,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
@@ -111,7 +111,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 \
@@ -128,7 +128,7 @@ check_for_pending_changes()
fi
fi
fi
-
+
local file failed
for file2 in $(files_in_patch $patch)
do
@@ -137,7 +137,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
@@ -51,7 +51,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)"
}
@@ -71,7 +71,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
@@ -153,7 +153,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[*]}")
@@ -197,18 +197,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
@@ -543,7 +543,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" ]
@@ -554,7 +554,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
--
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
- Re: [Quilt-dev] [patch 7/8] nftw portability, (continued)
[Quilt-dev] [patch 5/8], gary, 2005/09/13
Re: [Quilt-dev] [patch 5/8], Gary V. Vaughan, 2005/09/14
Re: [Quilt-dev] [patch 5/8], Andreas Gruenbacher, 2005/09/18
Re: [Quilt-dev] prefer-gnu-coreutils.diff [re-done against HEAD], John Vandenberg, 2005/09/18
Re: [Quilt-dev] prefer-gnu-coreutils.diff [re-done against HEAD], Andreas Gruenbacher, 2005/09/18
[Quilt-dev] [patch 6/8], gary, 2005/09/13
[Quilt-dev] [patch 8/8], gary, 2005/09/13
[Quilt-dev] [patch 1/8], gary, 2005/09/13