Re: [install info (using perl) 1/2] Add support for an info version of the user manual

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

>> This part worries me.
>
> Aside from possible portability issue of multi-line script,
> there is another slight problem I am not sure if it is worth
> fixing.  If you do not have docbook2x-texi installed, nobody
> notices that resulting $*.texi was a garbage and an almost empty
> git.info is generated.

How about doing something like this instead?

---

 Documentation/Makefile      |   13 ++++---------
 Documentation/fix-texi.perl |   15 +++++++++++++++
 2 files changed, 19 insertions(+), 9 deletions(-)
 create mode 100755 Documentation/fix-texi.perl

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 56d12aa..8c33729 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -154,16 +154,11 @@ user-manual.html: user-manual.xml
 	xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
 
 git.info: user-manual.xml
-	$(RM) $@ $*.texi
-	$(DOCBOOK2X_TEXI) user-manual.xml --to-stdout | \
-	perl -ne 'if (/^\@setfilename/) {$$_="\@setfilename git.info\
-"} elsif (/^\@direntry/) {print "\@dircategory Development\
-\@direntry\
-* Git: (git).           A fast distributed revision control system\
-\@end direntry\
-"} print unless (/^\@direntry/ .. /^\@end direntry/)' > $*.texi
+	$(RM) $@ $*.texi $*.texi+
+	$(DOCBOOK2X_TEXI) user-manual.xml --to-stdout >$*.texi+
+	perl fix-texi.perl <$*.texi+ >$*.texi
 	$(MAKEINFO) --no-split $*.texi
-	$(RM) $*.texi
+	$(RM) $*.texi $*.texi+
 
 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
 	$(RM) $@+ $@
diff --git a/Documentation/fix-texi.perl b/Documentation/fix-texi.perl
new file mode 100755
index 0000000..ff7d78f
--- /dev/null
+++ b/Documentation/fix-texi.perl
@@ -0,0 +1,15 @@
+#!/usr/bin/perl -w
+
+while (<>) {
+	if (/^\@setfilename/) {
+		$_ = "\@setfilename git.info\n";
+	} elsif (/^\@direntry/) {
+		print '@dircategory Development
+@direntry
+* Git: (git).           A fast distributed revision control system
+@end direntry
+';	}
+	unless (/^\@direntry/../^\@end direntry/) {
+		print;
+	}
+}

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux