#!/bin/bash MH_VERSION=$(ls /usr/share/maven-repo/org/debian/maven/maven-packager-utils/ | sed 's|/||') . /usr/share/maven-repo-helper/mh_lib.sh CLASSPATH="/usr/share/java/maven-repo-helper.jar:/usr/share/java/maven-packager-utils.jar" syntax() { echo -e "Usage: mh_resolve_dependencies [option]... " echo -e "Resolve the dependencies and generates the substvars" echo -e "file containing the list of dependent packages." echo -e "" echo -e "Where" echo -e "\t is the name of the binary package," echo -e "\t e.g. libcommons-lang-java. Default to the first binary" echo -e "\t found in the debian/control file" echo -e "Options:" echo -e "\t-h --help: show this text" echo -e "\t-V --version: show the version" echo -e "\t-p --package=: name of the package" echo -e "\t-j --javadoc: resolve the Javadoc dependencies" echo -e "\t-n --non-interactive: non interactive mode, don't ask questions" echo -e "\t-o --offline: don't ever connect to the internet, for Debian build" echo -e "\t compatibility." echo -e "\t-v --verbose: show more information while running" echo -e "\t-b --base-directory: path to root directory of package" echo -e "\t --non-explore: doesn't explore directories for pom.xml" echo -e "\t --build: build mode (don't write the .poms and rules files)" echo -e "" echo -e "Description:" echo -e "This tool reads the POM files defined in debian/$package.poms" echo -e "and scans the Maven repository in /usr/share/maven-repo." echo -e "It then extracts the dependencies required for the current" echo -e "package and store them in the file debian/$package.substvars" echo -e "where they can be read by debhelper." echo -e "The variables defined are:" echo -e " maven:Depends - the list of runtime dependencies" echo -e " maven:OptionalDepends - the list of optional runtime dependencies" echo -e " maven:CompileDepends - the list of compile-time dependencies" echo -e " maven:TestDepends - the list of test dependencies" exit 1 } ARGS="p package d javadoc v verbose n non-interactive o offline b base-directory non-explore build" parseargs "$@" PACKAGE=$(getarg p package) GEN_JAVADOC=$(getarg j javadoc) NON_INTERACTIVE=$(getarg n non-interactive) OFFLINE=$(getarg o offline) VERBOSE=$(getarg v verbose) BASE_DIR=$(getarg b base-directory) NON_EXPLORE=$(getarg non-explore) BUILD=$(getarg build) if [ -z "$PACKAGE" ]; then if [ "$ARGC" -gt "0" ]; then PACKAGE="${ARGV[0]}" else PACKAGE=$(dh_listpackages | head -1) fi fi if [ ! -e .debianVersion -a ! -e debian/stamp-poms-patched ]; then touch .debianVersion CREATED_POMS=false if [ ! -e debian/${PACKAGE}.poms ]; then CREATED_POMS=true mh_lspoms $PACKAGE fi mh_patchpoms -p$PACKAGE --keep-pom-version if [ $CREATED_POMS ]; then rm debian/${PACKAGE}.poms fi fi java $JAVA_OPTS -cp $CLASSPATH org.debian.maven.packager.DependenciesSolver ${NON_INTERACTIVE:+--non-interactive} ${NON_EXPLORE:+--non-explore} ${OFFLINE:+--offline} ${BUILD:+--build} ${GEN_JAVADOC:+--generate-javadoc} ${BASE_DIR:+--base-directory=$BASE_DIR} ${VERBOSE:+--verbose} --package=$PACKAGE --maven-repo=/usr/share/maven-repo perl -p -i -e 's/maven\./maven:/' debian/${PACKAGE}.substvars