git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] parameterize gnu tool names; add Portfile for OS X darwinports
@ 2005-07-11 10:14 Bryan Larsen
  2005-07-11 10:14 ` [PATCH 1/6] git-gnu-progs: parameterize git Bryan Larsen
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Bryan Larsen @ 2005-07-11 10:14 UTC (permalink / raw)
  To: bryan.larsen; +Cc: junkio, torvalds, Bryan Larsen, pasky, git

Cogito and git rely on the gnu version of 4 standard utilities:  cp,
date, stat and xargs.  On most non-Linux based Unix's, the gnu tools
are optional installs, and are installed under different names.

These patches parameterize the names of these 4 tools, determine what
name should be used, and verify that the tools work.  The final patch in
the series creates a Portfile that can be used with OS X's
darwinports.

In this series, patches 3 and 5 conflict:  patch 3 is for the git
Makefile, and patch 5 is for the cogito Makefile.

Patches 1-3 should be applied to git.
Patches 1,2,4,5,6 should be applied to cogito.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/6] git-gnu-progs: parameterize git
  2005-07-11 10:14 [PATCH 0/6] parameterize gnu tool names; add Portfile for OS X darwinports Bryan Larsen
@ 2005-07-11 10:14 ` Bryan Larsen
  2005-07-11 10:14 ` [PATCH 2/6] config-sh: find and verify utils Bryan Larsen
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Bryan Larsen @ 2005-07-11 10:14 UTC (permalink / raw)
  To: bryan.larsen; +Cc: junkio, torvalds, Bryan Larsen, pasky, git

Patch git so that the utilities 'cp' 'stat' 'xargs' and 'date' are configurable.  Git requires the gnu versions of these tools, and on some BSD derived systems, the gnu versions of these tools have a different name.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 git-clone-script |    4 +++-
 git-prune-script |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/git-clone-script b/git-clone-script
--- a/git-clone-script
+++ b/git-clone-script
@@ -5,6 +5,8 @@
 # 
 # Clone a repository into a different directory that does not yet exist.
 
+CP=cp
+
 usage() {
 	echo >&2 "* git clone [-l] <repo> <dir>"
 	exit 1
@@ -68,7 +70,7 @@ yes,yes)
 		l=l
 	fi &&
 	rm -f "$D/.git/objects/sample" &&
-	cp -r$l "$repo/objects" "$D/.git/" || exit 1
+	${CP} -r$l "$repo/objects" "$D/.git/" || exit 1
 
 	# Make a duplicate of refs and HEAD pointer
 	HEAD=
diff --git a/git-prune-script b/git-prune-script
--- a/git-prune-script
+++ b/git-prune-script
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+XARGS=xargs
+
 . git-sh-setup-script || die "Not a git archive"
 
 dryrun=
@@ -20,6 +22,6 @@ sed -ne '/unreachable /{
     s|\(..\)|\1/|p
 }' | {
 	cd "$GIT_OBJECT_DIRECTORY" || exit
-	xargs -r $dryrun rm -f
+	${XARGS} -r $dryrun rm -f
 }
 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 2/6] config-sh: find and verify utils
  2005-07-11 10:14 [PATCH 0/6] parameterize gnu tool names; add Portfile for OS X darwinports Bryan Larsen
  2005-07-11 10:14 ` [PATCH 1/6] git-gnu-progs: parameterize git Bryan Larsen
@ 2005-07-11 10:14 ` Bryan Larsen
  2005-07-11 10:15 ` [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update Bryan Larsen
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Bryan Larsen @ 2005-07-11 10:14 UTC (permalink / raw)
  To: bryan.larsen; +Cc: junkio, torvalds, Bryan Larsen, pasky, git

Add config.sh which searches for gnu versions of 'cp' 'stat' 'date' and 'xargs'.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 config.sh |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/config.sh b/config.sh
new file mode 100755
--- /dev/null
+++ b/config.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+#
+# Search for gnu utils.
+# Copyright (c) Bryan Larsen, 2005
+#
+# cogito and git-*-script rely on gnu versions of
+# cp, date, xargs and stat.  Look for them and
+# ensure they're gnu.
+#
+
+set -e
+
+if which gdate > /dev/null ; then 
+    DATE=gdate ;
+else 
+    DATE=date ; 
+fi ;
+
+# you don't actually have to have gnu date, it just works better.
+
+if which gcp > /dev/null ; then 
+    CP=gcp ; 
+else 
+    CP=cp ; 
+fi ;
+
+if $CP -a config.sh cp-test-dummy ; then 
+    rm cp-test-dummy ;
+else 
+    echo 'You must have gnu cp installed'; 
+    exit 1; 
+fi ;
+
+if which gnuxargs > /dev/null ; then 
+    XARGS=gnuxargs ; 
+else 
+    XARGS=xargs ; 
+fi ;
+
+if ! ( echo | $XARGS -r ) ; then 
+    echo 'You must have gnu xargs installed'; 
+    exit 1; 
+fi ;
+
+if which gstat > /dev/null ; then
+    STAT=gstat ;
+else
+    STAT=stat ;
+fi ;
+
+if ! ($STAT -c '%s' config.sh > /dev/null ) ; then
+    if which awk > /dev/null ; then
+	STAT=dont_have_stat ;
+    else
+	echo 'You must have awk or gnu stat installed.';
+	exit 1;
+    fi
+fi ;
+
+echo CP=$CP > config
+echo XARGS=$XARGS >> config
+echo DATE=$DATE >> config
+echo STAT=$STAT >> config
+
+set +e

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update
  2005-07-11 10:14 [PATCH 0/6] parameterize gnu tool names; add Portfile for OS X darwinports Bryan Larsen
  2005-07-11 10:14 ` [PATCH 1/6] git-gnu-progs: parameterize git Bryan Larsen
  2005-07-11 10:14 ` [PATCH 2/6] config-sh: find and verify utils Bryan Larsen
@ 2005-07-11 10:15 ` Bryan Larsen
  2005-07-11 19:02   ` Junio C Hamano
  2005-07-11 10:15 ` [PATCH 4/6] cogito-gnu-progs: parameterize cogito Bryan Larsen
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Bryan Larsen @ 2005-07-11 10:15 UTC (permalink / raw)
  To: bryan.larsen; +Cc: junkio, torvalds, Bryan Larsen, pasky, git

Update the git Makefile to put the results of config.sh into the scripts.  
config.sh searches for gnu utilities cp, stat, date and xargs.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 Makefile |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -51,9 +51,18 @@ PROG=   git-update-cache git-diff-files 
 
 all: $(PROG)
 
-install: $(PROG) $(SCRIPTS)
+config: config.sh
+	./config.sh
+
+install: $(PROG) $(SCRIPTS) config
 	$(INSTALL) -m755 -d $(dest)$(bin)
 	$(INSTALL) $(PROG) $(SCRIPTS) $(dest)$(bin)
+	. ./config ; \
+	cd $(dest)$(bin) ; \
+	for file in $(SCRIPTS); do \
+		sed -e "s/DATE\=date/DATE=$${DATE}/" -e "s/CP\=cp/CP=$${CP}/" -e "s/XARGS\=xargs/XARGS=$${XARGS}/" -e "s/STAT\=stat/STAT=$${STAT}/" $$file > $$file.new; \
+		cat $$file.new > $$file; rm $$file.new; \
+	done
 
 LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o \
 	 tag.o date.o index.o diff-delta.o patch-delta.o entry.o path.o \
@@ -190,7 +199,7 @@ test: all
 	$(MAKE) -C t/ all
 
 clean:
-	rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE)
+	rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE) config
 	$(MAKE) -C Documentation/ clean
 
 backup: clean

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 4/6] cogito-gnu-progs: parameterize cogito
  2005-07-11 10:14 [PATCH 0/6] parameterize gnu tool names; add Portfile for OS X darwinports Bryan Larsen
                   ` (2 preceding siblings ...)
  2005-07-11 10:15 ` [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update Bryan Larsen
@ 2005-07-11 10:15 ` Bryan Larsen
  2005-07-11 10:15 ` [PATCH 5/6] cogito-gnu-progs-Makefile: cogito Makefile update Bryan Larsen
  2005-07-11 10:15 ` [PATCH 6/6] darwinports-Portfile: Portfile for cogito Bryan Larsen
  5 siblings, 0 replies; 18+ messages in thread
From: Bryan Larsen @ 2005-07-11 10:15 UTC (permalink / raw)
  To: bryan.larsen; +Cc: junkio, torvalds, Bryan Larsen, pasky, git

Patch cogito so that the utilities 'cp' 'stat' 'xargs' and 'date' are configurable.  Cogito requires the gnu versions of these tools, and on some BSD derived systems, the gnu versions of these tools have a different name.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 cg-Xlib    |   15 ++++++++++-----
 cg-Xnormid |    2 +-
 cg-add     |    2 +-
 cg-commit  |    4 ++--
 cg-diff    |    4 ++--
 cg-init    |    4 ++--
 cg-patch   |    2 +-
 cg-pull    |    2 +-
 8 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/cg-Xlib b/cg-Xlib
--- a/cg-Xlib
+++ b/cg-Xlib
@@ -6,6 +6,11 @@
 # This file provides a library containing common code shared with all the
 # Cogito programs.
 
+DATE=date
+CP=cp
+XARGS=xargs
+STAT=stat
+
 _cg_cmd=${0##*/}
 
 _git=${GIT_DIR:-.git}
@@ -70,9 +75,9 @@ showdate () {
 	secs=$(($secs + $tzhours * 3600 + $tzmins * 60))
 	[ "$format" ] || format="+%a, %d %b %Y %H:%M:%S $2"
 	if [ "$has_gnudate" ]; then
-		LANG=C date -ud "1970-01-01 UTC + $secs sec" "$format"
+		LANG=C ${DATE} -ud "1970-01-01 UTC + $secs sec" "$format"
 	else
-		LANG=C date -u -r $secs "$format"
+		LANG=C ${DATE} -u -r $secs "$format"
 	fi
 }
 
@@ -104,7 +109,7 @@ tree_timewarp () {
 	[ "$no_head_update" ] || echo "$branch" > $_git/HEAD
 
 	# Kill gone files
-	git-diff-tree -z -r $base $branch | xargs -0 bash -c '
+	git-diff-tree -z -r $base $branch | ${XARGS} -0 bash -c '
 		while [ "$1" ]; do
 			header="$1"; shift
 			file="$1"; shift
@@ -234,5 +239,5 @@ fi
 
 export BROKEN_MKTEMP=1
 del=$($(which mktemp) -t 2>/dev/null) && { rm $del; export BROKEN_MKTEMP=; }
-has_stat=$(which stat 2>/dev/null)
-has_gnudate=$(date -Rud "1970-01-01 UTC" 2>/dev/null)
+has_stat=$(which ${STAT} 2>/dev/null)
+has_gnudate=$(${DATE} -Rud "1970-01-01 UTC" 2>/dev/null)
diff --git a/cg-Xnormid b/cg-Xnormid
--- a/cg-Xnormid
+++ b/cg-Xnormid
@@ -50,7 +50,7 @@ fi
 
 valid=; [ ${#id} -eq 40 ] && [ "$(git-rev-parse --revs-only "$id")" ] && valid=1
 if ([ "$id" ] && [ "$id" != " " ]) && [ ! "$valid" ]; then
-	reqsecs=$(date --date="$id" +'%s' 2>/dev/null)
+	reqsecs=$(${DATE} --date="$id" +'%s' 2>/dev/null)
 
 	if [ "$reqsecs" ]; then
 		id=$(git-rev-list --min-age=$reqsecs --max-count=1 HEAD)
diff --git a/cg-add b/cg-add
--- a/cg-add
+++ b/cg-add
@@ -43,6 +43,6 @@ find "${ARGS[@]}" -type f -print0 > $TMP
 }
 
 cat $TMPFILE | tr '\0' '\n' | sed 's/^/Adding file /'
-cat $TMPFILE | xargs -0r git-update-cache --add ${infoonly} --
+cat $TMPFILE | ${XARGS} -0r git-update-cache --add ${infoonly} --
 
 rm $TMPFILE
diff --git a/cg-commit b/cg-commit
--- a/cg-commit
+++ b/cg-commit
@@ -168,7 +168,7 @@ written=
 if [ "$merging" ]; then
 	echo -n 'Merge with ' >>$LOGMSG
 	[ "$msgs" ] && echo -n 'Merge with '
-	[ -s $_git/merging-sym ] || cp $_git/merging $_git/merging-sym
+	[ -s $_git/merging-sym ] || ${CP} $_git/merging $_git/merging-sym
 	for sym in $(cat $_git/merging-sym); do
 		uri=$(cat $_git/branches/$sym)
 		[ "$uri" ] || uri="$sym"
@@ -229,7 +229,7 @@ fi
 echo "CG: -----------------------------------------------------------------------" >>$LOGMSG
 echo "CG: vim: textwidth=75" >>$LOGMSG
 
-cp $LOGMSG $LOGMSG2
+${CP} $LOGMSG $LOGMSG2
 if tty -s; then
 	if ! [ "$msgs" ] || [ "$forceeditor" ]; then
 		${EDITOR:-vi} $LOGMSG2
diff --git a/cg-diff b/cg-diff
--- a/cg-diff
+++ b/cg-diff
@@ -155,7 +155,7 @@ if [ "$id2" = " " ]; then
 	# FIXME: Update ret based on what did we match. And take "$@"
 	# to account after all.
 	ret=
-	cat $filter | xargs git-diff-cache -r -p $tree | colorize | pager
+	cat $filter | ${XARGS} git-diff-cache -r -p $tree | colorize | pager
 
 	rm $filter
 
@@ -169,7 +169,7 @@ id2=$(tree-id "$id2") || exit 1
 
 [ "$id1" = "$id2" ] && die "trying to diff $id1 against itself"
 
-cat $filter | xargs git-diff-tree -r -p $id1 $id2 | colorize | pager
+cat $filter | ${XARGS} git-diff-tree -r -p $id1 $id2 | colorize | pager
 
 rm $filter
 exit 0
diff --git a/cg-init b/cg-init
--- a/cg-init
+++ b/cg-init
@@ -47,7 +47,7 @@ if [ "$uri" ]; then
 	echo "$uri" >$_git/branches/origin
 	cg-pull origin || die "pull failed"
 
-	cp $_git/refs/heads/origin $_git/refs/heads/master
+	${CP} $_git/refs/heads/origin $_git/refs/heads/master
 	git-read-tree HEAD
 	git-checkout-cache -a
 	git-update-cache --refresh
@@ -55,7 +55,7 @@ if [ "$uri" ]; then
 	echo "Cloned (origin $uri available as branch \"origin\")"
 else
 	git-read-tree # Seed the dircache
-	find * \( -type f -o -type l \) -print0 | xargs -0r cg-add ${infoonly}
+	find * \( -type f -o -type l \) -print0 | ${XARGS} -0r cg-add ${infoonly}
 	cg-commit -C -m"Initial commit" -E ${infoonly}
 fi
 
diff --git a/cg-patch b/cg-patch
--- a/cg-patch
+++ b/cg-patch
@@ -129,7 +129,7 @@ wait
 touchfiles="$(git-ls-files --deleted | join -v 2 $gonefile -)"
 [ "$touchfiles" ] && touch $touchfiles
 
-cat $todo | xargs -0 bash -c '
+cat $todo | ${XARGS} -0 bash -c '
 while [ "$1" ]; do
 	op="$1"; shift;
 	case "$op" in
diff --git a/cg-pull b/cg-pull
--- a/cg-pull
+++ b/cg-pull
@@ -233,7 +233,7 @@ fetch_local () {
 	dest="$2"
 	[ "$cut_last" ] && dest=${dest%/*}
 
-	cp $cp_flags_l "$src" "$dest"
+	${CP} $cp_flags_l "$src" "$dest"
 }
 
 pull_local () {

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 5/6] cogito-gnu-progs-Makefile: cogito Makefile update
  2005-07-11 10:14 [PATCH 0/6] parameterize gnu tool names; add Portfile for OS X darwinports Bryan Larsen
                   ` (3 preceding siblings ...)
  2005-07-11 10:15 ` [PATCH 4/6] cogito-gnu-progs: parameterize cogito Bryan Larsen
@ 2005-07-11 10:15 ` Bryan Larsen
  2005-07-11 10:15 ` [PATCH 6/6] darwinports-Portfile: Portfile for cogito Bryan Larsen
  5 siblings, 0 replies; 18+ messages in thread
From: Bryan Larsen @ 2005-07-11 10:15 UTC (permalink / raw)
  To: bryan.larsen; +Cc: junkio, torvalds, Bryan Larsen, pasky, git

Update the cogito Makefile to put the results of config.sh into the scripts.  config.sh searches for gnu utilities cp, stat, date and xargs.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 Makefile |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -195,11 +195,20 @@ sedlibdir=$(shell echo $(libdir) | sed '
 .PHONY: install install-git install-cogito
 install: install-git install-cogito
 
-install-git: $(PROG) $(SCRIPTS)
+config: config.sh
+	./config.sh
+
+install-git: $(PROG) $(SCRIPTS) config
 	$(INSTALL) -m755 -d $(DESTDIR)$(bindir)
 	$(INSTALL) $(PROG) $(SCRIPTS) $(DESTDIR)$(bindir)
+	. ./config ; \
+	cd $(DESTDIR)$(bindir) ;\
+	for file in $(SCRIPTS); do \
+		sed -e "s/DATE\=date/DATE=$${DATE}/" -e "s/CP\=cp/CP=$${CP}/" -e "s/XARGS\=xargs/XARGS=$${XARGS}/" -e "s/STAT\=stat/STAT=$${STAT}/" $$file > $$file.new; \
+		cat $$file.new > $$file; rm $$file.new; \
+	done
 
-install-cogito: $(SCRIPT) $(LIB_SCRIPT) $(GEN_SCRIPT)
+install-cogito: $(SCRIPT) $(LIB_SCRIPT) $(GEN_SCRIPT) config
 	$(INSTALL) -m755 -d $(DESTDIR)$(bindir)
 	$(INSTALL) $(SCRIPT) $(GEN_SCRIPT) $(DESTDIR)$(bindir)
 	rm -f $(DESTDIR)$(bindir)/cg-cancel
@@ -211,9 +220,10 @@ install-cogito: $(SCRIPT) $(LIB_SCRIPT) 
 		sed -e 's/\$${COGITO_LIB}/\$${COGITO_LIB:-$(sedlibdir)\/}/g' $$file > $$file.new; \
 		cat $$file.new > $$file; rm $$file.new; \
 	done
+	. ./config ; \
 	cd $(DESTDIR)$(libdir); \
 	for file in $(LIB_SCRIPT); do \
-		sed -e 's/\$${COGITO_LIB}/\$${COGITO_LIB:-$(sedlibdir)\/}/g' $$file > $$file.new; \
+		sed -e 's/\$${COGITO_LIB}/\$${COGITO_LIB:-$(sedlibdir)\/}/g' -e "s/DATE\=date/DATE=$${DATE}/" -e "s/CP\=cp/CP=$${CP}/" -e "s/XARGS\=xargs/XARGS=$${XARGS}/" -e "s/STAT\=stat/STAT=$${STAT}/" $$file > $$file.new; \
 		cat $$file.new > $$file; rm $$file.new; \
 	done
 
@@ -232,7 +242,7 @@ dist: cogito.spec
 	gzip -9 $(tarname).tar
 
 clean:
-	rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(GEN_SCRIPT) $(LIB_FILE)
+	rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(GEN_SCRIPT) $(LIB_FILE) config
 	$(MAKE) -C Documentation/ clean
 
 backup: clean

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 6/6] darwinports-Portfile: Portfile for cogito
  2005-07-11 10:14 [PATCH 0/6] parameterize gnu tool names; add Portfile for OS X darwinports Bryan Larsen
                   ` (4 preceding siblings ...)
  2005-07-11 10:15 ` [PATCH 5/6] cogito-gnu-progs-Makefile: cogito Makefile update Bryan Larsen
@ 2005-07-11 10:15 ` Bryan Larsen
  5 siblings, 0 replies; 18+ messages in thread
From: Bryan Larsen @ 2005-07-11 10:15 UTC (permalink / raw)
  To: bryan.larsen; +Cc: junkio, torvalds, Bryan Larsen, pasky, git

A Portfile for darwinports.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 Makefile    |    2 ++
 Portfile.in |   25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -240,6 +240,8 @@ dist: cogito.spec
 	@rm $(tarname)/cogito.spec
 	@rmdir $(tarname)
 	gzip -9 $(tarname).tar
+	sed -e 's/@@VERSION@@/$(shell cat $(VERSION) | cut -d"-" -f2)/g' < Portfile.in > Portfile
+	echo "checksums md5 " `md5sum $(tarname).tar.gz | cut -d ' ' -f 1` >> Portfile
 
 clean:
 	rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(GEN_SCRIPT) $(LIB_FILE) config
diff --git a/Portfile.in b/Portfile.in
new file mode 100644
--- /dev/null
+++ b/Portfile.in
@@ -0,0 +1,25 @@
+# $Id: $
+PortSystem        1.0
+name              cogito
+version           @@VERSION@@
+categories        devel
+maintainers       bryan.larsen@gmail.com
+description       Git core + cogito tools to provide a full distributed SCM.
+long_description  The git core, developed by Linus Torvalds provides \
+		  an extremely fast and flexible filesystem-based \
+		  database designed to store directory trees with \
+		  regard to their history.  The cogito tools, \
+		  developed by Petr Baudis, provide full distributed \
+		  SCM (software change management) functionality.
+homepage          http://kernel.org/pub/software/scm/cogito/
+master_sites      http://kernel.org/pub/software/scm/cogito/
+configure	  {}
+depends_lib       bin:gcp:coreutils
+depends_lib       bin:gnuxargs:findutils
+build.type        gnu
+destroot.type     gnu
+destroot.destdir  prefix=${prefix} DESTDIR=${destroot}
+test.run          yes
+test.cmd          make
+test.target       test
+test.dir          ${worksrcpath}

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update
  2005-07-11 10:15 ` [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update Bryan Larsen
@ 2005-07-11 19:02   ` Junio C Hamano
  2005-07-11 19:10     ` Linus Torvalds
  2005-07-11 19:21     ` Bryan Larsen
  0 siblings, 2 replies; 18+ messages in thread
From: Junio C Hamano @ 2005-07-11 19:02 UTC (permalink / raw)
  To: Bryan Larsen; +Cc: bryan.larsen, junkio, torvalds, pasky, git

Bryan Larsen <bryanlarsen@yahoo.com> writes:

> Update the git Makefile to put the results of config.sh into the scripts.  
> config.sh searches for gnu utilities cp, stat, date and xargs.
>
> Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>

> +install: $(PROG) $(SCRIPTS) config
>  	$(INSTALL) -m755 -d $(dest)$(bin)
>  	$(INSTALL) $(PROG) $(SCRIPTS) $(dest)$(bin)
> +	. ./config ; \
> +	cd $(dest)$(bin) ; \
> +	for file in $(SCRIPTS); do \
> +		sed -e "s/DATE\=date/DATE=$${DATE}/" -e "s/CP\=cp/CP=$${CP}/" -e "s/XARGS\=xargs/XARGS=$${XARGS}/" -e "s/STAT\=stat/STAT=$${STAT}/" $$file > $$file.new; \
> +		cat $$file.new > $$file; rm $$file.new; \
> +	done

I am not yet convinced "one variable per GNU program" is the
right way to do (I do agree it is a problem and I appreciate
your trying to solving it; an obvious alternative cop-out would
be to fix this in the user's environment, but there might be a
saner solution).  Assuming that this is the way to go, wouldn't
it be saner if this sed munging is done in only one place, say
git-sh-setup-script, and have everybody include that?  If we
want to have some scripts usable not at the top-level GIT
directory, then git-sh-setup-script may not be a good place; in
which case introduce git-sh-compat-script and have everybody
include _that_ instead?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update
  2005-07-11 19:02   ` Junio C Hamano
@ 2005-07-11 19:10     ` Linus Torvalds
  2005-07-11 19:42       ` Bryan Larsen
  2005-07-11 19:21     ` Bryan Larsen
  1 sibling, 1 reply; 18+ messages in thread
From: Linus Torvalds @ 2005-07-11 19:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Bryan Larsen, bryan.larsen, pasky, git



On Mon, 11 Jul 2005, Junio C Hamano wrote:
> 
> I am not yet convinced "one variable per GNU program" is the
> right way to do (I do agree it is a problem and I appreciate
> your trying to solving it; an obvious alternative cop-out would
> be to fix this in the user's environment, but there might be a
> saner solution)

Yes. As you say, if we do this (and I think it's so ugly that I'm not
convinced we want to), it should be done in git-sh-setup-script _once_
instead of editing every single script.

Most everything includes git-sh-setup-script anyway by now.

However, what are the features that break the default apple tools anyway? 
Maybe we should avoid using them? OSX clearly comes with "cp" and "xargs" 
regardless, what are the flags that don't work with their cruddy versions?

[ Rant mode on: ..and who the hell is the idiot at Apple who includes the
  old crappy BSD stuff? They already use gcc, so it's totally pointless to
  have a NIH thing, when the GNU utilities are just _better_. Maybe 
  somebody can ask Apple to get with the program and not live in the dark 
  ages any more. ]

			Linus

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update
  2005-07-11 19:02   ` Junio C Hamano
  2005-07-11 19:10     ` Linus Torvalds
@ 2005-07-11 19:21     ` Bryan Larsen
  1 sibling, 0 replies; 18+ messages in thread
From: Bryan Larsen @ 2005-07-11 19:21 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: bryan.larsen, torvalds, pasky, git

Junio C Hamano wrote:
> Bryan Larsen <bryanlarsen@yahoo.com> writes:
>>+	for file in $(SCRIPTS); do \
>>+		sed -e "s/DATE\=date/DATE=$${DATE}/" -e "s/CP\=cp/CP=$${CP}/" -e "s/XARGS\=xargs/XARGS=$${XARGS}/" -e "s/STAT\=stat/STAT=$${STAT}/" $$file > $$file.new; \
>>+		cat $$file.new > $$file; rm $$file.new; \
>>+	done
> 
> 
> I am not yet convinced "one variable per GNU program" is the
> right way to do 

My first thought was to have some type of "prefix" argument that could 
either be "g" or "".  But xargs is called "gnuxargs" instead of 
"gxargs".  I'm not sure where that braindamage comes from, but I have to 
deal with it.

To me, one variable per program makes sense: we do it in Makefiles all 
the time $(CC), $(LD), et cetera.

 > (I do agree it is a problem and I appreciate
> your trying to solving it; an obvious alternative cop-out would
> be to fix this in the user's environment, but there might be a
> saner solution). 

If we can move the solution into the Portfile somehow, it probably 
wouldn't bother me.

> Assuming that this is the way to go, wouldn't
> it be saner if this sed munging is done in only one place, say
> git-sh-setup-script, and have everybody include that?  If we
> want to have some scripts usable not at the top-level GIT
> directory, then git-sh-setup-script may not be a good place; in
> which case introduce git-sh-compat-script and have everybody
> include _that_ instead?
> 

That's the way it's done in cogito:  it's in cg-Xlib and nowhere else. 
This isn't obvious from the Makefile: perhaps I should have made it so.

I was very tempted to put it in git-sh-setup-script, but realized that 
was inappropriate.  Introducing a gid-sh-compat-script seems more sane.

Bryan

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update
  2005-07-11 19:10     ` Linus Torvalds
@ 2005-07-11 19:42       ` Bryan Larsen
  2005-07-11 20:00         ` Linus Torvalds
  2005-07-11 20:14         ` Junio C Hamano
  0 siblings, 2 replies; 18+ messages in thread
From: Bryan Larsen @ 2005-07-11 19:42 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Junio C Hamano, bryan.larsen, pasky, git

Linus Torvalds wrote:
> 
> On Mon, 11 Jul 2005, Junio C Hamano wrote:
> 
>>I am not yet convinced "one variable per GNU program" is the
>>right way to do (I do agree it is a problem and I appreciate
>>your trying to solving it; an obvious alternative cop-out would
>>be to fix this in the user's environment, but there might be a
>>saner solution)
> 
> 
> Yes. As you say, if we do this (and I think it's so ugly that I'm not
> convinced we want to), it should be done in git-sh-setup-script _once_
> instead of editing every single script.

Agreed: I was much happier with my cogito implementation where I just 
put it in cg-Xlib.  Is git-sh-setup-script appropriate?  At first glance 
it had a specific purpose and was not included in a large number of files.

> 
> Most everything includes git-sh-setup-script anyway by now.
> 
> However, what are the features that break the default apple tools anyway? 
> Maybe we should avoid using them? OSX clearly comes with "cp" and "xargs" 
> regardless, what are the flags that don't work with their cruddy versions?

xargs -r, cp -l, cp -u, cp -a.  Git uses the first 2, cogito uses all 4.

Last night, I couldn't think of alternatives to these, but I obviously 
didn't try very hard.  xargs -r can probably happen via a temporary file 
and cp -u can probably be simulated using rsync.

> 
> [ Rant mode on: ..and who the hell is the idiot at Apple who includes the
>   old crappy BSD stuff? They already use gcc, so it's totally pointless to
>   have a NIH thing, when the GNU utilities are just _better_. Maybe 
>   somebody can ask Apple to get with the program and not live in the dark 
>   ages any more. ]
> 

It wasn't long ago that the BSD's and Solaris had the same problems.  If 
only Apple is in the dark ages, shame on them.

Bryan

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update
  2005-07-11 19:42       ` Bryan Larsen
@ 2005-07-11 20:00         ` Linus Torvalds
  2005-07-12  9:03           ` Matthias Urlichs
  2005-07-11 20:14         ` Junio C Hamano
  1 sibling, 1 reply; 18+ messages in thread
From: Linus Torvalds @ 2005-07-11 20:00 UTC (permalink / raw)
  To: Bryan Larsen; +Cc: Junio C Hamano, bryan.larsen, pasky, git



On Mon, 11 Jul 2005, Bryan Larsen wrote:
> 
> > 
> > Most everything includes git-sh-setup-script anyway by now.
> > 
> > However, what are the features that break the default apple tools anyway? 
> > Maybe we should avoid using them? OSX clearly comes with "cp" and "xargs" 
> > regardless, what are the flags that don't work with their cruddy versions?
> 
> xargs -r, cp -l, cp -u, cp -a.  Git uses the first 2, cogito uses all 4.

I think we can replace "xargs -r" with just plain "xargs". It results in 
an empty "rm -f", but hey, that's ok. If some broken "rm" complains about 
that (GNU rm doesn't), you can always do

	find .. | xargs rm -f dummy-file.o

which makes sure that we have a dummy argument even for an empty list..

> Last night, I couldn't think of alternatives to these, but I obviously 
> didn't try very hard.  xargs -r can probably happen via a temporary file 
> and cp -u can probably be simulated using rsync.

I don't see a good alternative for "cp -l".

I also don't see why, if OS-X already _does_ include the GNU tools, they 
couldn't be under /opt/fsf/bin or something like that, and then you could 
just do

	PATH=/opt/fsf/bin:$PATH

and be done with it.

Grumble.

		Linus

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update
  2005-07-11 19:42       ` Bryan Larsen
  2005-07-11 20:00         ` Linus Torvalds
@ 2005-07-11 20:14         ` Junio C Hamano
  2005-07-11 20:22           ` Bryan Larsen
  2005-07-11 20:30           ` Junio C Hamano
  1 sibling, 2 replies; 18+ messages in thread
From: Junio C Hamano @ 2005-07-11 20:14 UTC (permalink / raw)
  To: Bryan Larsen; +Cc: Linus Torvalds, bryan.larsen, pasky, git

Bryan Larsen <bryanlarsen@yahoo.com> writes:

> Last night, I couldn't think of alternatives to these, but I obviously
> didn't try very hard.  xargs -r can probably happen via a temporary
> file and cp -u can probably be simulated using rsync.

The only user of "xargs -r" in the Linus GIT is git-prune-script
which tries not to run "rm -f" with an empty argument list, like
this:

    git-fsck-cache --cache --unreachable "$@" |
    sed -ne '/unreachable /{
        s/unreachable [^ ][^ ]* //
        s|\(..\)|\1/|p
    }' | {
            cd "$GIT_OBJECT_DIRECTORY" || exit
            xargs -r $dryrun rm -f
    }

Not tested on a BSD, and it is probably as ugly as it can get,
but we could:

    {
        echo 'unreachable nosuch/file';
        git-fsck-cache --cache --unreachable "$@" 
    } |
    sed -ne '/unreachable /{
        s/unreachable [^ ][^ ]* //
        s|\(..\)|\1/|p
    }' | {
            cd "$GIT_OBJECT_DIRECTORY" || exit
            xargs $dryrun rm -f
    }

The only user of "cp -l" in the Linus GIT is git-clone-script
local optimization.  I could revert it to the version that I
originally sent to the list, which uses cpio -pld, if your cpio
groks that flag.

I do not speak for Pasky, but to me "cp -u" sounds just like an
optimization, so maybe defining CP_U='cp -u' and detect missing
support at config time and falling back on the simple "cp" would
be an option?

GNU "cp -a" states that is the same as "-dpR" (never follow
symlinks, preserve link, mode, ownership, and timestamps), so
that can be rewritten as a shell function in cg-Xlib that is
called say cg_copy_tree, whose implementation runs two tar
processes piped together when "cp -a" is not available.  Using a
tarpipe unconditionally is also fine.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update
  2005-07-11 20:14         ` Junio C Hamano
@ 2005-07-11 20:22           ` Bryan Larsen
  2005-07-11 20:30           ` Junio C Hamano
  1 sibling, 0 replies; 18+ messages in thread
From: Bryan Larsen @ 2005-07-11 20:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Bryan Larsen, Linus Torvalds, pasky, git

> 
> The only user of "cp -l" in the Linus GIT is git-clone-script
> local optimization.  I could revert it to the version that I
> originally sent to the list, which uses cpio -pld, if your cpio
> groks that flag.

Those options are in the man page, at least.

Bryan

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update
  2005-07-11 20:14         ` Junio C Hamano
  2005-07-11 20:22           ` Bryan Larsen
@ 2005-07-11 20:30           ` Junio C Hamano
  2005-07-11 21:28             ` Bryan Larsen
  1 sibling, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2005-07-11 20:30 UTC (permalink / raw)
  To: Bryan Larsen; +Cc: Linus Torvalds, bryan.larsen, pasky, git

Junio C Hamano <junkio@cox.net> writes:

> The only user of "cp -l" in the Linus GIT is git-clone-script
> local optimization.  I could revert it to the version that I
> originally sent to the list, which uses cpio -pld, if your cpio
> groks that flag.

Bryan, does this work for you?

------------
Two changes to git-clone-script local optimization.

 - When local optimization is used, the variable repo has
   already been passed through get_repo_base so there is no need
   to check for .git subdirectory in there.

 - Use cpio -l instead of "cp -l".

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/git-clone-script b/git-clone-script
--- a/git-clone-script
+++ b/git-clone-script
@@ -48,11 +48,8 @@ test -d "$D" || usage
 case "$local,$use_local" in
 yes,yes)
 	( cd "$repo/objects" ) || {
-		repo="$repo/.git"
-		( cd "$repo/objects" ) || {
-		    echo >&2 "-l flag seen but $repo is not local."
-		    exit 1
-		}
+		echo >&2 "-l flag seen but $repo is not local."
+		exit 1
 	}
 
 	# See if we can hardlink and drop "l" if not.
@@ -68,7 +65,9 @@ yes,yes)
 		l=l
 	fi &&
 	rm -f "$D/.git/objects/sample" &&
-	cp -r$l "$repo/objects" "$D/.git/" || exit 1
+	cd "$repo" &&
+	find objects -type f -print |
+	cpio -puamd$l "$D/.git/" || exit 1
 
 	# Make a duplicate of refs and HEAD pointer
 	HEAD=

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update
  2005-07-11 20:30           ` Junio C Hamano
@ 2005-07-11 21:28             ` Bryan Larsen
  2005-07-11 21:59               ` Junio C Hamano
  0 siblings, 1 reply; 18+ messages in thread
From: Bryan Larsen @ 2005-07-11 21:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Linus Torvalds, bryan.larsen, pasky, git

Junio C Hamano wrote:
> Junio C Hamano <junkio@cox.net> writes:
> 
> 
>>The only user of "cp -l" in the Linus GIT is git-clone-script
>>local optimization.  I could revert it to the version that I
>>originally sent to the list, which uses cpio -pld, if your cpio
>>groks that flag.
> 
> 
> Bryan, does this work for you?
> 

Yes, it appears to work fine.

For the record, "${XARGS} -0r" may be uglier than "xargs -0r", but 
replacing it with several lines of shell magic is a loss.  OTOH shell 
magic can be wrapped up into nice little functions.  Certainly I'll 
appreciate being able to remove my coreutils and findutils dependency, 
but I think that assuming the user has gnu tools available somewhere is 
a reasonable assumption for tools of this type.

The tradeoff might be different for git and cogito.  Cogito uses shell 
scripts more heavily and requires bash instead of Bourne.  Certainly 
you've demonstrated that git can be made portable relatively cleanly.  I 
doubt cogito will fall as easily.

But if you prefer to go this route, I'm happy with it.

Bryan

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update
  2005-07-11 21:28             ` Bryan Larsen
@ 2005-07-11 21:59               ` Junio C Hamano
  0 siblings, 0 replies; 18+ messages in thread
From: Junio C Hamano @ 2005-07-11 21:59 UTC (permalink / raw)
  To: Bryan Larsen; +Cc: Linus Torvalds, bryan.larsen, pasky, git

Bryan Larsen <bryanlarsen@yahoo.com> writes:

> For the record, "${XARGS} -0r" may be uglier than "xargs -0r", but
> replacing it with several lines of shell magic is a loss.

OK, OK, the one I suggested for xargs was _U_G_L_Y_.

The one Linus suggested looks to me the cleanest.  That is, to
give an extra parameter upfront to the command run by xargs.  My
favorite trick is like this:

  git-fsck-cache --cache --unreachable "$@" |
  sed -ne '/unreachable /{
      s/unreachable [^ ][^ ]* //
      s|\(..\)|\1/|p
  }' | {
          cd "$GIT_OBJECT_DIRECTORY" || exit
-         xargs -r $dryrun rm -f
+         xargs $dryrun rm -f ""
  }

Dry-run would say: 

    rm -f  00/012345...
    rm -f  01/234567...

without visual distraction of having printable phoney names, or
just (with an invisible trailing space):

    rm -f  

During a real run, "rm -f" would not complain "cannot remove `':
Is a directory", either.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update
  2005-07-11 20:00         ` Linus Torvalds
@ 2005-07-12  9:03           ` Matthias Urlichs
  0 siblings, 0 replies; 18+ messages in thread
From: Matthias Urlichs @ 2005-07-12  9:03 UTC (permalink / raw)
  To: git

Hi, Linus Torvalds wrote:

> I also don't see why, if OS-X already _does_ include the GNU tools, they 
> couldn't be under /opt/fsf/bin or something like that, and then you could 
> just do
> 
> 	PATH=/opt/fsf/bin:$PATH

We could prepend /usr/lib/git to $PATH, and symlink them with their "real"
names there.

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
Go directly to jail.  Do not pass Go, do not collect $200.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2005-07-12  9:10 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-11 10:14 [PATCH 0/6] parameterize gnu tool names; add Portfile for OS X darwinports Bryan Larsen
2005-07-11 10:14 ` [PATCH 1/6] git-gnu-progs: parameterize git Bryan Larsen
2005-07-11 10:14 ` [PATCH 2/6] config-sh: find and verify utils Bryan Larsen
2005-07-11 10:15 ` [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update Bryan Larsen
2005-07-11 19:02   ` Junio C Hamano
2005-07-11 19:10     ` Linus Torvalds
2005-07-11 19:42       ` Bryan Larsen
2005-07-11 20:00         ` Linus Torvalds
2005-07-12  9:03           ` Matthias Urlichs
2005-07-11 20:14         ` Junio C Hamano
2005-07-11 20:22           ` Bryan Larsen
2005-07-11 20:30           ` Junio C Hamano
2005-07-11 21:28             ` Bryan Larsen
2005-07-11 21:59               ` Junio C Hamano
2005-07-11 19:21     ` Bryan Larsen
2005-07-11 10:15 ` [PATCH 4/6] cogito-gnu-progs: parameterize cogito Bryan Larsen
2005-07-11 10:15 ` [PATCH 5/6] cogito-gnu-progs-Makefile: cogito Makefile update Bryan Larsen
2005-07-11 10:15 ` [PATCH 6/6] darwinports-Portfile: Portfile for cogito Bryan Larsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).