From fcb6f469468b2afaf43cde2bae773d0fd0dfa16e Mon Sep 17 00:00:00 2001
From: fred <fred>
Date: Wed, 27 Mar 2002 01:00:00 +0000
Subject: [PATCH] lilypond-1.3.145

---
 Documentation/pictures/GNUmakefile  | 17 +++++-
 make/lilypond.spec.in               | 17 +++---
 scripts/update-lily.py              | 80 +++++++++++++++++++++--------
 stepmake/stepmake/generic-vars.make |  3 ++
 stepmake/stepmake/package.make      |  5 +-
 5 files changed, 87 insertions(+), 35 deletions(-)

diff --git a/Documentation/pictures/GNUmakefile b/Documentation/pictures/GNUmakefile
index 488c762d9b..45e722b781 100644
--- a/Documentation/pictures/GNUmakefile
+++ b/Documentation/pictures/GNUmakefile
@@ -6,14 +6,27 @@ OUTGIF_FILES = $(addprefix $(outdir)/,$(XPM_FILES:.xpm=.gif))
 OUTPNG_FILES = $(addprefix $(outdir)/,$(XPM_FILES:.xpm=.png))
 
 EXTRA_DIST_FILES= $(XPM_FILES)
+OUT_DIST_FILES = $(package-icon)
 
 include $(depth)/make/stepmake.make
 
-gifs: $(OUTGIF_FILES)
+default: $(package-icon)
+local-dist: $(package-icon)
+
+xgifs: $(OUTGIF_FILES)
 pngs: $(OUTPNG_FILES)
 
 # local-WWW: $(OUTGIF_FILES)
 local-WWW: $(OUTPNG_FILES)
 
-icon: $(outdir)/lelie_icon.gif
+xicon: $(outdir)/lelie-icon.gif
 	cp $< $(depth)/$(outdir)/$(package)-icon.gif
+
+icon: $(package-icon)
+
+#$(package-icon): $(outdir)/lelie-icon.png 
+#	cp $< $@
+
+$(package-icon): lelie-icon.xpm
+	cp $< $@
+
diff --git a/make/lilypond.spec.in b/make/lilypond.spec.in
index 7e653fef03..f98142ef72 100644
--- a/make/lilypond.spec.in
+++ b/make/lilypond.spec.in
@@ -6,12 +6,15 @@ Release: 1
 License: GPL
 Group: Applications/Publishing
 Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-@TOPLEVEL_VERSION@.tar.gz
+# music notation software for.. ?
 Summary: A program for printing sheet music.
 URL: http://www.cs.uu.nl/~hanwen/lilypond
-# Icon: @package@-icon.gif
+# rpm: 4.0: broken for -ta builds: rpm doesn't look in tarball for xpm
+# Icon: @package@-icon.xpm
 BuildRoot: /tmp/lilypond-install
 Prereq: tetex
 
+# use keywords: music notation software
 %description
 LilyPond is a music typesetter.  It produces beautiful
 sheet music using a high level description file as input.  LilyPond is
@@ -50,7 +53,7 @@ make all
 # even if documentation fails to build
 
 make -C Documentation  || true
-make htmldoc || true
+make web || true
 
 %install
 
@@ -80,10 +83,8 @@ cp buildscripts/out/lilypond-login $RPM_BUILD_ROOT%{_prefix}/../etc/profile.d/li
 #%install documentation
 #line 63: second %install
 # again, make sure that main package installs even if doco fails
-mkdir -p htmldocs/out
-tar -C htmldocs -xzf out/htmldoc.tar.gz || true
-mkdir -p out/examples/
-tar -cf - input/  | tar -C out/examples/ -xf- || true
+mkdir -p web/out
+tar -C web -xzf out/web.tar.gz || true
 
 %ifos cygwin
 # urg, this symlink doesn't come through on cygwin
@@ -154,6 +155,4 @@ fi
 # this gets too messy...
 # %doc input/*.ly
 # verbatim include of input: list the directory without issuing a %dir 
-%doc htmldocs/
-%doc out/examples/
-%doc mutopia/
+%doc web/
diff --git a/scripts/update-lily.py b/scripts/update-lily.py
index 1e2c75afee..b683bab2ff 100644
--- a/scripts/update-lily.py
+++ b/scripts/update-lily.py
@@ -44,11 +44,25 @@ _ = gettext.gettext
 program_name = 'build-lily'
 package_name = 'lilypond'
 help_summary = _("Fetch and rebuild from latest source package")
-build_root = os.environ ['HOME'] + '/usr/src'
-build_command = '(./configure --prefix=$HOME/usr && make all web) >> log.txt 2>&1'
-
+build_root = os.path.join (os.environ ['HOME'], 'usr', 'src')
 release_dir = build_root + '/releases'
 patch_dir = build_root + '/patches'
+notify = 0
+
+build_command = '''
+cd %b &&
+[ -d %n-%v ] && exit 1 || true;
+(
+tar xzf %r/%t &&
+rm -f building &&
+ln -s %n-%v building &&
+cd %n-%v &&
+./configure --prefix=$HOME/usr && make all web
+) >> %n-%v/log.txt 2>&1 &&
+rm -f %n &&
+ln -s %n%-%v %n
+'''
+
 
 url = 'file:/home/ftp/pub/gnu/LilyPond/development/lilypond-*.tar.gz'
 url = 'ftp://appel.lilypond.org/pub/gnu/LilyPond/development/lilypond-*.tar.gz'
@@ -220,8 +234,16 @@ def set_setting (dict, key, val):
 
 option_definitions = [
 	('DIR', 'b', 'build-root', _ ("unpack and build in DIR [%s]") % build_root),
+	('COMMAND', 'c', 'command', _ ("execute COMMAND, subtitute:") \
+	 + '\n                            ' + _ ("%b: build root") \
+	 + '\n                            ' + _ ("%n: package name") \
+	 + '\n                            ' + _ ("%r: release directory") \
+	 + '\n                            ' + _ ("%t: tarball") \
+	 + '\n                            ' + _ ("%v: package version") \
+	 ),
 	('', 'h', 'help', _ ("this help")),
         ('', 'k', 'keep', _ ("keep all output, and name the directory %s") % temp_dir),
+        ('EMAIL', 'n', 'notify', _ ("upon failure notify EMAIL[,EMAIL]"),
 	('', 'r', 'remove-previous', _ ("remove previous build")),
 	('', 'V', 'verbose', _ ("verbose")),
 	('', 'v', 'version', _ ("print version number")),
@@ -337,12 +359,21 @@ def find_latest (url):
 	return join_package (list[-1])
 
 def build (p):
-	os.chdir (build_root)
-	system ('tar xzf %s/%s.tar.gz' % (release_dir, p))
-	system ('rm -f building')
-        os.symlink ('%s/%s' % (build_root, p), 'building')
-	os.chdir (p)
-	return system (build_command)
+	tar_ball = p + '.tar.gz'
+	(tar_name, tar_version) = split_package (tar_ball)
+	
+	expand = {
+		'%b' : build_root,
+		'%n' : tar_name,
+		'%r' : release_dir,
+		'%v' : version_tuple_to_str (tar_version),
+		'%t' : tar_ball,
+		}
+
+	c = build_command
+	for i in expand.keys ():
+		c = re.sub (i, expand[i], c)
+	return system (c, 1)
 
 (sh, long) = getopt_args (__main__.option_definitions)
 try:
@@ -361,6 +392,10 @@ for opt in options:
 		help ()
 	elif o == '--buid-root' or o == '-b':
 		build_root = a
+	elif o == '--command' or o == '-c':
+		build_command = a
+	elif o == '--notify' or o == '-n':
+		notify = a
 	elif o == '--remove-previous' or o == '-r':
 		remove_previous_p = 1
 	elif o == '--url' or o == '-u':
@@ -377,8 +412,7 @@ for opt in options:
 if 1:
 	latest = find_latest (url)
 
-	#if os.path.isdir ('%s/%s' % (build_root, latest)):
-	if os.path.isdir ('%s/%s/%s' % (build_root, latest, 'lily/out/lilypond')):
+	if os.path.isdir ('%s/%s' % (build_root, latest)):
 		progress (_ ("latest is %s") % latest)
 		progress (_ ("relax, %s is up to date" % package_name))
 		sys.exit (0)
@@ -403,16 +437,20 @@ if 1:
 		progress (_ ("fetching %s...") % get)
 		copy_url (get, '.')
 
-	if not build (latest):
-		if os.path.isdir ('%s/%s' % (build_root, package_name)):
-			os.chdir ('%s/%s' % (build_root, package_name))
-			previous = os.getcwd ()
-			os.chdir (build_root)
-			if remove_previous_p:
-				system ('echo rm -rf %s/%s' % (build_root, previous))
-			
-		system ('rm -f %s' % package_name)
-		os.symlink ('%s/%s' % (build_root, latest),  package_name)
+	if os.path.isdir (os.path.join (build_root, package_name)):
+		os.chdir (os.path.join (build_root, package_name))
+		previous = os.getcwd ()
+	else:
+		previous = 0
+
+	progress (_ ("building %s...") % latest)
+	os.chdir (build_root)
+	if build (latest) previous and remove_previous_p:
+		system ('rm -rf %s' % os.path.join (build_root, previous))
+	else:
+		if notify:
+			system ('(date; uname -a) | mail -s "%s failed" %s' % (program_name, notify)
+		sys.exit (1)
 		
 	os.chdir (original_dir)
 	if release_dir != temp_dir:
diff --git a/stepmake/stepmake/generic-vars.make b/stepmake/stepmake/generic-vars.make
index 37f75620bf..9fd7e36d3e 100644
--- a/stepmake/stepmake/generic-vars.make
+++ b/stepmake/stepmake/generic-vars.make
@@ -57,6 +57,9 @@ rpm-sources = $(release-dir)
 rpm-build = $(group-dir)/RedHat/BUILD
 #
 
+# package-icon=$(outdir)/$(package)-icon.gif
+package-icon=$(outdir)/$(package)-icon.xpm
+
 
 # need to be defined in local Makefiles:
 #
diff --git a/stepmake/stepmake/package.make b/stepmake/stepmake/package.make
index f0fa0c0330..9f62f66f81 100644
--- a/stepmake/stepmake/package.make
+++ b/stepmake/stepmake/package.make
@@ -1,7 +1,5 @@
 # stepmake/Package.make
 
-package-icon=$(outdir)/$(package)-icon.gif
-
 deb:
 	$(MAKE) -C $(depth)/debian
 
@@ -26,6 +24,7 @@ diff:
 release: 
 	$(PYTHON) $(step-bindir)/release.py --outdir=$(topdir)/$(outdir) --package=$(topdir)
 
-rpm: $(depth)/$(package-icon) dist
+# rpm: $(depth)/$(package-icon) dist
+rpm: dist
 	su -c 'rpm -tb $(depth)/$(outdir)/$(distname).tar.gz'
 
-- 
2.39.5