[Pkg-mono-svn-commits] rev 3720 - monodoc/trunk/debian

David Paleino hanska-guest at alioth.debian.org
Sat Oct 11 16:14:32 UTC 2008


Author: hanska-guest
Date: 2008-10-11 16:14:32 +0000 (Sat, 11 Oct 2008)
New Revision: 3720

Added:
   monodoc/trunk/debian/dh_installmonodoc
   monodoc/trunk/debian/monodoc-base.dirs
   monodoc/trunk/debian/postinst-monodoc
   monodoc/trunk/debian/postrm-monodoc
Modified:
   monodoc/trunk/debian/changelog
   monodoc/trunk/debian/monodoc-base.install
   monodoc/trunk/debian/monodoc-base.manpages
   monodoc/trunk/debian/rules
Log:
* Monodoc Integration Framework:
  + dh_installmonodoc
    - debian/dh_installmonodoc added
    - debian/monodoc-base.dirs added
    - debian/monodoc-base.install updated
    - debian/monodoc-base.manpages updated
    - debian/postinst-monodoc added
    - debian/postrm-monodoc added
    - debian/rules updated

Modified: monodoc/trunk/debian/changelog
===================================================================
--- monodoc/trunk/debian/changelog	2008-10-11 13:45:06 UTC (rev 3719)
+++ monodoc/trunk/debian/changelog	2008-10-11 16:14:32 UTC (rev 3720)
@@ -5,8 +5,19 @@
     dependency (mono-xsp-base), but not building against XSP reveals the 
     problem. Thanks to Steve Langasek <steve.langasek at ubuntu.com>.
 
- -- Jo Shields <directhex at apebox.org>  Thu, 28 Aug 2008 10:45:14 +0100
+  [ David Paleino ]
+  * Monodoc Integration Framework:
+    + dh_installmonodoc
+      - debian/dh_installmonodoc added
+      - debian/monodoc-base.dirs added
+      - debian/monodoc-base.install updated
+      - debian/monodoc-base.manpages updated
+      - debian/postinst-monodoc added
+      - debian/postrm-monodoc added
+      - debian/rules updated
 
+ -- David Paleino <d.paleino at gmail.com>  Sat, 11 Oct 2008 17:54:24 +0200
+
 monodoc (1.9-2) unstable; urgency=low
 
   [ Mirco Bauer ]

Added: monodoc/trunk/debian/dh_installmonodoc
===================================================================
--- monodoc/trunk/debian/dh_installmonodoc	                        (rev 0)
+++ monodoc/trunk/debian/dh_installmonodoc	2008-10-11 16:14:32 UTC (rev 3720)
@@ -0,0 +1,155 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_installmonodoc - register assemblies' documentation with Monodoc
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+use File::Temp qw/ tempfile /;
+
+=head1 SYNOPSIS
+
+B<dh_monodoc> [S<I<debhelper options>>] [B<-n>]
+
+=head1 DESCRIPTION
+
+dh_monodoc is a debhelper program that is responsible for
+installing assemblies' documentation with Monodoc.
+
+It also automatically generates the postinst and prerm commands needed
+to register/unregister the documentation from the Monodoc registry.
+See L<dh_installdeb(1)> for an explanation of how this works.
+
+This is based on L<dh_installcligac(1)> in the cli-common-dev package.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-n>, B<--noscripts>
+
+Do not modify postinst/prerm scripts.
+
+=back
+
+=head1 NOTES
+
+Note that this command is not idempotent. "dh_clean -k" should be called
+between invocations of this command. Otherwise, it may cause multiple
+instances of the same text to be added to maintainer scripts.
+
+=cut
+
+init();
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+	my $tmp = tmpdir($package);
+
+	my $monodoc = pkgfile($package, "installmonodoc");
+	my $line;
+	my $path;
+	my $name;
+	my $label;
+	my $parent;
+
+	if ($monodoc ne '') {
+		open MONODOC, "<$monodoc" or
+			die "E: Can't open $monodoc\n";
+		
+		while (<MONODOC>)
+		{
+			chomp;
+			$line = $_;
+			$line =~ s/^\s*#.*//;
+			$line =~ s/^\s+//;
+			$line =~ s/\s+$//;
+			next unless length($line);
+			
+			($path, $name, $label, $parent) = split(/ /, $line, 4);
+
+			# Handle " and ' without inner spaces
+			if ($label =~ /([\"\']).*\1/) {
+				$label =~ s/$1//g;
+			}
+			# The label usually has spaces, handle " and ' correctly.
+			elsif ($label =~ /([\"\']).*/) {
+				my $sep = $1;
+				my $tmp = $parent if $parent;
+				$tmp =~ s/(.*)[\"\'] [^\"\']*/$1/g;
+				$label = "$label ".$tmp;
+				$label =~ s/["']//g;
+				$parent =~ s/${tmp}${sep}\s*//;
+				$parent = "" if ($parent eq $tmp);
+			}
+			#print "$path $name «$label» --$parent--\n";
+
+			if (! $path) {
+				die "E: Please specify the 'path' parameter for '$label'.\n";
+			} else {
+				if (! -d "$tmp$path") {
+					die "E: Can't find specified path ($path) in temporary build directory ($tmp)!\n";
+				} else {
+					if (! -f "$tmp$path$name.tree") {
+						die "E: Can't find $name.tree in $tmp$path!\n";
+					}
+					if (! -f "$tmp$path$name.zip") {
+						die "E: Can't find $name.zip in $tmp$path!\n";
+					}
+					if (! -f "$tmp$path$name.source") {
+						die "E: Can't find $name.source in $tmp$path!\n";
+					}
+				}
+			}
+			if (! $label) {
+				die "E: Please specify a label.\n";
+			}
+			
+			# Let's set defaults for optional parameters
+			$parent = "various" if !$parent;
+			
+			# Let's install the documentation.
+			print "Installing «$label» in local documentation registry... ";
+			
+			# We are currently using the "Local Registry" approach.
+			# Please see http://wiki.debian.org/Teams/DebianMonoGroup/MonodocIntegration
+			# for more information.
+			if (! -d "$tmp/usr/share/monodoc/manuals.d") {
+				doit("install","-d","$tmp/usr/share/monodoc/manuals.d");
+			}
+
+			# Let's create our temporary file.
+			my ($fh, $filename);
+			($fh, $filename) = tempfile("/tmp/".basename($0).".XXXX", UNLINK => 1);
+			
+			# This is our "registry file", same format as .installmonodoc, but ONE FILE PER MANUAL
+			#  (i.e. if .installmonodoc has 5 lines, we should have 5 files in manuals.d/.)
+			print $fh "$name \"$label\" $parent\n" or return undef;
+			doit("install", "-m0644", $filename, "$tmp/usr/share/monodoc/manuals.d/$name");
+			close $fh;
+			
+			print "done.\n";
+		}
+		close MONODOC;
+		
+		if (! $dh{NOSCRIPTS}) {
+			my $ath = "Foo";
+			autoscript($package, "postinst", "postinst-monodoc", "s/#PACKAGE#/$package/");
+			autoscript($package, "postrm", "postrm-monodoc", "s/#PACKAGE#/$package/");
+		}
+	}
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is a part of cli-common-dev.
+
+=head1 AUTHOR
+
+David Paleino <d.paleino at gmail.com>
+
+=cut


Property changes on: monodoc/trunk/debian/dh_installmonodoc
___________________________________________________________________
Name: svn:executable
   + *

Added: monodoc/trunk/debian/monodoc-base.dirs
===================================================================
--- monodoc/trunk/debian/monodoc-base.dirs	                        (rev 0)
+++ monodoc/trunk/debian/monodoc-base.dirs	2008-10-11 16:14:32 UTC (rev 3720)
@@ -0,0 +1,2 @@
+usr/bin/
+usr/share/debhelper/autoscripts/

Modified: monodoc/trunk/debian/monodoc-base.install
===================================================================
--- monodoc/trunk/debian/monodoc-base.install	2008-10-11 13:45:06 UTC (rev 3719)
+++ monodoc/trunk/debian/monodoc-base.install	2008-10-11 16:14:32 UTC (rev 3720)
@@ -4,3 +4,7 @@
 debian/tmp/usr/lib/monodoc/*.exe
 debian/tmp/usr/lib/pkgconfig/monodoc.pc
 debian/tmp/usr/share/man
+
+debian/dh_installmonodoc	usr/bin/
+debian/postinst-monodoc		usr/share/debhelper/autoscripts/
+debian/postrm-monodoc		usr/share/debhelper/autoscripts/

Modified: monodoc/trunk/debian/monodoc-base.manpages
===================================================================
--- monodoc/trunk/debian/monodoc-base.manpages	2008-10-11 13:45:06 UTC (rev 3719)
+++ monodoc/trunk/debian/monodoc-base.manpages	2008-10-11 16:14:32 UTC (rev 3720)
@@ -1,2 +1,3 @@
 debian/man/mod.1
 debian/man/monodoc.1
+debian/man/dh_installmonodoc.1

Added: monodoc/trunk/debian/postinst-monodoc
===================================================================
--- monodoc/trunk/debian/postinst-monodoc	                        (rev 0)
+++ monodoc/trunk/debian/postinst-monodoc	2008-10-11 16:14:32 UTC (rev 3720)
@@ -0,0 +1,3 @@
+if [ "$1" = "configure" ] && [ -x /usr/bin/update-monodoc ]; then
+	/usr/bin/update-monodoc
+fi

Added: monodoc/trunk/debian/postrm-monodoc
===================================================================
--- monodoc/trunk/debian/postrm-monodoc	                        (rev 0)
+++ monodoc/trunk/debian/postrm-monodoc	2008-10-11 16:14:32 UTC (rev 3720)
@@ -0,0 +1,3 @@
+if [ "$1" = "remove" ] || [ "$1" = "upgrade" ] && [ -x /usr/bin/update-monodoc ]; then
+	/usr/bin/update-monodoc
+fi

Modified: monodoc/trunk/debian/rules
===================================================================
--- monodoc/trunk/debian/rules	2008-10-11 13:45:06 UTC (rev 3719)
+++ monodoc/trunk/debian/rules	2008-10-11 16:14:32 UTC (rev 3720)
@@ -10,6 +10,11 @@
 	dh_testdir
 	./configure --prefix=/usr
 	$(MAKE)
+	
+	# Generate the manpage
+	chmod +x debian/dh_installmonodoc;
+	pod2man -c "Debhelper for Monodoc" debian/dh_installmonodoc > debian/man/dh_installmonodoc.1
+
 	touch build-stamp
 
 clean: clean-stamp unpatch
@@ -21,6 +26,7 @@
 	    tools/monodocer1.exe.mdb tools/monodocs2html.exe \
 	    tools/monodocs2html.exe.mdb tools/monodocs2slashdoc.exe \
 	    tools/monodocs2slashdoc.exe.mdb
+	rm -f debian/dh_installmonodoc.1
 	[ ! -f Makefile ] || $(MAKE) clean
 	rm -f build-stamp
 	rm -rf $$MONO_SHARED_DIR/.wapi




More information about the Pkg-mono-svn-commits mailing list