Re: [PATCH]: mknetrel builds Guile #2: debug

2002-07-10 Thread Jan Nieuwenhuizen

Christopher Faylor [EMAIL PROTECTED] writes:

 I've applied a slight variation of this patch.  I kept the exit in usage
 but made it exit 1 when usage was given an argument.

Thanks.  Maybe such debugging is overkill, but this kind of thing
helped me a lot during the porting/patching of Guile and libtool.

Jan.

-- 
Jan Nieuwenhuizen [EMAIL PROTECTED] | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien   | http://www.lilypond.org




Re: [PATCH]: mknetrel builds Guile #2: debug

2002-07-09 Thread Jan Nieuwenhuizen

Christopher Faylor [EMAIL PROTECTED] writes:

   - add debugging feature: drop to shell upon failure

 I normally run mknetrel in the background.  In fact, I just added a
 couple of options to accommodate this.  They would conflict with this
 patch.

Ok.

 If you want to add this functionality, introduce an option.  I don't
 want to have this as the default.

Sure, that's inconvenient.  I thought about adding it to -x, but you
may well want to have a detailed, noninteractive log, at times.  So,
I decided to add -X option for this.

Also, I made -h exit successfully, not to annoy you or anything, saw
you were messing with this too.  Hope you like the way I did it.  I
thought about adding a help () funtion, but decided that would be
overkill.

What I really think we should also do, is to start the script with

set -e

and let bash decide when something's wrong.  Then we can rid of stuff
like:

mkdir foo || exit 1

It is annoying that you'll have to add '|| true' clauses to some
checks that are allowed to fail, but in general, I feel that a bourn
script *should* start with set -e.  Any sane interpreter stops upon
error.  What do you think?

Greetings,
Jan.

Btw: A very silly question, but I can't seem to get `cvs diff' to
 respect your (Cygwin's?) wishes of excluding the ChangeLog from
 the diff.  It doesn't grok -X,--exclude options, most annoying.
 How do you manage?

2002-07-09  Jan Nieuwenhuizen  [EMAIL PROTECTED]

* bin/mknetrel: Invoke atexit () before exiting.
(atexit): New function.
(drop): New funtion.
(usage): Return (previously: exit unsuccessfully).
(setup): Add -X option to make mknetrel drop to shell upon error.
Exit successfully for -h, unsuccessfully upon usage error.
(setup1): Exit unsuccessfully upon usage error.

* .cvsignore: Add .bash_mknetrel.



? pats
Index: .cvsignore
===
RCS file: /cvs/cygwin-apps/mknetrel/.cvsignore,v
retrieving revision 1.2
diff -p -u -r1.2 .cvsignore
--- .cvsignore  9 Jul 2002 03:32:14 -   1.2
+++ .cvsignore  9 Jul 2002 12:06:38 -
@@ -4,6 +4,7 @@ Makefile
 #*
 *.swp
 .cvsignore
+.bash_mknetrel
 build
 inst
 log
Index: ChangeLog
===
RCS file: /cvs/cygwin-apps/mknetrel/ChangeLog,v
retrieving revision 1.14
diff -p -u -r1.14 ChangeLog
--- ChangeLog   9 Jul 2002 06:01:59 -   1.14
+++ ChangeLog   9 Jul 2002 12:06:38 -
@@ -1,3 +1,15 @@
+2002-07-09  Jan Nieuwenhuizen  [EMAIL PROTECTED]
+
+   * bin/mknetrel: Invoke atexit () before exiting.
+   (atexit): New function.
+   (drop): New funtion.
+   (usage): Return (previously: exit unsuccessfully).
+   (setup): Add -X option to make mknetrel drop to shell upon error.
+   Exit successfully for -h, unsuccessfully upon usage error.
+   (setup1): Exit unsuccessfully upon usage error.
+   
+   * .cvsignore: Add .bash_mknetrel.
+
 2002-07-09  Christopher Faylor  [EMAIL PROTECTED]
 
* bin/mknetrel (doconfig): Fix more quoting problems.
Index: bin/mknetrel
===
RCS file: /cvs/cygwin-apps/mknetrel/bin/mknetrel,v
retrieving revision 1.33
diff -p -u -r1.33 mknetrel
--- bin/mknetrel9 Jul 2002 06:32:17 -   1.33
+++ bin/mknetrel9 Jul 2002 12:06:38 -
@@ -32,6 +32,24 @@ read_user_config() {
 export knownpath
 }
 
+atexit () { :; }
+
+trap atexit 0 9 15
+
+# Interactive shell with state of bash at exit upon failure
+drop ()
+{
+[ $? -eq 0 ]  trap - 0 9 15  exit 0 || true
+echo $0: dropping to shell...
+set | sed -e 's/^\(BASH_VERSINFO=\)/#\1/' \
+   -e 's/^\(EUID=\)/#\1/' \
+   -e 's/^\(PPID=\)/#\1/' \
+   -e 's/^\(SHELLOPTS=\)/#\1/' \
+   -e 's/^\(UID=\)/#\1/'  .bash_mknetrel
+echo PS1='mknetrel-debug \w$ '  .bash_mknetrel
+exec bash --rcfile .bash_mknetrel
+}
+
 setvars() {
 cd $netrel_root || exit 1
 here=`pwd`
@@ -86,19 +104,20 @@ setup() {
 read_user_config
 clean=false
 opt=-O2
-while getopts 'ihtbcCgNnxSoB' o; do
+while getopts 'ihtbcCgNnxXSoB' o; do
case $o in
'b') rebuild() { dorebuild; } ;;
'B') background() { return 0;}; output() { return 0;} ;;
'c') config() { doconfig; }; rebuild() { dorebuild; } ;;
'C') clean=: ;;
'g') opt=-O2 -g; rebuild() { dorebuild; } ;;
-   'h') usage ;;
+   'h') usage; exit 0;;
'i') knownpath= ;;
'n') mkdist() { :; } ;;
'o') output() { return 0; } ;;
'S') stripbins() { return 1; } ;;
'x') verbose() { set -x; } ;;
+   'X') atexit() { drop; } ;;
'?') exit 1 ;;
esac
 done
@@ -107,6 +126,7 @@ setup() {
 what=$1
 if [ -z $what ]; then
usage missing package name
+   exit 1
 

Re: [PATCH]: mknetrel builds Guile #2: debug

2002-07-09 Thread Earnie Boyd

Jan Nieuwenhuizen wrote:
 
 
 Btw: A very silly question, but I can't seem to get `cvs diff' to
  respect your (Cygwin's?) wishes of excluding the ChangeLog from
  the diff.  It doesn't grok -X,--exclude options, most annoying.
  How do you manage?
 

Remove the ChangeLog diff from the patch.  Copy the text from the
ChangeLog to the top of the diff file.  Patch is smart enough to ignore
the non-diff text in the front of the file.

Earnie.



Re: [PATCH]: mknetrel builds Guile #2: debug

2002-07-09 Thread Jan Nieuwenhuizen

Earnie Boyd [EMAIL PROTECTED] writes:

 Btw: A very silly question, but I can't seem to get `cvs diff' to
  respect your (Cygwin's?) wishes of excluding the ChangeLog from
  the diff.  It doesn't grok -X,--exclude options, most annoying.
  How do you manage?
 

 Remove the ChangeLog diff from the patch.  Copy the text from the
 ChangeLog to the top of the diff file.  Patch is smart enough to ignore
 the non-diff text in the front of the file.

Hrmm.  If you're going to have nonstandard requests, it would be handy
if these somehow would be handled automagically.  How dead is CVS
development, maybe they would take a patch?

Greetings,
Jan

-- 
Jan Nieuwenhuizen [EMAIL PROTECTED] | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien   | http://www.lilypond.org




Re: [PATCH]: mknetrel builds Guile #2: debug

2002-07-09 Thread Earnie Boyd

Jan Nieuwenhuizen wrote:
 
 Earnie Boyd [EMAIL PROTECTED] writes:
 
  Btw: A very silly question, but I can't seem to get `cvs diff' to
   respect your (Cygwin's?) wishes of excluding the ChangeLog from
   the diff.  It doesn't grok -X,--exclude options, most annoying.
   How do you manage?
 
 
  Remove the ChangeLog diff from the patch.  Copy the text from the
  ChangeLog to the top of the diff file.  Patch is smart enough to ignore
  the non-diff text in the front of the file.
 
 Hrmm.  If you're going to have nonstandard requests, it would be handy
 if these somehow would be handled automagically.  How dead is CVS
 development, maybe they would take a patch?
 

This has nothing to do with CVS.  It has to do with standards set by the
development teams and the fact that your changes to ChangeLog often
(most likely) cause merge conflicts.

Earnie.



Re: [PATCH]: mknetrel builds Guile #2: debug

2002-07-09 Thread Jan Nieuwenhuizen

Charles Wilson [EMAIL PROTECTED] writes:

 That's why I am investigating transitioning us to a cygwin port of
 cvsnt (no, it's not just for native windows anymore...)

And it does work with emacs' pcvs.el, right?

 The thing about the ChangeLog stuff, is that it really isn't that
 non-standard.  MOST projects dislike *patches* to ChangeLog files,

Maybe just my ignorance that I haven't seen these requests before.
It's not so much that I dislike project specific stuff (look at
LilyPond), but the fact that the current tools don't handle it
gracefully, let alone automagically.

 This is because a patch to ChangeLog *never* (okay, ALMOST never)
 applies cleanly,

Ack.

 I tend NOT to modify the ChangeLog at all -- I put my ChangeLog
 entries in a separate file, and paste that into the email by hand...

Ok, I'm going to try that.

Jan.

-- 
Jan Nieuwenhuizen [EMAIL PROTECTED] | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien   | http://www.lilypond.org




Re: [PATCH]: mknetrel builds Guile #2: debug

2002-07-09 Thread Charles Wilson

Jan Nieuwenhuizen wrote:

 
That's why I am investigating transitioning us to a cygwin port of
cvsnt (no, it's not just for native windows anymore...)

 
 And it does work with emacs' pcvs.el, right?


Dunno.  It's based on the cvs code; most of the changes are (a) bugfixes 
-- what a concept (b) text/binary handling (c) the daemon (yay!)

Anyway, nothing's going to happen until at least September, and even 
then, there will be a long and thorough testing period before we change 
*anything*.  cvs is core; I understand the need for caution.

--Chuck





Re: [PATCH]: mknetrel builds Guile #2: debug

2002-07-09 Thread Robert Collins

mmm, time for arch/subversion/another one of the recent pack of opensource /
free software revision control systems?

Rob
- Original Message -
From: Charles Wilson [EMAIL PROTECTED]
To: Jan Nieuwenhuizen [EMAIL PROTECTED]
Cc: Earnie Boyd [EMAIL PROTECTED]
Sent: Wednesday, July 10, 2002 12:42 AM
Subject: Re: [PATCH]: mknetrel builds Guile #2: debug




 Jan Nieuwenhuizen wrote:


 
  Hrmm.  If you're going to have nonstandard requests, it would be handy
  if these somehow would be handled automagically.  How dead is CVS
  development, maybe they would take a patch?


 Deader than roadkill, IMO.  I think they are in permanennt bugfix only
 mode (except for new features developed in house by the maintainers
 themselves).

 That's why I am investigating transitioning us to a cygwin port of cvsnt
 (no, it's not just for native windows anymore...)

 The thing about the ChangeLog stuff, is that it really isn't that
 non-standard.  MOST projects dislike *patches* to ChangeLog files, and
 request that ChangeLog entries be sent in cut-n-paste form.  This is
 because a patch to ChangeLog *never* (okay, ALMOST never) applies
 cleanly, since it is extremely likely that your patch will be queued up
 behind others, which ALSO affect the ChangeLog at exactly the same spot
 yours does: the top.

 I tend NOT to modify the ChangeLog at all -- I put my ChangeLog entries
 in a separate file, and paste that into the email by hand...

 --Chuck








Re: [PATCH]: mknetrel builds Guile #2: debug

2002-07-09 Thread Christopher Faylor

On Tue, Jul 09, 2002 at 02:45:46PM +0200, Jan Nieuwenhuizen wrote:
2002-07-09  Jan Nieuwenhuizen  [EMAIL PROTECTED]

   * bin/mknetrel: Invoke atexit () before exiting.
   (atexit): New function.
   (drop): New funtion.
   (usage): Return (previously: exit unsuccessfully).
   (setup): Add -X option to make mknetrel drop to shell upon error.
   Exit successfully for -h, unsuccessfully upon usage error.
   (setup1): Exit unsuccessfully upon usage error.
   
   * .cvsignore: Add .bash_mknetrel.

I've applied a slight variation of this patch.  I kept the exit in usage
but made it exit 1 when usage was given an argument.

Thanks.

cgf



[PATCH]: mknetrel builds Guile #2: debug

2002-07-08 Thread Jan Nieuwenhuizen


   - add debugging feature: drop to shell upon failure




diff -purNX .cvsignore ../mknetrel.jcn1.init/.cvsignore ./.cvsignore
--- ../mknetrel.jcn1.init/.cvsignoreMon Jul  8 15:42:06 2002
+++ ./.cvsignoreMon Jul  8 16:04:09 2002
@@ -2,3 +2,4 @@ CVS
 *~
 #*
 .#*
+.bash_mknetrel
diff -purNX .cvsignore ../mknetrel.jcn1.init/ChangeLog ./ChangeLog
--- ../mknetrel.jcn1.init/ChangeLog Tue Jul  9 01:17:39 2002
+++ ./ChangeLog Tue Jul  9 01:17:29 2002
@@ -1,5 +1,16 @@
 2002-07-08  Jan Nieuwenhuizen  [EMAIL PROTECTED]
 
+   * VERSION mknetrel.jcn2.debug
+
+   * .cvsignore: Add .bash_mknetrel.
+
+   * bin/mknetrel (drop): New funtion.  Add trap command, to invoke
+   drop () upon unsuccessful exit, so that user make investigate at
+   the spot what went wrong.  To test this, make a function such as
+   postconfig () or postbuild () return an error.
+   (usage): Don't drop to shell.  Use exit value 2, commonly for
+   usage errors.
+
* VERSION mknetrel.jcn1.init
 
* .cvsignore: New file.
diff -purNX .cvsignore ../mknetrel.jcn1.init/bin/mknetrel ./bin/mknetrel
--- ../mknetrel.jcn1.init/bin/mknetrel  Tue Jul  9 01:06:32 2002
+++ ./bin/mknetrel  Tue Jul  9 01:07:05 2002
@@ -14,6 +14,23 @@ read_user_config() {
 : ${build_config_opts='--build=i686-pc-linux --host=i686-pc-cygwin 
--target=i686-pc-cygwin'}
 }
 
+# Interactive shell with state of bash at exit upon failure
+drop ()
+{
+[ $? -eq 0 ]  trap - 0 9 15  exit 0 || true
+echo $0: dropping to shell...
+set | sed -e 's/^\(BASH_VERSINFO=\)/#\1/' \
+   -e 's/^\(EUID=\)/#\1/' \
+   -e 's/^\(PPID=\)/#\1/' \
+   -e 's/^\(SHELLOPTS=\)/#\1/' \
+   -e 's/^\(UID=\)/#\1/'  .bash_mknetrel
+echo PS1='mknetrel-debug \w$ '  .bash_mknetrel
+exec bash --rcfile .bash_mknetrel
+}
+
+# Call drop at exit
+trap drop 0 9 15
+
 setvars() {
 mknetrel=$(cd $(dirname $0)/..; pwd)
 cd $netrel_root || exit 1
@@ -329,7 +346,7 @@ Options:
 Available packages:
   $(cd $(dirname $0)/../extra  echo *[a-z])
  12
-exit 1
+trap - 0 9 15  exit 2
 }
 
 rest() {



-- 
Jan Nieuwenhuizen [EMAIL PROTECTED] | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien   | http://www.lilypond.org