[pkg-java] r8163 - in trunk/maven-repo-helper: debian src/main/bin src/main/share

ludovicc-guest at alioth.debian.org ludovicc-guest at alioth.debian.org
Wed Apr 1 12:15:04 UTC 2009


Author: ludovicc-guest
Date: 2009-04-01 12:15:03 +0000 (Wed, 01 Apr 2009)
New Revision: 8163

Added:
   trunk/maven-repo-helper/src/main/bin/mh_lspoms
Modified:
   trunk/maven-repo-helper/debian/changelog
   trunk/maven-repo-helper/debian/rules
   trunk/maven-repo-helper/src/main/bin/dh_mavenrepo
   trunk/maven-repo-helper/src/main/bin/mh_generate_scripts
   trunk/maven-repo-helper/src/main/share/postinst.tmpl
   trunk/maven-repo-helper/src/main/share/postrm.tmpl
Log:
* Add dh_mavenrepo script

Modified: trunk/maven-repo-helper/debian/changelog
===================================================================
--- trunk/maven-repo-helper/debian/changelog	2009-03-31 23:49:09 UTC (rev 8162)
+++ trunk/maven-repo-helper/debian/changelog	2009-04-01 12:15:03 UTC (rev 8163)
@@ -1,4 +1,4 @@
-maven-repo-helper (0.1-0ubuntu1~ppa9) jaunty; urgency=low
+maven-repo-helper (0.1-0ubuntu1~ppa11) jaunty; urgency=low
 
   * Initial release. (Closes: #521947)
 

Modified: trunk/maven-repo-helper/debian/rules
===================================================================
--- trunk/maven-repo-helper/debian/rules	2009-03-31 23:49:09 UTC (rev 8162)
+++ trunk/maven-repo-helper/debian/rules	2009-04-01 12:15:03 UTC (rev 8163)
@@ -16,4 +16,7 @@
 	dh_install -p$(PACKAGE) src/main/bin /usr
 	dh_install -p$(PACKAGE) src/main/share/* /usr/share/$(PACKAGE)
 	dh_link -p$(PACKAGE) /usr/share/java/$(PACKAGE)-$(VERSION).jar /usr/share/java/$(PACKAGE).jar
+	dh_link -p$(PACKAGE) /usr/share/$(PACKAGE)/postinst.tmpl /usr/share/debhelper/autoscripts/postinst-maven-repo
+	dh_link -p$(PACKAGE) /usr/share/$(PACKAGE)/postrm.tmpl /usr/share/debhelper/autoscripts/postrm-maven-repo
 
+

Modified: trunk/maven-repo-helper/src/main/bin/dh_mavenrepo
===================================================================
--- trunk/maven-repo-helper/src/main/bin/dh_mavenrepo	2009-03-31 23:49:09 UTC (rev 8162)
+++ trunk/maven-repo-helper/src/main/bin/dh_mavenrepo	2009-04-01 12:15:03 UTC (rev 8163)
@@ -12,7 +12,7 @@
 
 =head1 SYNOPSIS
 
-B<dh_mavenrepo> [S<I<debhelper options>>] [B<-n>] [B<-X>I<item>] [B<-V> I<version>] [S<I<module dirs ...>>]
+B<dh_mavenrepo> [S<I<debhelper options>>] [B<-n>]
 
 =head1 DESCRIPTION
 
@@ -21,55 +21,82 @@
 in the Maven repository updated with the current list of libraries and their
 versions.
 
-dh_pycentral will also generate substitution variables: the
-${python:Provides} variable will contain versioned provides of the package
-(if the package's name starts with "python-"). A python-foo package could
-provide "python2.3-foo" and "python2.4-foo" at the same time. Python
-extensions have to provide those whereas it's only option for pure python
-modules.
-
-The ${python:Versions} variable should be used to provide the required
-XB-Python-Version field listing the python versions supported by the
-package.
-
 =head1 OPTIONS
 
 =over 4
 
-=item I<module dirs>
+=item B<-n>, B<--noscripts>
 
-If your package installs python modules in non-standard directories, you
-can make dh_pycentral check those directories by passing their names on the
-command line. By default, it will check /usr/lib/$PACKAGE, /usr/share/$PACKAGE, /usr/lib/games/$PACKAGE,
-/usr/share/games/$PACKAGE and /usr/lib/python?.?/site-packages.
+Do not modify postinst/postrm scripts.
 
-Note: only /usr/lib/python?.?/site-packages and the
-extra names on the command line are searched for binary (.so) modules.
+=back
 
-=item B<-V> I<version>
+=head1 CONFORMS TO
 
-If the .py files your package ships are meant to be used by a specific
-pythonX.Y version, you can use this option to specify the desired version,
-such as 2.3. Do not use if you ship modules in /usr/lib/site-python.
+Java policy, version TODO
 
-With the new policy, this option is mostly deprecated. Use the
-XS-Python-Field to indicate that you're using a specific python version.
+=cut
 
-=item B<-n>, B<--noscripts>
+init();
 
-Do not modify postinst/postrm scripts.
+my $versionPropertiesFile = "debian/tmp/versions.properties";
 
-=item B<-X>I<item>, B<--exclude=>I<item>
+if (! $dh{NOSCRIPTS}) {
+    foreach my $package (@{$dh{DOPACKAGES}}) {
+    	doit(("rm","-rf","debian/tmp"));
+        if ( -e "debian/$package.poms" ) {
+            cleanpoms("debian/$package.poms");
+            my $libraries = readLibraries();
+			autoscript($package,"postinst","postinst-maven-repo","s%#PACKAGE#%$package%;s%#LIBRARIES#%$libraries%");
+			autoscript($package,"postrm","postrm-maven-repo","s%#LIBRARIES#%$libraries%");
+        }
+    }
+}
 
-Exclude files that contain "item" anywhere in their filename from being
-taken into account to generate the python dependency. You may use this
-option multiple times to build up a list of things to exclude.
+sub cleanpoms {
+    my $pomsFile = shift;
+	open(POMS, $pomsFile) ||
+	    error("Can't open $pomsFile: $!");
+	foreach my $line (<POMS>) {
+        chomp($line);
+		if ($line ne '') {
+            my $pom='';
+            my $opts='';
+            my @elems=split(' ',$line);
+            push(@elems, '');
+            ($pom,$opts)=@elems;
+			doit("mh_cleanpom $opts $pom");
+		}
+	}
+	close(POMS);
+}
 
-=back
+sub readLibraries {
+   	open(VERSIONS, $versionPropertiesFile) ||
+        error("Can't open $versionPropertiesFile: $!");
+    my $libraries = '';
+	foreach my $line (<VERSIONS>) {
+        chomp($line);
+        $_=$line;
+		if (! ($line eq '') && ! (substr($line,0,1) eq '#')) {
+            s/\.version=/ /g;
+            $libraries .= $_ . ",";
+        }
+    }
+    close(VERSIONS);
+    return $libraries;
+}
 
-=head1 CONFORMS TO
+=head1 SEE ALSO
 
-Python policy, version 0.4.1 (2006-06-20)
+L<debhelper(7)>
 
-=cut
+This program is a part of maven-repo-helper but is made to work with debhelper.
 
+=head1 AUTHORS
+
+Ludovic Claude <ludovic.claude at laposte.net>
+
+Also includes bits of the dh_pycentral written by Raphael Hertzog <hertzog at debian.org>.
+
+=cut
\ No newline at end of file

Modified: trunk/maven-repo-helper/src/main/bin/mh_generate_scripts
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_generate_scripts	2009-03-31 23:49:09 UTC (rev 8162)
+++ trunk/maven-repo-helper/src/main/bin/mh_generate_scripts	2009-04-01 12:15:03 UTC (rev 8163)
@@ -20,22 +20,24 @@
     VERSION_PROPERTIES_FILE="debian/tmp/versions.properties"
 fi
 
+mh_lspoms $PACKAGE > /dev/null
+
 # Automatic execution of mh_cleanpom to fill versions.properties
 if [ ! -f "$VERSION_PROPERTIES_FILE" ]; then
     echo "$VERSION_PROPERTIES_FILE not found, trying to generate it by executing"
     echo "mh_cleanpom on all pom.xml files"
-    find_poms | while read POM; do
+    cat debian/$PACKAGE.poms | while read POM OPTS; do
         echo "mh_cleanpom $POM"
-        mh_cleanpom $POM
+        mh_cleanpom $OPTS $POM
     done
 fi
 
 echo_script() {
     echo "#!/bin/sh"
     echo "set -e"
-    echo "LIBRARIES=\"$(cat $VERSION_PROPERTIES_FILE | grep -v ^#.* | sed s/\.version=/' '/ | tr '\n' ',')\""
-    echo "PACKAGE=\"$PACKAGE\""
-    cat /usr/share/maven-repo-helper/post$DO.tmpl
+    LIBRARIES=$(cat $VERSION_PROPERTIES_FILE | grep -v ^#.* | sed s/\.version=/' '/ | tr '\n' ',')
+    cat /usr/share/maven-repo-helper/post$DO.tmpl | sed s/"#PACKAGE#"/"$PACKAGE"/g | sed sed s/"#LIBRARIES#"/"$LIBRARIES"/g
+    echo "#DEBHELPER#"
 }
 
 DO="inst"
@@ -65,13 +67,13 @@
 if [ -f debian/tmp/pom.properties ]; then
     source debian/tmp/pom.properties
 fi
-find_poms | while read POM; do
+cat debian/$PACKAGE.poms | while read POM OPTS; do
     if [[ "$POM" = "pom.xml" || "$POM" = "debian/pom.xml" ]]; then
-        echo "    mh_installpom --debian-parent -p$BIN_PACKAGE $POM"
+        echo "    mh_installpom $OPTS -p$BIN_PACKAGE $POM"
         echo "    mh_installjar -p$BIN_PACKAGE $POM build/\$(PACKAGE)-\$(VERSION).jar usr/share/java/\$(PACKAGE)-\$(VERSION).jar usr/share/java/\$(PACKAGE).jar"
     elif [ ! -z "$POM" ]; then
         BASENAME=$(basename $(dirname $POM))
-        echo "    mh_installpom -p$BIN_PACKAGE $POM"
+        echo "    mh_installpom $OPTS -p$BIN_PACKAGE $POM"
         echo "    mh_installjar -p$BIN_PACKAGE $POM build/\$(PACKAGE)-\$(VERSION).jar usr/share/java/$BASENAME-\$(VERSION).jar usr/share/java/\$(PACKAGE).jar"
     fi
 done
\ No newline at end of file

Added: trunk/maven-repo-helper/src/main/bin/mh_lspoms
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_lspoms	                        (rev 0)
+++ trunk/maven-repo-helper/src/main/bin/mh_lspoms	2009-04-01 12:15:03 UTC (rev 8163)
@@ -0,0 +1,25 @@
+QUIET=false
+if [ "$1" = "-q" ]; then
+    QUIET=true
+    shift
+fi
+
+PACKAGE=$1
+
+if [ -z "$PACKAGE" ]; then
+    echo "Syntax:"
+    echo "mh_lspoms <binary package>"
+    exit 1
+fi
+
+if [ -e debian/$PACKAGE.poms ]; then
+  if [ "$QUIET" = "false" ]; then
+    echo debian/$PACKAGE.poms already exist. Please delete it if you want to regenerate it.
+  fi
+else
+  find . -path '*/.*' -prune -o -type f -print | grep -e /pom\.xml$ | grep -v "debian/tmp" | sed s,./,, | sed -e's,^\(debian/pom\.xml\|pom\.xml\),\1 --debian-parent,' > debian/$PACKAGE.poms
+  if [ "$QUIET" = "false" ]; then
+    echo The list of POM files is now in debian/$PACKAGE.poms
+  fi
+fi
+

Modified: trunk/maven-repo-helper/src/main/share/postinst.tmpl
===================================================================
--- trunk/maven-repo-helper/src/main/share/postinst.tmpl	2009-03-31 23:49:09 UTC (rev 8162)
+++ trunk/maven-repo-helper/src/main/share/postinst.tmpl	2009-04-01 12:15:03 UTC (rev 8163)
@@ -1,5 +1,8 @@
 DEBIAN_POM="/usr/share/maven-repo/org/debian/debian-parent/1.0-SNAPSHOT/debian-parent-1.0-SNAPSHOT.pom"
 
+LIBRARIES="#LIBRARIES#"
+PACKAGE="#PACKAGE#"
+
 if [ ! -f $DEBIAN_POM ]; then
     mkdir -p $(dirname $DEBIAN_POM)
     echo "<?xml version="1.0" encoding="UTF-8"?>" > $DEBIAN_POM
@@ -37,4 +40,3 @@
     done
 fi
 
-#DEBHELPER#

Modified: trunk/maven-repo-helper/src/main/share/postrm.tmpl
===================================================================
--- trunk/maven-repo-helper/src/main/share/postrm.tmpl	2009-03-31 23:49:09 UTC (rev 8162)
+++ trunk/maven-repo-helper/src/main/share/postrm.tmpl	2009-04-01 12:15:03 UTC (rev 8163)
@@ -1,5 +1,7 @@
 DEBIAN_POM="/usr/share/maven-repo/org/debian/debian-parent/1.0-SNAPSHOT/debian-parent-1.0-SNAPSHOT.pom"
 
+LIBRARIES="#LIBRARIES#"
+
 remove_repo_property() {
     VERSION_PROPERTY=$1
     cat $DEBIAN_POM | grep -v "<$VERSION_PROPERTY" > pom.tmp
@@ -30,4 +32,3 @@
     fi
 fi
 
-#DEBHELPER#




More information about the pkg-java-commits mailing list