| 1 | #!/bin/bash -- |
| 2 | |
| 3 | MH_VERSION=$(ls /usr/share/maven-repo/org/debian/maven/maven-packager-utils/ | sed 's|/||') |
| 4 | . /usr/share/maven-repo-helper/mh_lib.sh |
| 5 | |
| 6 | syntax() |
| 7 | { |
| 8 | echo -e "Usage: mh_lspoms [option]... <package>" |
| 9 | echo -e "Looks for all POM files defined in the source of the project." |
| 10 | echo -e "" |
| 11 | echo -e "Where" |
| 12 | echo -e "\t<package> is the name of the binary package," |
| 13 | echo -e "\t e.g. libcommons-lang-java. Default to the first binary" |
| 14 | echo -e "\t found in the debian/control file" |
| 15 | echo -e "Options:" |
| 16 | echo -e "\t-h --help: show this text" |
| 17 | echo -e "\t-V --version: show the version" |
| 18 | echo -e "\t-p<package> --package=<package>: package to act on" |
| 19 | echo -e "\t-f --force: force run even if the .poms files exist." |
| 20 | echo -e "\t Only maven.rules will be created, assuming that it" |
| 21 | echo -e "\t did not exist before." |
| 22 | echo -e "\t-n --non-interactive: non interactive session, don't ask questions." |
| 23 | echo -e "\t-o --offline: don't ever connect to the internet, for Debian build" |
| 24 | echo -e "\t compatibility." |
| 25 | echo -e "" |
| 26 | echo -e "You need to execute it on the unpacked origial source tree, merged with the" |
| 27 | echo -e "debian/ folder. It will create the file debian/<binary package>.poms which" |
| 28 | echo -e "contains all the POMs to deploy to the Maven repository and is used by" |
| 29 | echo -e "mh_installpoms." |
| 30 | echo -e "" |
| 31 | echo -e "The contents of debian/<binary package>.poms should be:" |
| 32 | echo -e "\t* one POM file location per line," |
| 33 | echo -e "\t* optionally, the location is followed by the option --no-parent" |
| 34 | echo -e "\t to indicate that if this POM inherits from a parent, the parent" |
| 35 | echo -e "\t element will be removed." |
| 36 | exit 1 |
| 37 | } |
| 38 | |
| 39 | ARGS="p package f force n non-interactive o offline" parseargs "$@" |
| 40 | |
| 41 | PACKAGE=$(getarg p package) |
| 42 | FORCE=$(getarg f force) |
| 43 | NON_INTERACTIVE=$(getarg n non-interactive) |
| 44 | OFFLINE=$(getarg o offline) |
| 45 | |
| 46 | if [ -z "$PACKAGE" ]; then |
| 47 | if [ "$ARGC" -gt "0" ]; then |
| 48 | PACKAGE="${ARGV[0]}" |
| 49 | else |
| 50 | PACKAGE=$(dh_listpackages | head -1) |
| 51 | fi |
| 52 | fi |
| 53 | |
| 54 | if [ -e debian/$PACKAGE.poms -a -z "$FORCE" ]; then |
| 55 | echo "debian/$PACKAGE.poms already exist. Please delete it if you want to regenerate it." |
| 56 | else |
| 57 | mkdir -p debian |
| 58 | java -cp /usr/share/java/maven-project.jar:/usr/share/java/maven-repo-helper.jar:/usr/share/java/maven-packager-utils.jar org.debian.maven.packager.DependenciesSolver ${NON_INTERACTIVE:+--non-interactive} ${OFFLINE:+--offline} --package=$PACKAGE --maven-repo=/usr/share/maven-repo |
| 59 | rm debian/$PACKAGE.substvars |
| 60 | echo "The list of POM files is now in debian/$PACKAGE.poms" |
| 61 | fi |
| 62 |