[pkg-java] r7883 - in trunk/maven-debian-helper: . bin cdbs debian share share/maven-debian-helper

twerner at alioth.debian.org twerner at alioth.debian.org
Sun Jan 25 21:01:27 UTC 2009


Author: twerner
Date: 2009-01-25 21:01:27 +0000 (Sun, 25 Jan 2009)
New Revision: 7883

Added:
   trunk/maven-debian-helper/share/
   trunk/maven-debian-helper/share/maven-debian-helper/
   trunk/maven-debian-helper/share/maven-debian-helper/copy-repo.sh
Modified:
   trunk/maven-debian-helper/bin/mvn-debian
   trunk/maven-debian-helper/cdbs/maven-vars.mk
   trunk/maven-debian-helper/cdbs/maven.mk
   trunk/maven-debian-helper/debian/changelog
   trunk/maven-debian-helper/debian/install
Log:
Create our own maven repository during build time.

Modified: trunk/maven-debian-helper/bin/mvn-debian
===================================================================
--- trunk/maven-debian-helper/bin/mvn-debian	2009-01-25 18:14:08 UTC (rev 7882)
+++ trunk/maven-debian-helper/bin/mvn-debian	2009-01-25 21:01:27 UTC (rev 7883)
@@ -1,21 +1,20 @@
 #!/bin/sh
 
 # This is an example script that allows running maven on the command
-# line in a similar way as our cdbs snippets work. Copy this script to
-# /usr/local/bin if you want to have it in the $PATH. Production use is
+# line in a similar way as our cdbs snippets work. Production use is
 # not supported by the maintainer of maven-debian-helper.
 
 DEB_CLASSPATH=/usr/share/java/classworlds.jar
 JAVA_OPTS=-Dclassworlds.conf=/etc/maven2/m2-debian.conf
 MAIN_CLASS=org.codehaus.classworlds.Launcher
 MAVEN_OPTS=-s/etc/maven2/settings-debian.xml
-MAVEN_REPO=/usr/share/maven-repo
 
-AUTO_PROPS=$(mktemp)
-find $MAVEN_REPO -name "*.pom" | \
-  sed -e"s,^$MAVEN_REPO/,," \
-      -e"s,/\([0-9][^/]*\).*,.version = \1," \
-      -e"s,/,.,g"                            > $AUTO_PROPS
+TMP_DIR=$(mktemp -d ${TMP:-/tmp}/mvn-deb.XXXXXXXXXX)
+/usr/share/maven-debian-helper/copy-repo.sh $TMP_DIR
+MAVEN_REPO=$TMP_DIR/maven-repo
+MAVEN_OPTS="$MAVEN_OPTS -Dmaven.repo.local=$MAVEN_REPO"
+
+AUTO_PROPS=$TMP_DIR/auto.properties
 JAVA_OPTS="$JAVA_OPTS -Dproperties.file.auto=$AUTO_PROPS"
 MAVEN_OPTS="$MAVEN_OPTS -Ddebian.dir=$PWD/debian"
 
@@ -26,5 +25,5 @@
 
 java -noverify -cp $DEB_CLASSPATH $JAVA_OPTS $MAIN_CLASS "$@" $MAVEN_OPTS
 
-rm $AUTO_PROPS
+rm -rf $TMP_DIR
 

Modified: trunk/maven-debian-helper/cdbs/maven-vars.mk
===================================================================
--- trunk/maven-debian-helper/cdbs/maven-vars.mk	2009-01-25 18:14:08 UTC (rev 7882)
+++ trunk/maven-debian-helper/cdbs/maven-vars.mk	2009-01-25 21:01:27 UTC (rev 7883)
@@ -70,6 +70,7 @@
 		 $(JAVA_OPTS) -Dclassworlds.conf=/etc/maven2/m2-debian.conf \
 		 org.codehaus.classworlds.Launcher $(DEB_MAVEN_ARGS) \
 		 -s/etc/maven2/settings-debian.xml \
+		 -Dmaven.repo.local=$(DEB_MAVEN_REPO) \
 		 $(if $(MAVEN_ARGS_$(cdbs_curpkg)),$(MAVEN_ARGS_$(cdbs_curpkg)),$(MAVEN_ARGS))
 
 # The name of the binary package that gets the jar files installed. The

Modified: trunk/maven-debian-helper/cdbs/maven.mk
===================================================================
--- trunk/maven-debian-helper/cdbs/maven.mk	2009-01-25 18:14:08 UTC (rev 7882)
+++ trunk/maven-debian-helper/cdbs/maven.mk	2009-01-25 21:01:27 UTC (rev 7883)
@@ -29,7 +29,7 @@
 include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)
 include $(_cdbs_class_path)/maven-vars.mk$(_cdbs_makefile_suffix)
 
-DEB_MAVEN_REPO := /usr/share/maven-repo
+DEB_MAVEN_REPO := $(CURDIR)/debian/maven-repo
 
 JAVA_OPTS = \
   $(shell test -n "$(DEB_MAVEN_PROPERTYFILE)" && echo -Dproperties.file.manual=$(DEB_MAVEN_PROPERTYFILE)) \
@@ -48,10 +48,7 @@
 	fi
 
 debian/auto.properties:
-	find $(DEB_MAVEN_REPO) -name '*.pom' | \
-	  sed -e's,^$(DEB_MAVEN_REPO)/,,' \
-	      -e's,/\([0-9][^/]*\).*,.version = \1,' \
-	      -e's,/,.,g'                            > $@
+	/usr/share/maven-debian-helper/copy-repo.sh $(CURDIR)/debian
 
 common-build-arch common-build-indep:: debian/stamp-maven-build maven-sanity-check
 debian/stamp-maven-build: debian/auto.properties
@@ -60,7 +57,7 @@
 
 cleanbuilddir:: maven-sanity-check apply-patches debian/auto.properties
 	-$(DEB_MAVEN_INVOKE) $(DEB_MAVEN_CLEAN_TARGET)
-	$(RM) debian/auto.properties debian/stamp-maven-build
+	$(RM) -r debian/auto.properties $(DEB_MAVEN_REPO) debian/stamp-maven-build
 
 # extra arguments for the installation step
 PLUGIN_ARGS = -Ddebian.dir=$(CURDIR)/debian -Ddebian.package=$(DEB_JAR_PACKAGE)

Modified: trunk/maven-debian-helper/debian/changelog
===================================================================
--- trunk/maven-debian-helper/debian/changelog	2009-01-25 18:14:08 UTC (rev 7882)
+++ trunk/maven-debian-helper/debian/changelog	2009-01-25 21:01:27 UTC (rev 7883)
@@ -2,8 +2,9 @@
 
   UNRELEASED
   * Implement better exception handling.
+  * Create our own maven repository during build time.
 
- -- Torsten Werner <twerner at debian.org>  Sun, 25 Jan 2009 12:27:03 +0100
+ -- Torsten Werner <twerner at debian.org>  Sun, 25 Jan 2009 20:33:10 +0100
 
 maven-debian-helper (0.2) unstable; urgency=low
 

Modified: trunk/maven-debian-helper/debian/install
===================================================================
--- trunk/maven-debian-helper/debian/install	2009-01-25 18:14:08 UTC (rev 7882)
+++ trunk/maven-debian-helper/debian/install	2009-01-25 21:01:27 UTC (rev 7883)
@@ -2,3 +2,4 @@
 cdbs/*     /usr/share/cdbs/1/class/
 etc/*      /etc/maven2/
 maven-repo /usr/share/
+share      /usr/

Added: trunk/maven-debian-helper/share/maven-debian-helper/copy-repo.sh
===================================================================
--- trunk/maven-debian-helper/share/maven-debian-helper/copy-repo.sh	                        (rev 0)
+++ trunk/maven-debian-helper/share/maven-debian-helper/copy-repo.sh	2009-01-25 21:01:27 UTC (rev 7883)
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+set -e
+
+SRC_REPO="/usr/share/maven-repo"
+DEST_REPO="$1/maven-repo"
+
+find_all_poms() {
+  find $SRC_REPO -name '*.pom' -printf '%P\n'
+}
+
+find_all_meta() {
+  find $DEST_REPO -name 'maven-metadata-tmp.xml'
+}
+
+header() {
+  echo "<?xml version="1.0" encoding="UTF-8"?>"
+  echo "<metadata>"
+  echo "  <versioning>"
+  echo "    <versions>"
+}
+
+footer() {
+  echo "    </versions>"
+  echo "  </versioning>"
+  echo "</metadata>"
+}
+
+echo_meta() {
+  header
+  cat $META
+  footer
+}
+
+if [ -z "$1" ]; then
+  echo "ABORT: missing destination dir"
+  exit 1
+fi
+
+find_all_poms | while read POM; do
+  VER_DIR=$(dirname $POM)
+  VER_TAG="      <version>$(basename $VER_DIR)</version>"
+  BASE_DIR=$(dirname $VER_DIR)
+  mkdir -p $DEST_REPO/$BASE_DIR
+  ln -s $SRC_REPO/$VER_DIR $DEST_REPO/$BASE_DIR/
+  echo "$VER_TAG" >> $DEST_REPO/$BASE_DIR/maven-metadata-tmp.xml
+done
+
+find_all_meta | while read META; do
+  DIR=$(dirname $META)
+  echo_meta > $DIR/maven-metadata.xml
+  rm -f $META
+done
+
+find -L $DEST_REPO -name "*.pom" | \
+  sed -e"s,^$DEST_REPO/,," \
+      -e"s,/\([0-9][^/]*\).*,.version = \1," \
+      -e"s,/,.,g"                            > $1/auto.properties


Property changes on: trunk/maven-debian-helper/share/maven-debian-helper/copy-repo.sh
___________________________________________________________________
Name: svn:executable
   + *




More information about the pkg-java-commits mailing list