javatools-0.45ubuntu1/0000775000000000000000000000000012265205647011671 5ustar javatools-0.45ubuntu1/jh_installlibs.10000664000000000000000000000221412265203313014737 0ustar .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. .TH JAVAHELPER "1" "January 2008" "Javahelper Version 0.5" "User Commands" .SH NAME Javahelper \- Part of the Java Helper packaging tools Refer to the tutorials in /usr/share/doc/javahelper for more detail .SH SYNOPSIS .B jh_installlibs [\fIoptions\fR] [\fIjars\fR] .SH OPTIONS .HP \fB\-h\fR \fB\-\-help\fR: show this text .HP \fB\-V\fR \fB\-\-version\fR: show the version .HP \fB\-i\fR \fB\-\-indep\fR: act on all Arch: all packages .HP \fB\-a\fR \fB\-\-arch\fR: act on all Arch\-specific packages .HP \fB\-p\fR \fB\-\-package=\fR: package to act on (default=all) .HP \fB\-P\fR \fB\-\-tmpdir=\fR: package directory (default=$CWD/debian/package) .HP \fB\-v\fR \fB\-\-verbose\fR: show more information while running .HP \fB\-n\fR \fB\-\-no\-act\fR: don't actually do anything, just print the results .HP \fB\-\-no\-mangle\fR: don't try and sanitize the upstream version number .HP \fB\-\-upstream\-version=\fR: manually set the upstream version .HP \fB\-\-version\-strip=\fR: manually supply the regex to remove from the upstream version number javatools-0.45ubuntu1/jh_linkjars0000775000000000000000000000414712265203313014107 0ustar #!/bin/bash -- set -e . /usr/share/javahelper/jh_lib.sh syntax() { echo -e "Usage: jh_linkjars [options] [target]" echo -e "Options:" echo -e "\t-h --help: show this text" echo -e "\t-V --version: show the version" echo -e "\t-v --verbose: show more information while running" echo -e "\t-t --transitive: transitively link jars" echo -e "\t-n --no-act: don't actually do anything, just print the results" echo -e "\t-u --unlink: remove the links instead of adding them" exit 1 } ARGS="v verbose n no-act u unlink t transitive" parseargs "$@" function findjars() { pkg="$1" if [ -z "$pkg" ]; then pkg="$(sed -n '/^Source:/s/.*: //p' < debian/control)" BDS=$(grep-dctrl --no-field-names --show-field Build-Depends,Build-Depends-Indep -F source "$pkg" debian/control | tr , ' ' | sed 's/([^)]*)//g') else BDS=$(dpkg -s "$pkg" | sed -n 's/([^)]*)//g;s/,/ /g;/^Depends:/s/.*: //p') fi JARS="" for d in $BDS; do j="$(dpkg -L $d | grep "^/usr/share/java/.*\.jar$")" k="" if [ -n "$j" ] && [ `getarg t transitive` ]; then k=$(findjars "$d") fi JARS="$JARS $j $k" done echo $JARS } function unlinkjars() { target="$1" JARS="`findjars`" for j in $JARS; do if [ -n "`getarg n no-act`" ]; then echo rm -f "$target/`basename "$j"`" continue fi if [ -n "`getarg v verbose`" ]; then echo Removing link for $j from $target fi rm -f "$target/`basename "$j"`" done } function linkjars() { target="$1" JARS="`findjars`" if [ -z "`getarg n no-act`" ]; then mkdir -p "$target" fi for j in $JARS; do if [ -f "$j" ]; then if [ -n "`getarg n no-act`" ]; then echo ln -sf "$j" "$target/" continue fi if [ -n "`getarg v verbose`" ]; then echo Adding link for $j to $target fi ln -sf "$j" "$target/" fi done } dh_testdir if [ "$ARGC" != "0" ] ; then target="${ARGV[0]}" if [ -n "`getarg u unlink`" ]; then unlinkjars "$target" else linkjars "$target" fi elif [ -f debian/linkjars ]; then for target in `cat debian/linkjars`; do if [ -n "`getarg u unlink`" ]; then unlinkjars "$target" else linkjars "$target" fi done fi javatools-0.45ubuntu1/jh_depends0000775000000000000000000001707412265203313013717 0ustar #!/bin/bash -- MINJARWRAPPERVER=0.5 . /usr/share/javahelper/jh_lib.sh set -e syntax() { echo -e "Usage: jh_depends [options]" echo -e "Options:" echo -e "\t-h --help: show this text" echo -e "\t-V --version: print the version" echo -e "\t-p --package=: package to act on (default=all)" echo -e "\t-P --tmpdir=: package directory (default=\$CWD/debian/package)" echo -e "\t-v --verbose: show more information while running" echo -e "\t-i --indep: work on all indep packages" echo -e "\t-a --arch: work on all arch-specific packages" echo -e "\t-s --same-arch: alias of --arch for compatibility with debhelper" echo -e "\t-n --no-act: don't actually do anything, just print the results" echo -e "\t-j[] --jvm[=]: Options are: default, headless, gcj, open, open6 or open7. Can be a space-separated list." echo -e "\t-X --exclude=: don't add this package to depends" echo -e "" echo -e "Note: \"headless\" (for --jvm) affects other values and alternatives (e.g. java7-runtime becomes" echo -e " java7-runtime-headless) and \"default\" cannot be used with any other value except \"headless\"" echo -e " If \"headless\" is the only value given then it is assumed to be \"headless default\"" exit 1 } # getclassversion # returns the max of and getclassversion() { current=$1 classes="$2" for i in `find "$classes" -name "*.class"`; do new=$(hexdump -n 1 -s 7 -e '/1 "%u"' "$i") if (( $current < $new )); then current=$new fi done echo $current } # getalternatedepends getalternatedepends() { if (( $1 < 50 )); then echo "| java5-runtime$2 | java6-runtime$2 | java7-runtime$2" elif [ "$1" == "50" ]; then echo "| java6-runtime$2 | java7-runtime$2" elif [ "$1" == "51" ]; then echo "| java7-runtime$2" else echo "Warning: Class version too new to recognise ($1), might not run with any JVMs" 1>&2 fi } function home-to-jvm() { JHOME="$1" if echo $JHOME | grep headless >/dev/null; then JVM="$JVM headless" fi if echo $JHOME | grep default >/dev/null; then JVM="$JVM default" fi if echo $JHOME | grep gcj >/dev/null; then JVM="$JVM gcj" fi if echo $JHOME | grep 6-openjdk >/dev/null; then JVM="$JVM open6" fi if echo $JHOME | grep 7-openjdk >/dev/null; then JVM="$JVM open7" fi echo "$JVM" } ARGS="X exclude p package P tmpdir v verbose i indep a arch s same-arch n no-act j jvm" parseargs "$@" VERBOSE="`getarg v verbose`" dh_testdir TEMPDIR=`mktemp -d` OLDDIR=`pwd` WRAPPER= EXCLUDES="`getarg X exclude`" PACKAGES=`findpackages` for p in $PACKAGES; do PACKAGEDIR="`getarg P tmpdir`" if [ -z "$PACKAGEDIR" ]; then PACKAGEDIR="`pwd`/debian/$p" else PACKAGEDIR="`readlink -f $PACKAGEDIR`" fi if [ ! -d "$PACKAGEDIR" ]; then continue fi if [ -n "$VERBOSE" ]; then echo "Searching $PACKAGEDIR for $p" fi # Assume all links to jars points to real jars, so we do not # have to process links... hopefully. JARS=`find $PACKAGEDIR -type f -a -name '*.jar'` if [ -n "$VERBOSE" ]; then echo "Searching" $JARS fi [ -n "$TEMPDIR" ] && rm -rf "$TEMPDIR/"* cd "$TEMPDIR" JARDEPS="" classversion=0 for i in $JARS; do if [ -x "$i" ]; then WRAPPER="true" fi jar xf "$i" classversion=`getclassversion $classversion .` JARDEPS="$JARDEPS `extractline META-INF/MANIFEST.MF Class-Path`" if grep ^Main-Class META-INF/MANIFEST.MF >/dev/null; then JHOME="`extractline META-INF/MANIFEST.MF Debian-Java-Home`" JVM="`home-to-jvm "$JHOME"`" fi [ -n "$TEMPDIR" ] && rm -rf "$TEMPDIR/"* done JARDEPS=`echo $JARDEPS | xargs -n1 | sort -u` if [ -n "$VERBOSE" ]; then echo "Found Jars:" $JARDEPS fi LOCALDEBDEPS="" DEBDEPS="" NEWJARDEPS="" for i in $JARDEPS; do # Strip out leading "file://" i="$(echo "$i" | perl -pe 's{^\s*file://*}{/}')" if [ -e "$i" ]; then realjar="`readlink -f "$i"`" elif [ -e "/usr/share/java/$i" ]; then realjar="`readlink -f "/usr/share/java/$i"`" else realjar="$i" fi for j in $PACKAGES; do if ! grep "$j" <<< "$EXCLUDES" > /dev/null; then if [ -n "$VERBOSE" ]; then echo "Checking: " $OLDDIR/debian/$j$realjar fi if [ -f $OLDDIR/debian/$j$realjar ]; then LOCALDEBDEPS="$LOCALDEBDEPS $j (>= \${source:Version})" else NEWJARDEPS="$NEWJARDEPS $realjar" fi else if [ -n "$VERBOSE" ]; then echo "Excluding package $j from depends" fi fi done done if [ -n "$NEWJARDEPS" ]; then DEBDEPS="$DEBDEPS `dpkg -S $NEWJARDEPS 2>/dev/null | grep -v ^$p: | cut -d: -f1 | sort -u`" fi REALDEBDEPS="" for d in $DEBDEPS; do if grep "$d" <<< "$EXCLUDES" > /dev/null; then echo "Excluding package $d from depends" else REALDEBDEPS="$REALDEBDEPS $d" fi done DEBDEPS="$LOCALDEBDEPS $REALDEBDEPS" if [ -n "$VERBOSE" ]; then echo "Found Debs:" $DEBDEPS fi if [ -n "$WRAPPER" ]; then DEBDEPS="jarwrapper (>=0.5) $DEBDEPS" fi JVMDEPS= if [ -n "`getarg j jvm`" ] && [ -z "$JVM" ]; then JVM="`getarg j jvm`" fi if [ -n "$WRAPPER" ] && [ -z "$JVM" ]; then if [ -n "$JAVA_HOME" ]; then JVM="`home-to-jvm "$JAVA_HOME"`" else JVM="default" fi fi if [ -n "$JVM" ]; then if echo $JVM | grep -q headless ; then headless="-headless" JVM=`echo $JVM | sed s/headless//g` # Check if JVM is empty now (or just whitespace) [ -z "`echo $JVM | sed s/\s*//g`" ] && JVM="default" fi for j in $JVM; do alternateversiondeps=`getalternatedepends $classversion $headless` if [ -n "$JVMDEPS" ]; then JVMDEPS="$JVMDEPS |" fi case "$j" in "default"|"true") JVMDEPS="default-jre$headless $alternateversiondeps " break ;; "gcj") JVMDEPS="$JVMDEPS gcj-jre$headles $alternateversiondeps " ;; "open7") JVMDEPS="$JVMDEPS openjdk-7-jre$headless " ;; "open6") JVMDEPS="$JVMDEPS openjdk-6-jre$headless " ;; "open") JVMDEPS="$JVMDEPS openjdk-7-jre$headless | openjdk-6-jre$headless " ;; *) echo "Warning: unknown JVM type: $j" ;; esac done if [ -n "$JVMDEPS" ]; then JVMDEPS="$JVMDEPS, " fi fi cd "$OLDDIR" # Do not rely on the presence of /usr/share/doc, it might have been removed already and # it is a policy voliation to do so. #632620 if [ -d "$PACKAGEDIR/usr/share/doc" ] ; then API=`find "$PACKAGEDIR/usr/share/doc" -type f -name 'package-list' -exec dirname {} \;` DOC_REC=`/usr/share/javahelper/jh_scanjavadoc $API` else API='' DOC_REC='' fi if [ -n "$VERBOSE" ]; then echo "Adding substvars:" "java:Depends=$JVMDEPS`echo $DEBDEPS | sed 's/\([a-zA-Z0-9_.+-]*\( *([^)]*)\)\{0,1\}\)/\1, /g;s/, *$//'`" \ "java:Recommends=$DOC_REC" fi if [ -z "`getarg n no-act`" ]; then echo "java:Depends=$JVMDEPS`echo $DEBDEPS | sed 's/\([a-zA-Z0-9_.+-]*\( *([^)]*)\)\{0,1\}\)/\1, /g;s/, *$//'`" >> debian/$p.substvars echo "java:Recommends=$DOC_REC" >> debian/$p.substvars else echo "java:Depends=$JVMDEPS`echo $DEBDEPS | sed 's/\([a-zA-Z0-9_.+-]*\( *([^)]*)\)\{0,1\}\)/\1, /g;s/, *$//'`" echo "java:Recommends=$DOC_REC" fi unset PACKAGEDIR done rm -rf "$TEMPDIR" javatools-0.45ubuntu1/jh_clean0000775000000000000000000000041412265203313013345 0ustar #!/bin/sh -- jh_build --clean "$@" jh_linkjars --unlink jh_setupenvironment --clean [ ! -f "debian/orbitdeps.debhelper" ] || rm "debian/orbitdeps.debhelper" if [ -f "debian/.javahelper_clean" ]; then rm -f `cat debian/.javahelper_clean` debian/.javahelper_clean fi javatools-0.45ubuntu1/jh_repack.10000664000000000000000000000114312265203313013664 0ustar .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. .TH JAVAHELPER "1" "January 2008" "Javahelper Version 0.5" "User Commands" .SH NAME Javahelper \- Part of the Java Helper packaging tools Refer to the tutorials in /usr/share/doc/javahelper for more detail .SH SYNOPSIS .B jh_repack \-\-upstream\-version <\fIversion\fR> <\fItarball\fR> .SH OPTIONS .HP \fB\-h\fR \fB\-\-help\fR: show this text .HP \fB\-V\fR \fB\-\-version\fR: show the version .HP \fB\-v\fR \fB\-\-verbose\fR: show more information while running .HP \fB\-n\fR \fB\-\-no\-act\fR: don't actually do anything, just print the results javatools-0.45ubuntu1/tutorial-footer.html0000664000000000000000000000001012265203313015671 0ustar javatools-0.45ubuntu1/jarwrapper.pod0000664000000000000000000000126312265203313014540 0ustar =head1 NAME jarwrapper - wrapper script to run jar files via binfmt. =head1 SYNOPSIS jarwrapper > [I] =head1 DESCRIPTION Wrapper script that handles running executable jar-files via binfmt. Normally you would not run this directly. Executes the java program in B (determined by the Main-Class attribute in the MANIFEST) and passes I to the java program. jarwrapper looks for a number of other attributes in the MANIFEST, please refer to javahelper's tutorials for more information. =head1 SEE ALSO L The javahelper tutorials in /usr/share/doc/javahelper. These tutorials are available in the I package. =cut javatools-0.45ubuntu1/t/0000775000000000000000000000000012265205647012134 5ustar javatools-0.45ubuntu1/t/strict.t0000775000000000000000000000060312265203313013617 0ustar #!/usr/bin/perl -w use strict; use warnings; use Test::More; eval 'use Test::Strict'; plan skip_all => 'Test::Strict required to run this test' if $@; my @FILES = qw( jh_compilefeatures jh_generateorbitdir jh_installeclipse jh_manifest jh_scanjavadoc jh_setupenvironment ); for my $file (@FILES) { syntax_ok($file); strict_ok($file); } all_perl_files_ok('lib'); javatools-0.45ubuntu1/t/minimum-version.t0000775000000000000000000000053712265203313015453 0ustar #!/usr/bin/perl -w use strict; use warnings; use Test::More; eval 'use Test::MinimumVersion'; plan skip_all => 'Test::MinimumVersion required to run this test' if $@; # sarge was released with 5.8.4, etch with 5.8.8, lenny with 5.10.0 our $REQUIRED = 'v5.10.0'; all_minimum_version_ok($REQUIRED, { paths => ['.'] , no_plan => 1}); done_testing(); javatools-0.45ubuntu1/t/critic.t0000775000000000000000000000122212265203313013562 0ustar #!/usr/bin/perl use strict; use warnings; use autodie; use Test::More; plan skip_all => 'Only UNRELEASED versions are criticised' if should_skip(); eval 'use Test::Perl::Critic 1.00'; plan skip_all => 'Test::Perl::Critic 1.00 required to run this test' if $@; eval 'use PPIx::Regexp'; diag('libppix-regexp-perl is needed to enable some checks') if $@; Test::Perl::Critic->import( -profile => '.perlcriticrc' ); all_critic_ok('.'); done_testing; sub should_skip { my $skip = 1; open(my $fd, '-|', 'dpkg-parsechangelog', '-c0'); while (<$fd>) { $skip = 0 if m/^Distribution: UNRELEASED$/; } close($fd); return $skip; } javatools-0.45ubuntu1/jardetector0000775000000000000000000000012512265203313014107 0ustar #!/bin/sh -- jar tf $1 META-INF/MANIFEST.MF | grep META-INF/MANIFEST.MF >/dev/null javatools-0.45ubuntu1/jh_lib.sh.in0000664000000000000000000000627712265203313014061 0ustar # This is included by jh_* and contains common functions # # - argument parsing # - package selection # JAVATOOLS_VERSION=%JAVATOOLS_VERSION% parseargs() { ARGC=0 ARGV=() debhelper= while [ -n "$1" ]; do ignore=no arg="$1" if [ "-O" = "${arg:0:2}" ] ; then arg="${arg:2}" ignore=yes fi if [ "-V" = "$arg" ] || [ "--version" = "$arg" ]; then echo "Javahelper Version $JAVATOOLS_VERSION" exit 0 elif [ "-h" = "$arg" ] || [ "--help" = "$arg" ]; then syntax elif [ "--with" = "$arg" ]; then debhelper=true shift elif [ "-" = "${arg:1:1}" ]; then # long opt optn="`sed 's/^--\([^=]*\)\(=.*\)*$/\1/;s/-/_/g' <<< $arg`" if [ -z "$optn" ] || ! echo $ARGS | sed 's/-/_/g' | grep $optn >/dev/null; then if [ -z "$debhelper" -a "$ignore" != "yes" ]; then echo "Invalid option: $optn" syntax fi fi optv="`echo $arg | sed -n 's/^[^=]*=\(.*\)$/\1/p'`" if [ -z "$optv" ]; then optv=true fi optname="opt_$optn" if [ -n "${!optname}" ]; then export opt_$optn="${!optname} $optv" else export opt_$optn="$optv" fi elif [ "-" = "${arg:0:1}" ]; then # short opt optn="${arg:1:1}" if [ -z "$optn" ] || ! echo $ARGS | grep $optn >/dev/null; then if [ -z "$debhelper" -a "$ignore" != "yes" ]; then echo "Invalid option: $optn" syntax fi fi optv="${arg:2}" if [ -z "$optv" ]; then optv=true fi optname="opt_$optn" if [ -n "${!optname}" ]; then export opt_$optn="${!optname} $optv" else export opt_$optn="$optv" fi else # not-opt arg ARGV[$ARGC]="$arg" ARGC=$(( $ARGC + 1 )) fi shift done # treat DH_VERBOSE being set as a -v flag if [ -n "$DH_VERBOSE" ]; then export opt_v="true" fi export ARGC export ARGV } findpackages() { if [ -n "$opt_p" ]; then echo $opt_p elif [ -n "$opt_package" ]; then echo $opt_package elif [ -n "$opt_i" ] || [ -n "$opt_indep" ]; then egrep '^(Package|Architecture)' debian/control | grep -B1 'Architecture: all'|sed -n '/^Package:/s/^[^:]*: *//p' elif [ -n "$opt_a" ] || [ -n "$opt_arch" ] || [ -n "$opt_s" ] || [ -n "$opt_same_arch" ]; then egrep '^(Package|Architecture)' debian/control | grep -v 'Architecture: all' | grep -B1 Architecture|sed -n '/^Package:/s/^[^:]*: *//p' else sed -n '/^Package:/s/^[^:]*: *//p' debian/control fi } firstpackage() { findpackages | head -n1 } getarg() { while [ -n "$1" ]; do optn="`sed 's/-/_/g' <<< opt_$1`" if [ -n "${!optn}" ]; then echo ${!optn} fi shift done } # extractline extractline() { count=`wc -l < "$1"` inkey= value= i=1 while (( $i <= $count )); do line="`head -n$i "$1" | tail -n1 | sed -e 's/\r//'`" if [ -n "$inkey" ]; then if [ "${line:0:1}" == " " ]; then value="$value${line:1}" else break fi else if echo "$line" | grep "^$2:" > /dev/null; then inkey=true value="`sed 's/^[^:]*: *//' <<< $line`" fi fi i=$(( $i + 1 )) done echo $value } javatools-0.45ubuntu1/.perlcriticrc0000664000000000000000000000463512265203313014353 0ustar # -*- conf -*- # FIXME: the list of checks should probably be moved to # t/scripts/critic.pl. Line continuations are not supported here verbose = 1 # Severity is actually ignored for our main purposes, see below severity = 1 # Work based on a whitelist only = 1 # Our whitelist (ignores severity): include = ExplicitReturnUndef GlobFunction NegativeIndices PrivateVars UselessInitialization MatchVars NumberSeparators NullStatements LongChainsOfMethodCalls UseStrict UseWarnings EndWithOne ConditionalUseStatements PackageMatchesPodName JoinedReadline UnreachableCode TrailingWhitespace InterpolationOfLiterals ImplicitNewlines CommaSeparatedStatements UseStrict UseWarnings UnusedVariables UnusedCapture TwoArgOpen ProhibitHardTabs MismatchedOperators IndirectSyntax Modules:: BuiltinFunctions:: ClassHierarchies:: CommaSeparatedStatements QuotesAsQuotelikeOperatorDelimiters MixedBooleanOperators ProhibitBarewordFileHandles #include = MixedBooleanOperators InteractiveTest UpperCaseHeredoc ReusedNames PackageVars ConditionalDeclarations SingleCharAlternation FixedStringMatches ConditionalUseStatements QuotedWordLists exclude = RequireFilenameMatchesPackage RequireVersionVar ProhibitExcessMainComplexity ProhibitStringySplit ComplexMappings StringyEval # If you want to try some other stuff, uncomment the following # (exclude is an incomplete list of things we probably won't change) # theme = security || bugs || complexity || maintenance # exclude = ExtendedFormat LineBoundaryMatch DotMatchAnything AutomaticExportation BuiltinHomonyms FinalReturn PunctuationVars InitializationForLocalVars UnusualDelimiters RcsKeywords # even more stuff if theme is empty # Would be nice to fix at some point: # include = ProhibitBarewordFileHandles criticism-fatal = 1 color = 1 allow-unsafe = 1 [BuiltinFunctions::ProhibitBooleanGrep] [InputOutput::RequireCheckedSyscalls] functions = open opendir chdir read readline closedir sysopen sysread sysclose close # possible TODO read readline readdir close closedir # We don't use package versions atm. [-Modules::RequireVersionVar] [-Modules::ProhibitExcessMainComplexity] [ValuesAndExpressions::ProhibitInterpolationOfLiterals] allow_if_string_contains_single_quote = 1 [ValuesAndExpressions::ProhibitCommaSeparatedStatements] allow_last_statement_to_be_comma_separated_in_map_and_grep = 1 [-ValuesAndExpressions::ProhibitConstantPragma] [Variables::RequireLocalizedPunctuationVars] allow = %ENV %SIG $! javatools-0.45ubuntu1/javahelper.pm0000664000000000000000000000105612265203313014336 0ustar # DH Sequence for javahelper. ## no critic (Modules::RequireExplicitPackage) use warnings; use strict; use autodie; use Debian::Debhelper::Dh_Lib; insert_before('dh_compress', 'jh_installlibs'); insert_after('jh_installlibs', 'jh_classpath'); insert_after('jh_classpath', 'jh_manifest'); insert_after('jh_manifest', 'jh_exec'); insert_after('jh_exec', 'jh_depends'); insert_before('dh_installdocs', 'jh_installjavadoc'); insert_before('dh_clean', 'jh_clean'); insert_before('dh_auto_build', 'jh_linkjars'); insert_after('dh_auto_build', 'jh_build'); 1; javatools-0.45ubuntu1/fetch-eclipse-source.pod0000664000000000000000000000137712265203313016402 0ustar =head1 NAME fetch-eclipse-source - checks out an eclipse project from CVS. =head1 SYNOPSIS fetch-eclipse-source --upstream-version =head1 DESCRIPTION Used to checkout an eclispe project from CVS via L. The directory.txt is a file containing the parts to check out and is usually provided by upstream. It can also exclude parts of the upstream projects by using the exclude file (see FILES) =head1 FILES =over 4 =item debian/fetch-eclipse-source.exclude If present, this file will be used to exclude parts of the project from the resulting tarball. The file is passed to L via its I<-X> option. =back =head1 SEE ALSO L =head1 AUTHOR Niels Thykier wrote this manpage. =cut javatools-0.45ubuntu1/jh_setupenvironment0000775000000000000000000000524512265203313015717 0ustar #!/usr/bin/perl =head1 NAME jh_setupenvironment - Prepares a build environment to compile an eclipse feature. =cut use strict; use warnings; use autodie; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [B<--pde-build-dir=>I] [S>] =head1 DESCRIPTION jh_setupenvironment is a javahelper program that handles creating an environment for building an eclipse feature. It does not setup an orbit dir (use jh_generateorbitdir for that). It will copy files specified in debian/eclipse.environment as well as those given on command line into the environment dir. If no files are given per command line and the environment file is not present (or is empty), it will default to "org.eclipse.*" =head1 FILES =over 4 =item debian/eclipse.environment List of file- and directory glob patterns to copy into the build environment. =back =head1 OPTIONS =over 4 =item B<--pde-build-dir=>I Specifies where the environment should be or is placed. =item B<--clean> If passed, jh_setupenvironment will clean up the build environment. When cleaning jh_setupenvironment will not record itself in the debhelper log to avoid confusing dh, when it has to use the log to trace where it was. =back =cut my $builddir = undef; my $me = basename($0); my $clean = ''; init(options => { 'pde-build-dir=s' => \$builddir, 'clean' => sub { $clean = 1 }, }); $clean = 0 unless(defined($clean) and $clean ne q{}); $builddir = 'debian/.eclipse-build' unless(defined($builddir)); # do not write to the log if we are cleaning. inhibit_log() if($clean); if($clean){ doit('rm', '-fr', $builddir); # clean up after jh_generateorbitdeps - dh_clean tend to miss this file # because it does not "belong" to a package. doit('rm', '-f', 'debian/orbitdeps.debhelper'); } else{ my $bfile = 'debian/eclipse.environment'; if( -f $bfile){ push(@ARGV, filearray($bfile)); } push(@ARGV, 'org.eclipse.*') unless(scalar(@ARGV) > 0); doit('mkdir', '-p', $builddir); complex_doit('cp -far ' . join(' ', @ARGV) . " $builddir"); } exit(0); =head1 EXAMPLE jh_setupenvironment org.eclipse.* debian/*.properties Will clone all files and folders starting with "org.eclipse." and all property files in the debian-folder and put them into the environment. =head1 SEE ALSO L This program is a part of javahelper and uses debhelper as backend. There are also tutorials in /usr/share/doc/javahelper. =head1 AUTHOR Niels Thykier =head1 COPYRIGHT AND LICENSE Copyright 2010 by Niels Thykier This tool is free software; you may redistribute it and/or modify it under the terms of GNU GPL 2. =cut javatools-0.45ubuntu1/javahelper.mk0000664000000000000000000000357712265203313014343 0ustar # Copyright © 2009 Matthew Johnson # Description: A class to build java packages # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2, or (at # your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # 02111-1307 USA. _cdbs_scripts_path ?= /usr/lib/cdbs _cdbs_rules_path ?= /usr/share/cdbs/1/rules _cdbs_class_path ?= /usr/share/cdbs/1/class ifndef _cdbs_class_javahelper _cdbs_class_javahelper = 1 ifdef _cdbs_class_ant $(error Must include javahelper.mk before ant.mk in your rules file) endif JH_BUILD=jh_build include $(_cdbs_rules_path)/debhelper.mk$(_cdbs_makefile_suffix) common-build-indep common-build-arch:: debian/jh_build_stamp debian/jh_build_stamp: jh_linkjars $(JH_BUILD) -J $(JH_BUILD_ARGS) $(JH_BUILD_JAR) $(JH_BUILD_SRC) touch $@ clean:: jh_clean rm -f debian/jh_build_stamp if [ -n "$(JH_BUILD_JAR)" ]; then rm -f $(JH_BUILD_JAR); fi $(patsubst %,install/%,$(DEB_ALL_PACKAGES)) :: install/%: jh_installjavadoc -p$(cdbs_curpkg) $(JH_INSTALLJAVADOC_ARGS) $(patsubst %,binary-post-install/%,$(DEB_ALL_PACKAGES)) :: binary-post-install/%: jh_installlibs -p$(cdbs_curpkg) $(JH_INSTALLLIBS_ARGS) jh_classpath -p$(cdbs_curpkg) $(JH_CLASSPATH_ARGS) jh_manifest -p$(cdbs_curpkg) $(JH_MANIFEST_ARGS) jh_exec -p$(cdbs_curpkg) $(JH_EXEC_ARGS) jh_depends -p$(cdbs_curpkg) $(JH_DEPENDS_ARGS) endif # _cdbs_class_javahelper javatools-0.45ubuntu1/java-propose-classpath0000775000000000000000000000264112265203313016174 0ustar #!/bin/bash -- set -e . /usr/share/javahelper/jh_lib.sh syntax() { echo "Usage: java-propose-classpath [-c | ]" exit 1 } dodepends() { classes="$@" depends= for j in /usr/share/java/*.jar ; do if [ "$j" != "${SRC}" ] && [ -f "$j" ]; then if jar tf "$j" $classes | grep . >/dev/null; then depends="$depends $j" fi fi done echo -n "${SRC}: " realdepends= if [ -n "$depends" ]; then for j in $depends; do realdepends="$realdepends `readlink -f "$j"`" done fi echo "$realdepends" | sort -biu | xargs } ARGS="c" parseargs "$@" if [ "$ARGC" = "0" ] && [ -z "`getarg c`" ]; then syntax fi if [ -n "`getarg c`" ]; then export SRC="" dodepends `getarg c | sed 's,\.,/,g'` else for (( i=0; i < "$ARGC"; i++ )); do JAR="`readlink -f "${ARGV[$i]}"`" TEMPDIR="`mktemp -d`" OLDDIR="`pwd`" cd "$TEMPDIR" jar xf "$JAR" >/dev/null classes="`find -name '*.class' -exec jcf-dump --print-constants java.lang.Object \{\} \; | grep 'Class name:' | cut -d'"' -f2| sed 's/\[\[*L\(.*\);/\1/;s/$/.class/' |sort -u | grep -v ^java[/\.]`" cd "$OLDDIR" rm -rf "$TEMPDIR" classes2= for j in $classes; do if [ ! -f $j ]; then classes2="$classes2 $j" fi done export SRC="${ARGV[$i]}" dodepends $classes2 done fi javatools-0.45ubuntu1/jh_exec0000775000000000000000000000327112265203313013213 0ustar #!/bin/bash -- EXECDIRS="bin usr/bin usr/games" set -e . /usr/share/javahelper/jh_lib.sh syntax() { echo "Usage: jh_exec [options]" echo "Options:" echo -e "\t-h --help: show this text" echo -e "\t-V --version: print the version" echo -e "\t-i --indep: run for all Arch: all packages" echo -e "\t-a --arch: run for all Arch-specific packages" echo -e "\t-s --same-arch: alias of --arch for compatibility with debhelper" echo -e "\t-p --package=: package to act on (default=all)" echo -e "\t-P --tmpdir=: package directory (default=\$CWD/debian/package)" echo -e "\t-v --verbose: show more information while running" echo -e "\t-n --no-act: don't actually do anything, just print the results" exit 1 } ARGS="i indep a arch s same-arch p package P tmpdir v verbose n no-act" parseargs "$@" VERBOSE="`getarg v verbose`" dh_testdir for p in `findpackages`; do PACKAGEDIR="`getarg P tmpdir`" if [ -z "$PACKAGEDIR" ]; then PACKAGEDIR="`pwd`/debian/$p" else PACKAGEDIR=`readlink -f $PACKAGEDIR` fi if [ -n "$VERBOSE" ]; then echo "Searching $PACKAGEDIR for $p" fi for d in $EXECDIRS; do for j in $PACKAGEDIR/$d/*; do if [ -h "$j" ]; then TARGET=`readlink -f "$j"` if [ "${TARGET%.jar}" != "$TARGET" ]; then if [ -n "$VERBOSE" ]; then echo "Making $TARGET executable" fi if [ -z "`getarg n no-act`" ]; then chmod +x "$TARGET" else echo chmod +x "$TARGET" fi fi fi done done unset PACKAGEDIR done javatools-0.45ubuntu1/lib/0000775000000000000000000000000012265205647012437 5ustar javatools-0.45ubuntu1/lib/Debian/0000775000000000000000000000000012265205647013621 5ustar javatools-0.45ubuntu1/lib/Debian/Javahelper/0000775000000000000000000000000012265205647015702 5ustar javatools-0.45ubuntu1/lib/Debian/Javahelper/Eclipse.pm0000664000000000000000000001060112265203313017606 0ustar package Debian::Javahelper::Eclipse; =head1 NAME Debian::Javahelper::Eclipse - Eclipse Helper Library. =cut use strict; use warnings; use autodie; use Exporter qw(import); use Debian::Debhelper::Dh_Lib qw(doit error); our %EXPORT_TAGS = ( 'constants' => [qw(EOB_SYM_NAME EOB_BUNDLE_VERSION EOB_SYS_JAR)], ); our @EXPORT_OK = (@{ $EXPORT_TAGS{'constants'} }, qw(install_zipped_feature)); =head1 SYNOPSIS use Debian::Javahelper::Eclipse; my @orbitdeps = (); push(@orbitdeps, { EOB_SYM_NAME => 'org.apache.commons.net', EOB_SYS_JAR => '/usr/share/java/commons-net2.jar'}); #... # Install the feature to "$dropins/$name" install_zipped_feature($zip, "$dropins/$name"); # and symlink the following orbitdeps. install_zipped_feature($zip, "$dropins/$name", @orbitdeps); =head1 DESCRIPTION This module is used by the eclipse related javahelpers to share common code. Please note this API is not stable and backwards compatibility is not guaranteed at the current time. Please contact the maintainers if you are interested in a stable API. =head2 Definitions A bundle refers to a jar file. An orbit dependency (a.k.a orbitdep) is a bundle, which is used by eclipse or one of its features without being a part of eclipse or said feature. This module keeps track of bundles via hashes; see the EOB_* constants for relevant keys (and their expected values). =head2 Constants =over 4 =item EOB_SYM_NAME Key for hashes to fetch the symbolic name of a bundle. =item EOB_BUNDLE_VERSION Key for hashes to fetch the version of a bundle. =item EOB_SYS_JAR Key for hashes to fetch the path to the system installed jar file. Only valid for an orbit dependency and cannot be used with manifests. =back =head2 Methods =over 4 =item install_zipped_feature($fzip, $loc[, $orbitdeps[, $package, $needs]]) Unpacks the zipped feature C<$fzip> into C<$loc>, which should be a subfolder of a dropins folder (e.g. /usr/share/eclipse/dropins/emf). This can also be used to install the feature into a "build environment". In this case it should be installed into the same folder as the SDK is (this folder is usually called "SDK"). If C<$orbitdeps> is present, it should be an ARRAY ref containing orbit dependencies, which will be symlinked after unpacking. This sub only needs the EOB_SYM_NAME and EOB_SYS_JAR to be set and valid. Orbit dependencies not present in the installed folder will be ignored, so it is safe to have unrelated orbit dependencies in the ARRAY ref. If C<$package> and C<$needs> are present, the former should be the name of a debian package and the latter a hashref. The sub will populate the C<$needs> hashref with which orbit dependencies are used by the package. The C<$needs> hashref can be re-used in multiple calls to this sub. Keys in C<$needs> will be the path to the orbit jar's real location (EOB_SYS_JAR) and the value a new hashref. This hashref has as keys the names of packages and as values 1. The C<$needs> is used by jh_installeclipse to populate the ${orbit:Depends} variables for packages. =back =cut use constant { EOB_SYM_NAME => 'Bundle-SymbolicName', EOB_BUNDLE_VERSION => 'Bundle-Version', EOB_SYS_JAR => '!!EOB_SYS_JAR', }; sub install_zipped_feature{ my $fzip = shift; my $loc = shift; my $orbitdeps = shift//[]; my $package = shift; my $needs = shift; doit('mkdir', '-p', $loc); doit('unzip', '-qq', '-n', '-d', $loc, $fzip); foreach my $orbitdep (@$orbitdeps){ my $symname = $orbitdep->{${\EOB_SYM_NAME}}; my $sysjar = $orbitdep->{${\EOB_SYS_JAR}}; my @matches = glob("$loc/eclipse/plugins/${symname}_*.jar"); if(scalar(@matches) > 1){ error("${symname}_*.jar unexpected matched more than one jar; ". 'please assert whether this is intended and report a bug '. 'against javahelper.'); } foreach my $match (@matches){ doit('rm', '-f', $match); doit('ln', '-s', $sysjar, $match); if(defined($needs) && $sysjar =~ m@^/usr/share/java/@o){ $needs->{$sysjar} = {} unless(exists($needs->{$sysjar})); $needs->{$sysjar}{$package} = 1; } } } 1; } 1; =head1 AUTHOR Niels Thykier =head1 COPYRIGHT AND LICENSE Copyright 2010 by Niels Thykier This module is free software; you may redistribute it and/or modify it under the terms of GNU GPL 2. =cut javatools-0.45ubuntu1/lib/Debian/Javahelper/Java.pm0000664000000000000000000001725512265203313017117 0ustar package Debian::Javahelper::Java; =head1 NAME Debian::Javahelper::Java - Javahelper core library. =cut use strict; use warnings; use autodie; use Cwd 'abs_path'; use Exporter qw(import); use File::Spec; use Debian::Javahelper::Manifest(); our @EXPORT_OK = qw(scan_javadoc find_package_for_existing_files write_manifest_fd parse_manifest_fd ); =head1 SYNOPSIS use Debian::Javahelper::Java; my @paths = scan_javadoc("/usr/share/doc/libfreemarker-doc/api/"); print "Freemarker is linked to the following APIs: \n - ", join("\n - ", @paths), "\n"; my @packnames = find_package_for_existing_files("/bin/ls", "/bin/bash"); print "/bin/ls and /bin/bash are installed via: ", join(", ", @packnames), "\n"; =head1 DESCRIPTION This module is used by various javahelpers to share common code. Please note this API is not stable and backwards compatibility is not guaranteed at the current time. Please contact the maintainers if you are interested in a stable API. =head2 Methods =over 4 =item scan_javadoc($path) Scans the javadoc at B<$path> and returns a list of javadocs it is linked to on the system. Currently it ignores all javadocs linked via other locations than I and it also makes an assumption that the linked javadoc is in /usr/share/doc//. Of course, all Java Policy compliant packages provide their javadoc from there. If /usr/share/doc// appears to be a symlink, then it is followed (except for default-jdk-doc). =item find_package_for_existing_files(@files) Consults L to see which packages provides B<@files> and returns this list. All entries in B<@files> must exists (but is not required to be files) and should not be used on a directory. Furthermore all entries must be given with absolute path. =item parse_manifest_fd($fd, $filename) Parses a manifest from B<$fd>, which must be a readable filehandle, and returns a L. B<$filename> is only used to report parsing errors and should be something that identifies the source of B<$fd>. =item write_manifest_fd($manifest, $fd, $filename) Writes B<$manifest> to the writable filehandle B<$fd>. B<$manifest> must be a L. B<$filename> is only used to report errors and should be something that identifies B<$fd>. =item write_manifest_section_fd($section, $fd, $filename) Writes B<$section> to the writable filehandle B<$fd>. B<$section> must be a L. B<$filename> is only used to report errors and should be something that identifies B<$fd>. NB: Helper - Not exported. =item slurp_file($file) Reads all lines in B<$file> and returns them as a list. NB: Helper - Not exported. =back =cut sub scan_javadoc{ my $docloc = shift; my %phash; my @packages = slurp_file("$docloc/package-list"); # For each package in package-list (replacing "." with "/") foreach my $pack ( map { s@\.@/@go; $_; } @packages) { opendir(my $dir, "$docloc/$pack"); # For each html file in $dir foreach my $file ( grep { m/\.html$/iox } readdir($dir)){ open(my $htfile, '<', "$docloc/$pack/$file"); while( my $line = <$htfile> ){ my $target; my $packname; my $apif; next unless($line =~ m@ href=" (/usr/share/doc/[^.]++\.html) @oxi); $target = $1; $target =~ m@/usr/share/doc/([^/]++)/([^/]++)/@o; $packname = $1; $apif = $2; if(!defined($packname)){ print STDERR "Ignoring weird URL target ($target).\n"; next; } $phash{"/usr/share/doc/$packname/$apif"} = 1; } close($htfile); } closedir($dir); } return keys(%phash); } sub slurp_file{ my $file = shift; my @data; open(my $handle, '<', $file); while(my $line = <$handle> ){ chomp($line); $line =~ s/\r$//o; push(@data, $line); } close($handle); return @data; } sub find_package_for_existing_files{ my %pkgs; my %files; foreach my $file (@_){ die("$file must be given with absolute path.") unless( $file =~ m@^/@o ); die("$file does not exist") unless( -e $file ); $file =~ s@/{2,}@/@og; $file =~ s@[/]+$@@og; $files{$file} = 1; } open(my $dpkg, '-|', 'dpkg', '-S', @_); while( my $line = <$dpkg> ){ my ($pkg, $file) = split(/:\s++/ox, $line); chomp($file); $pkgs{$pkg} = 1 if(exists($files{$file})); } close($dpkg); return keys(%pkgs); } sub parse_manifest_fd{ my $fd = shift; my $name = shift; my $manifest = Debian::Javahelper::Manifest->new(); my $sec = $manifest->get_section(Debian::Javahelper::Manifest::MAIN_SECTION, 1); my $atname = ''; my $atval = ''; while( my $line = <$fd> ){ $line =~ s/[\r]?[\n]$//og; if($line =~ m/^ /o){ # extension to a value. die("Unexpected \"extension line\" in $name,") unless($atname); $atval .= substr($line, 1); next; } if($line ne ''){ if($atname){ if(!defined($sec)){ $sec = $manifest->get_section($atval, 1); } else { $sec->set_value($atname, $atval); } } ($atname, $atval) = split(/ :\s /ox, $line, 2); if(!$atval){ die("Expected : pair in $name,") unless($line =~ m/ :\s /ox); $atval = ''; } if(!defined($sec)){ die("A section must start with the Name attribute in $name,") unless(lc($atname) eq 'name'); } next; } if($atname) { if(!defined($sec)){ $sec = $manifest->get_section($atval, 1); } else { $sec->set_value($atname, $atval); } } $atname = ''; $sec = undef; } $sec->set_value($atname, $atval) if($atname); return $manifest; } sub write_manifest_section_fd{ my $sec = shift; my $fd = shift; my $name = shift; # return manifest-version and name first foreach my $entry ($sec->get_values()) { my $line = join(': ', @$entry); # Extend long lines. Technically this is incorrect since the # rules says "bytes" and not "characters". # # (for future reference this is: Insert '\n ' after every 72 # chars, but only if there is a 73rd character following them) # # If you change this, remember to change jh_build as well, # which also have this. $line =~ s/(.{72})(?=.)/$1\n /go; print {$fd} $line, "\n"; } print $fd "\n"; 1; } sub write_manifest_fd{ my $manifest = shift; my $fd = shift; my $name = shift; # returns main section first. foreach my $sec ($manifest->get_sections()){ write_manifest_section_fd($sec, $fd, $name); } # must end with two empty lines. print $fd "\n"; 1; } # For length # s/(.{$len})/$1\n /g; s/^ \n(\w)/$1/g 1; __END__ =head1 SEE ALSO L L =head1 AUTHOR Niels Thykier =head1 COPYRIGHT AND LICENSE Copyright 2010 by Niels Thykier This module is free software; you may redistribute it and/or modify it under the terms of GNU GPL 2. =cut javatools-0.45ubuntu1/lib/Debian/Javahelper/Manifest.pm0000664000000000000000000000704412265203313017777 0ustar package Debian::Javahelper::Manifest; =head1 NAME Debian::Javahelper::Manifest - Javahelper representation of a Jar Manifest =cut use strict; use warnings; use autodie; use Exporter qw(import); use Debian::Javahelper::ManifestSection qw(MAIN_SECTION); # pass it on to others. our @EXPORT_OK = qw(MAIN_SECTION); =head1 SYNOPSIS use Debian::Javahelper::Java; my $manifest = ...; my $main_sec = $manifest->get_section(MAIN_SECTION); # Create if it does not exist. my $file_sec = $manifest->get_section("java/lang/Object.class", 1); =head1 DESCRIPTION This module is used to represent a Java Manifest. =head2 Constants =over 4 =item MAIN_SECTION A constant denoting the main section of the manifest. Exported by default. =back =head2 Methods =over 4 =item Debian::Javahelper::Manifest->new() Creates a new manifest. It will only contain the main section with the Manifest-Version attribute. =item $manifest->get_section($name[, $create]) Returns the section denoted by B<$name>. If this section does not exist, then it will either return B or (if B<$create> is a truth-value) create a new empty section with that name. Use the MAIN_SECTION constant to access the main section of the manifest. =item $manifest->get_sections() Returns a list of all sections in B<$manifest>. The main section will always be the first in the list, but the remaining sections can come in any order (and this order can change in later invocations). Modifying the list will not change which sections are present in B<$manifest>, but modifying a section in this list will also update the section in the manifest. =item $manifest->merge($other) Merge all entries in B<$other> into B<$manifest>. All sections in B<$other> will be added to B<$manifest> if they are not already present. If an attribute in a given section is only present in one of the two manifests, then that attribute and its value will be in B<$manifest> after merge returns. If the attribute in a given section is present in both manifests, then the value from B<$other> will be used. This can be used to make a deep copy a manifest: my $copy = Debian::Javahelper::Manifest->new(); $copy->merge($orig); =back =cut sub new { my $type = shift; my $this = bless({}, $type); # create the main section $this->get_section(MAIN_SECTION, 1); return $this; } sub get_section { my $this = shift; my $sname = shift; my $create = shift//0; my $sec = $this->{$sname}; if(!defined($sec) && $create){ $sec = Debian::Javahelper::ManifestSection->new($sname); $this->{$sname} = $sec; } return $sec; } sub get_sections { my $this = shift; # There is always a main section. my $main = $this->get_section(MAIN_SECTION, 1); my @sections = ($main); while( my ($name, $sec) = each(%$this) ){ next if($name eq MAIN_SECTION); push(@sections, $sec); } return @sections; } sub merge { my $this = shift; my $other = shift; while( my ($osname, $osec) = each(%$other) ){ my $tsec = $this->get_section($osname, 1); foreach my $val ($osec->get_values()){ $tsec->set_value($val->[0], $val->[1]); } } 1; } 1; =head1 SEE ALSO L - had parse/write methods for manifests. L - for how sections are handled. =head1 AUTHOR Niels Thykier =head1 COPYRIGHT AND LICENSE Copyright 2010 by Niels Thykier This module is free software; you may redistribute it and/or modify it under the terms of GNU GPL 2. =cut javatools-0.45ubuntu1/lib/Debian/Javahelper/ManifestSection.pm0000664000000000000000000001020412265203313021314 0ustar package Debian::Javahelper::ManifestSection; =head1 NAME Debian::Javahelper::ManifestSection - Javahelper representation of a section in a Jar Manifest =cut use strict; use warnings; use autodie; use Exporter qw(import); our @EXPORT_OK = qw(MAIN_SECTION); use constant { MAIN_SECTION => 'MAIN' }; =head1 SYNOPSIS use Debian::Javahelper::Manifest; my $main_sec = $manifest->get_section(MAIN_SECTION, 1); # set the Main-Class attribute $main_sec->set_value('Main-Class', 'org.site.app.AppStarter'); # read the classpath entry - may return undef if the attribute does not exist. my $cp = $main_sec->get_value('Class-Path'); # same as above except $cp will be '' if the attribute does not exist. $cp = $main_sec->get_value('Class-Path', 1); # returns a list of [$name, $value] pairs - note $name will be in the original # case. my @att = $main_sec->get_values(); =head1 DESCRIPTION This module is used to represent a Section in a Java Manifest. =head2 Constants =over 4 =item MAIN_SECTION A constant denoting the main section of the manifest. Exported by default. =back =head2 Methods =over 4 =item Debian::Javahelper::ManifestSection->new($name) Creates a new section - if B<$name> is MAIN_SECTION, then it will set "Manifest-Version" otherwise it will set "Name" to B<$name>. Generally you should not need to use this directly! The L will create sections as they are needed. There is no support for creating a section and then adding it to a manifest after wards. =item $section->set_value($attr, $value) Sets the value of B<$attr> to B<$value>. If B<$attr> did not exist in this section then it will be created. B<$value> may not contain newlines. Note: B<$attr> exists if an attribute matches B<$attr> ignoring the case of the two. When B<$attr> is created, the original case will be stored for later (for writing). Later updates to B<$attr> will not affect the original case. =item $section->get_value($attr[, $empty]) Returns the value of B<$attr>, long values are merged into a single line. B<$attr> is looked up case-insensitively. Returns B if B<$attr> is not present in the section, unless B<$empty> is a truth-value. In this case it will return ''. =item $section->get_values() Returns all the values in the section in a list of [$attr, $value] pairs. "Manifest-Version" and "Name" will appear first in this list if they appear in this section, the remaining attributes appears in any order and this order may change. Modifying the list or the pairs will I affect the attributes in the section. Note: The B<$attr> part will be the original case of the attribute. =back =cut sub new{ my $type = shift; my $name = shift; my $this = bless({}, $type); if($name eq MAIN_SECTION){ $this->set_value('Manifest-Version', '1.0'); } else { $this->set_value('Name', $name); } return $this; } sub set_value { my $this = shift; my $name = shift; my $value = shift; die("Value for $name contains new-lines,") if($value =~ m/[\r]|[\n]/o); # Store the name with the original case for later. $this->{lc($name)} = [$name, $value]; 1; } sub get_value { my $this = shift; my $name = shift; my $empty = shift//0; my $val = $this->{lc($name)}; if(defined($val)){ return $val->[1]; } return '' if($empty); return; } sub get_values { my $this = shift; my @values = (); # These go first foreach my $var (qw(manifest-version name)){ my $val = $this->{$var}; push(@values, $val) if(defined($val)); } # any order is okay for the rest. for my $name (sort keys(%{$this})) { # we already got these next if ($name eq 'manifest-version' or $name eq 'name'); my $val = $this->{$name}; push(@values, [$val->[0], $val->[1]]); } return @values; } 1; =head1 SEE ALSO L - for how to obtain a section. =head1 AUTHOR Niels Thykier =head1 COPYRIGHT AND LICENSE Copyright 2010 by Niels Thykier This module is free software; you may redistribute it and/or modify it under the terms of GNU GPL 2. =cut javatools-0.45ubuntu1/jh_classpath0000775000000000000000000000536312265203313014255 0ustar #!/bin/bash -- set -e . /usr/share/javahelper/jh_lib.sh syntax() { echo -e "Usage: jh_classpath [options] [jar(s)]" echo -e "Options:" echo -e "\t-h --help: show this text" echo -e "\t-V --version: show the version" echo -e "\t-i --indep: act on all Arch: all packages" echo -e "\t-a --arch: act on all Arch-specific packages" echo -e "\t-s --same-arch: alias of --arch for compatibility with debhelper" echo -e "\t-p --package=: package to act on (default=all)" echo -e "\t-P --tmpdir=: package directory (default=\$CWD/debian/package)" echo -e "\t-c --classpath=: The classpath to set on the jar(s)" echo -e "\t-v --verbose: show more information while running" echo -e "\t-n --no-act: don't actually do anything, just print the results" exit 1 } ARGS="i indep a arch s same-arch p package P tmpdir v verbose n no-act c classpath" parseargs "$@" dh_testdir VERBOSE="`getarg v verbose`" NOACT="`getarg n noact`" if [ "$ARGC" == "0" ]; then # read debian/$package.classpath for p in `findpackages`; do if [ -f "debian/$p.classpath" ]; then cat "debian/$p.classpath" | while read jar cpath; do if [ ! -f "$jar" ] ; then jar="debian/$p/$jar" fi if [ -n "$VERBOSE" ]; then echo "Setting classpath on $jar to $cpath" fi if [ -n "$NOACT" ]; then echo "Would run jh_manifest -p$p --classpath=$cpath $jar" else jh_manifest "-p$p" "--classpath=$cpath" "$jar" fi done elif [ -f "debian/classpath" ]; then cat "debian/classpath" | while read jar cpath; do if [ ! -f "$jar" ] ; then jar="debian/$p/$jar" fi if [ -n "$VERBOSE" ]; then echo "Setting classpath on $jar to $cpath" fi if [ -n "$NOACT" ]; then echo "Would run jh_manifest -p$p --classpath=$cpath $jar" else jh_manifest "-p$p" "--classpath=$cpath" "$jar" fi done fi done else # process jars with -c or $CLASSPATH for (( i=0 ; i # Modified by: 2009, Alexander Kurtakov # # uscan will run this script like # fetch-eclipse-source --upstream-version # This script requires that these package are installed: cvs, gawk, tofrodos VERSION=$2 DIRECTORY_TXT=$3 if ! which cvs > /dev/null 2>&1; then echo "$0: Cannot find cvs. Please install the cvs package." >&2 exit 1 fi if ! which gawk > /dev/null 2>&1; then echo "$0: Cannot find gawk. Please install the gawk package." >&2 exit 1 fi if ! which fromdos > /dev/null 2>&1; then echo "$0: Cannot find fromdos. Please install the tofrodos package." >&2 exit 1 fi if test ! -f debian/control; then echo "$0: Could not find debian/control." >&2 exit 1 fi NAME=$(grep "Source:" debian/control | sed "s/^Source: //") MAPFILE=$NAME.map TEMPMAPFILE=temp.map echo "Exporting from CVS..." rm -rf ${NAME}-$VERSION mkdir ${NAME}-$VERSION mv $DIRECTORY_TXT ${NAME}-$VERSION/$MAPFILE pushd ${NAME}-$VERSION >/dev/null fromdos $MAPFILE grep ^[a-z] $MAPFILE > $TEMPMAPFILE gawk 'BEGIN { FS="," } { if (NF < 4) { split($1, version, "="); split(version[1], directory, "@"); cvsdir=split($2, dirName, ":"); printf("cvs -d %s%s %s %s %s %s %s\n", ":pserver:anonymous@dev.eclipse.org:", dirName[cvsdir], "-q export -r", version[2], "-d", directory[2], directory[2]) | "/bin/bash"; } else { split($1, version, "="); total=split($4, directory, "/"); cvsdir=split($2, dirName, ":"); printf("cvs -d %s%s %s %s %s %s %s\n", ":pserver:anonymous@dev.eclipse.org:", dirName[cvsdir], "-q export -r", version[2], "-d", directory[total], $4) | "/bin/bash"; } }' $TEMPMAPFILE rm $TEMPMAPFILE $MAPFILE popd >/dev/null echo "Remove prebuilt binaries and jars..." find $NAME-$VERSION \( -name '*.exe' -o -name '*.dll' \) -delete find $NAME-$VERSION \( -name '*.so' -o -name '*.so.2' \) -delete find $NAME-$VERSION -name '*.jar' -delete echo "Remove empty directories..." find $NAME-$VERSION -depth -type d -empty -delete echo "Creating tarball '../${NAME}_$VERSION$DEBV.orig.tar.bz2'..." if test -f debian/fetch-eclipse-source.exclude; then tar -acf ../${NAME}_$VERSION$DEBV.orig.tar.bz2 ${NAME}-$VERSION -X debian/fetch-eclipse-source.exclude else tar -acf ../${NAME}_$VERSION$DEBV.orig.tar.bz2 ${NAME}-$VERSION fi rm -rf ${NAME}-$VERSION javatools-0.45ubuntu1/jh_repack0000775000000000000000000000330312265203313013530 0ustar #!/bin/bash -- set -e . /usr/share/javahelper/jh_lib.sh syntax() { echo -e "Usage: jh_repack --upstream-version " echo -e "Options:" echo -e "\t-h --help: show this text" echo -e "\t-V --version: show the version" echo -e "\t-v --verbose: show more information while running" echo -e "\t-n --no-act: don't actually do anything, just print the results" exit 1 } ARGS="upstream-version v verbose n no-act" parseargs "$@" VERBOSE="`getarg v verbose`" if [ "$ARGC" != "2" ] ; then syntax exit 1 fi VERSION=${ARGV[0]} TARBALL="`readlink -f "${ARGV[1]}"`" TMPDIR=`mktemp -d` cd "$TMPDIR" if [ -n "$VERBOSE" ]; then echo "Repacking tarball $TARBALL" fi if [ -n "`getarg n no-act`" ]; then echo "Would repack $TARBALL" exit 0 fi if grep tar.gz$ <<< $TARBALL &>/dev/null; then TYPE=gzip tar zxf "$TARBALL" elif grep tar.bz2$ <<< $TARBALL &>/dev/null; then TYPE=bzip2 tar jxf "$TARBALL" elif grep zip$ <<< $TARBALL &>/dev/null; then TYPE=zip unzip -qq "$TARBALL" else echo "Do not know how to unpack $TARBALL (expecting tar.gz, tar.bz2 or zip)" fi SUBDIR= if [ "`ls -1 | wc -l`" = "1" ]; then cd * SUBDIR=true fi find . -name '*.class' -a -type f -print0 | xargs -0 rm -f find . -name '*.jar' -a -type f -print0 | xargs -0 rm -f IFS=' ' for doctree in `find . -name allclasses-frame.html`; do TREE="`dirname $doctree`" rm -rf "$TREE"/* done find * -depth -type d -print0 | xargs -0 rmdir --ignore-fail-on-non-empty if [ -n "$SUBDIR" ]; then cd .. fi rm -f "$TARBALL" case "$TYPE" in gzip) tar zcf "$TARBALL" * ;; bzip2) tar jcf "$TARBALL" * ;; zip) tar zcf "${TARBALL%.zip}.tar.gz" * ;; esac cd / rm -rf "$TMPDIR" if [ -n "$VERBOSE" ]; then echo "done" fi javatools-0.45ubuntu1/debian/0000775000000000000000000000000012265205647013113 5ustar javatools-0.45ubuntu1/debian/jarwrapper.postinst0000664000000000000000000000030312265203313017055 0ustar #!/bin/sh -- set -e if test -x /usr/sbin/update-binfmts ; then update-binfmts --install jarwrapper /usr/bin/jarwrapper --magic 'PK\x03\x04' --detector /usr/bin/jardetector fi #DEBHELPER# javatools-0.45ubuntu1/debian/compat0000664000000000000000000000000212265203313014275 0ustar 7 javatools-0.45ubuntu1/debian/jarwrapper.install0000664000000000000000000000011412265203313016640 0ustar jardetector /usr/bin jarwrapper /usr/bin java-arch.sh /usr/share/jarwrapper javatools-0.45ubuntu1/debian/javahelper.install0000664000000000000000000000135212265203313016611 0ustar fetch-eclipse-source /usr/bin jh_depends /usr/bin jh_manifest /usr/bin jh_exec /usr/bin jh_build /usr/bin jh_clean /usr/bin jh_classpath /usr/bin jh_installlibs /usr/bin jh_installjavadoc /usr/bin jh_makepkg /usr/bin jh_repack /usr/bin jh_linkjars /usr/bin jh_installeclipse /usr/bin jh_generateorbitdir /usr/bin jh_setupenvironment /usr/bin jh_compilefeatures /usr/bin jh_lib.sh /usr/share/javahelper # Internal helper command - not ready for /usr/bin jh_scanjavadoc /usr/share/javahelper java-vars.mk /usr/share/javahelper java-arch.sh /usr/share/javahelper javahelper.mk /usr/share/cdbs/1/class javahelper.pm /usr/share/perl5/Debian/Debhelper/Sequence eclipse_helper.pm /usr/share/perl5/Debian/Debhelper/Sequence lib/Debian/ /usr/share/perl5/ javatools-0.45ubuntu1/debian/rules0000775000000000000000000000322112265203313014155 0ustar #!/usr/bin/make -f VERSION=$(shell dpkg-parsechangelog | sed -n 's/^Version: //p') POD2MAN=pod2man --stderr --utf8 -c Javahelper -r "$(VERSION)" MOD_PATH:=lib/Debian/Javahelper ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) jobs = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) PAR_ARGS=-j $(jobs) endif %: dh $@ jh_lib.sh: jh_lib.sh.in sed 's,%JAVATOOLS_VERSION%,${VERSION},' < $< > $@ override_dh_auto_build: jh_lib.sh mkdir tmp tmp.jarwrapper # javahelper pod-based manpages $(POD2MAN) jh_installeclipse tmp/jh_installeclipse.1 $(POD2MAN) jh_generateorbitdir tmp/jh_generateorbitdir.1 $(POD2MAN) jh_setupenvironment tmp/jh_setupenvironment.1 $(POD2MAN) jh_compilefeatures tmp/jh_compilefeatures.1 $(POD2MAN) jh_manifest tmp/jh_manifest.1 $(POD2MAN) fetch-eclipse-source.pod tmp/fetch-eclipse-source.1 $(POD2MAN) -s 1 jh_clean.pod tmp/jh_clean.1 $(POD2MAN) $(MOD_PATH)/Eclipse.pm tmp/Debian::Javahelper::Eclipse.3 $(POD2MAN) $(MOD_PATH)/Java.pm tmp/Debian::Javahelper::Java.3 $(POD2MAN) $(MOD_PATH)/Manifest.pm tmp/Debian::Javahelper::Manifest.3 $(POD2MAN) $(MOD_PATH)/ManifestSection.pm tmp/Debian::Javahelper::ManifestSection.3 # jarwrapper pod-based manpages $(POD2MAN) -s 1 jarwrapper.pod tmp.jarwrapper/jarwrapper.1 $(POD2MAN) -s 1 jardetector.pod tmp.jarwrapper/jardetector.1 if which markdown >/dev/null 2>&1; then \ markdown --html4tags tutorial.txt | \ cat tutorial-header.html - tutorial-footer.html > tutorial.html; \ fi runtests: jh_lib.sh prove -Ilib $(PAR_ARGS) t cd tests && ./tests.sh override_dh_auto_test: runtests override_dh_auto_clean: rm -f jh_lib.sh #tutorial.html rm -fr tmp tmp.jarwrapper javatools-0.45ubuntu1/debian/java-propose-classpath.manpages0000664000000000000000000000003112265203313021174 0ustar java-propose-classpath.1 javatools-0.45ubuntu1/debian/java-propose-classpath.install0000664000000000000000000000004012265203313021047 0ustar java-propose-classpath /usr/bin javatools-0.45ubuntu1/debian/javahelper.docs0000664000000000000000000000003312265203313016066 0ustar tutorial.html tutorial.txt javatools-0.45ubuntu1/debian/source/0000775000000000000000000000000012265205647014413 5ustar javatools-0.45ubuntu1/debian/source/format0000664000000000000000000000001512265203313015606 0ustar 3.0 (native) javatools-0.45ubuntu1/debian/jarwrapper.manpages0000664000000000000000000000002312265203313016764 0ustar tmp.jarwrapper/*.1 javatools-0.45ubuntu1/debian/control0000664000000000000000000000664312265203313014513 0ustar Source: javatools Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian Java Maintainers Uploaders: Matthew Johnson , Niels Thykier Build-Depends: debhelper (>= 7.0.50~) Build-Depends-Indep: default-jdk, libarchive-zip-perl (>= 1.30-6~), perl, libtest-minimumversion-perl, libtest-perl-critic-perl, libtest-strict-perl, perl (>= 5.12) | libtest-simple-perl (>= 0.93) Standards-Version: 3.9.4 Section: java Vcs-Git: git://anonscm.debian.org/pkg-java/javatools.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-java/javatools.git Package: jarwrapper Architecture: all Depends: binfmt-support, fastjar, ${misc:Depends} Description: Run executable Java .jar files Jarwrapper sets up binfmt-misc to run executable jar files using the installed java runtime. . It also includes a /usr/share/jarwrapper/java-arch.sh script to convert Debian architecture names into java names to locate libjvm.so Package: javahelper Architecture: all Depends: ${misc:Depends}, debhelper, devscripts, bsdmainutils, dpkg-dev, dctrl-tools, libarchive-zip-perl (>= 1.30-6~) Suggests: cvs, gawk, tofrodos, Description: Helper scripts for packaging Java programs Javahelper contains several scripts which help in packaging Java programs. . jh_depends searches jars to find which packages they depend on, similar to dh_shlibdeps. It will also add depends on jarwrapper for packages with executable jars. . jh_classpath will register the classpath dependencies for each jar so that they can be automatically loaded when that jar is used by other programs. . jh_manifest updates the manifest in jar files according to a provided spec so that the resultant jar files will work with jarwrapper-enabled packages. . jh_exec looks for symlinks to jars which should be executable and makes them executable . jh_build builds java files to jars for you. . jh_installlibs installs library jars into the correct locations . jh_makepkg generates a template for a Debian Java package for you . jh_installeclipse installs features/plugins built by pde-build. . jh_setupenvironment prepares an out of source built for eclipse builds. . jh_generateorbitdir creates and populates an orbit dir for eclipse builds. . jh_compilefeatures compiles eclipse features based on feature ids. . /usr/share/javahelper/java-vars.mk provides a selection of useful variables such as various JVM paths and the JVM name for the architecture . /usr/share/javahelper/java-arch.sh converts Debian architecture names into java names to locate libjvm.so in non-make build systems . javahelper provides CDBS and dh macros so that it can be used with those package build systems. . Note that some of the eclipse helpers depends on packages not pulled by default (like with devscripts). You can find these scripts in Suggests. Package: java-propose-classpath Architecture: all Depends: gcj-jdk, javahelper (= ${binary:Version}), fastjar, ${misc:Depends} Description: Helper script to suggest a classpath for jar files java-propose-classpath analyzes a set of jar files and the installed jars on the system to suggest a correct classpath for use with jh_classpath/jh_manifest . This package should not be in any build-depends since java-propose-classpath cannot be run automatically. javatools-0.45ubuntu1/debian/jarwrapper.prerm0000664000000000000000000000021612265203313016322 0ustar #!/bin/sh -- set -e if test -x /usr/sbin/update-binfmts ; then update-binfmts --remove jarwrapper /usr/bin/jarwrapper fi #DEBHELPER# javatools-0.45ubuntu1/debian/copyright0000664000000000000000000001754512265203313015046 0ustar This package was created by Matthew Johnson on Sat, 09 May 2007 17:24:36 +0100. Copyright: 2007, Matthew Johnson 2010, Niels Thykier License: This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA With the exception of fetch-eclipse-source, which is based on a Fedora contribution. The details for this file is Copyright: 2009, Mat Booth 2009, Alexander Kurtakov 2010, Benjamin Drung License: The file was downloaded from Fedora's CVS repository; all committers are required to sign a license agreement with Fedora, which puts contributions without a license under the license included below. At the time Debian acquired these files, the "default" Fedora license was: The Fedora Project Individual Contributor License Agreement The Fedora Project Individual Contributor License Agreement (CLA) http://fedoraproject.org/wiki/Legal/Licenses/CLA Thank you for your interest in The Fedora Project (the "Project"). In order to clarify the intellectual property license granted with Contributions from any person or entity, Red Hat, Inc. ("Red Hat"), as maintainer of the Project, must have a Contributor License Agreement (CLA) on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for Your protection as a Contributor as well as the protection of the Project and its users; it does not change your rights to use your own Contributions for any other purpose. You and the Project hereby accept and agree to the following terms and conditions: * 1. Contributors and Contributions. * A. The Project and any individual or legal entity that voluntarily submits to the Project a Contribution are collectively addressed herein as "Contributors". For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. * B. A "Contribution" is any original work, including any modification or addition to an existing work, that has been submitted for inclusion in, or documentation of, any of the products owned or managed by the Project, where such work originates from that particular Contributor or from some entity acting on behalf of that Contributor. * C. A Contribution is "submitted" when any form of electronic, verbal, or written communication is sent to the Project, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of discussing or improving software or documentation of the Project, but excluding communication that is conspicuously marked or otherwise designated in writing by you as "Not a Contribution." * D. Any Contribution submitted by you to the Project shall be under the terms and conditions of this License, without any additional terms or conditions, unless you explicitly state otherwise in the submission. * 2. Contributor Grant of License. You hereby grant to Red Hat, Inc., on behalf of the Project, and to recipients of software distributed by the Project: * (a) a perpetual, non-exclusive, worldwide, fully paid-up, royalty free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute your Contribution and such derivative works; and, * (b) a perpetual, non-exclusive, worldwide, fully paid-up, royalty free, irrevocable (subject to Section 3) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer your Contribution and derivative works thereof, where such license applies only to those patent claims licensable by you that are necessarily infringed by your Contribution alone or by combination of your Contribution with the work to which you submitted the Contribution. Except for the license granted in this section, you reserve all right, title and interest in and to your Contributions. * 3. Reciprocity. As of the date any such litigation is filed, your patent grant shall immediately terminate with respect to any party that institutes patent litigation against you (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the work to which you have contributed, constitutes direct or contributory patent infringement. * 4. You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to the Project, or that your employer has executed a separate Corporate CLA with the Project. * 5. You represent that each of your Contributions is your original creation (see section 7 for submissions on behalf of others). You represent that your Contribution submission(s) include complete details of any third-party license or other restriction (including, but not limited to, related copyright, patents and trademarks) of which you are personally aware and which are associated with any part of your Contribution. * 6. You are not expected to provide support for your Contributions, except to the extent you desire to provide support. You may provide support for free, for a fee, or not at all. Your Contributions are provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. * 7. Should you wish to submit work that is not your original creation, you may submit it to the Project separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here] ". * 8. You agree to notify the Project of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect. * 9. The Project is under no obligations to accept and include every contribution.. fetch-eclipse-source.pod was written by Niels Thykier and may be distributed, used and modified under the same terms as fetch-eclipse-source.pod or GPL version 2. On Debian systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL-2'. javatools-0.45ubuntu1/debian/javahelper.manpages0000664000000000000000000000021512265203313016733 0ustar jh_build.1 jh_depends.1 jh_exec.1 jh_installlibs.1 jh_installjavadoc.1 jh_makepkg.1 jh_classpath.1 jh_repack.1 jh_linkjars.1 tmp/*.1 tmp/*.3 javatools-0.45ubuntu1/debian/changelog0000664000000000000000000006215212265205527014770 0ustar javatools (0.45ubuntu1) trusty; urgency=low [ Logan Rosen ] * Merge from Debian unstable. Remaining changes: - Pre-generate tutorial.html; remove the build dependency on markdown. [ Iain Lane ] * Also merge 0.43ubuntu3 - Fix the java architecture for arm64 and ppc64el. -- Logan Rosen Sun, 01 Dec 2013 22:20:32 -0500 javatools (0.45) unstable; urgency=low * jh_manifest: Fix bug where "EXCLUDE_FIND" was not properly expanded (regression introduced in 0.44). Thanks to Daniel Schepler for reporting it. (Closes: #725440) * d/control: Fix typo of "and". Thanks to Pascal De Vuyst for reporting it. (Closes: #725335) -- Niels Thykier Sun, 06 Oct 2013 08:44:51 +0200 javatools (0.44) unstable; urgency=low * Add a new minor TAP based test suite. * Fix bug in jh_repack when removing empty directories. Thanks to Francesco Poli for reporting it and writing the patch. (Closes: #689788) * Fix the output path for javadoc generated by jh_build. Thanks to Jakub Adam for reporting it and writing the patch. (Closes: #692230) * jh_installeclipse: Allow any installed package to provide a .jar dependency, not just those with desired-state install. Thanks to Colin Watson for the patch (pulled from Ubuntu's javatools/0.43ubuntu2). * ManifestSection.pm: Always write fields in a predictable order. This fixes a FTBFS when the tests had a different order. Thanks to Damyan Ivanov for reporting this bug. (Closes: #723884) * jh_depends: Strip leading "file://" before looking for a jar file. Thanks to Rene Engelhard for the bug report. (Closes: #632821) * jh_installjavadoc: Apply patch from Markus Koschany to insert a default value for the "Author"-field when no author is provided. Also fix a typo in the generated doc-base file. (Closes: #625945) * jh_makepkg: Advise people to use mk_make for packges with a maven based build system. Thanks to Hilko Bengen for the suggestion. (Closes: #703376) * d/control: Use the canonical URL in the Vcs-* fields. * d/control: Bump Standards-Version to 3.9.4 - no changes required. -- Niels Thykier Tue, 24 Sep 2013 14:05:18 +0200 javatools (0.43ubuntu3) trusty; urgency=medium * Fix the java architecture for arm64 and ppc64el. -- Matthias Klose Sat, 21 Dec 2013 18:33:35 +0100 javatools (0.43ubuntu2) quantal; urgency=low * jh_installeclipse: Allow any installed package to provide a .jar dependency, not just those with desired-state install. -- Colin Watson Tue, 02 Oct 2012 21:07:09 +0100 javatools (0.43ubuntu1) quantal; urgency=low * Merge from Debian unstable. Remaining changes: - Pre-generate tutorial.html; remove the build dependency on markdown. -- James Page Fri, 22 Jun 2012 09:07:29 +0100 javatools (0.43) unstable; urgency=low * Make jh_build pass -source 1.5 by default to javadoc if no -source parameter is explicitly given. * Make jh_build pass -target 1.5 by default to javac if neither -source nor -target is explicitly given. -- Niels Thykier Wed, 20 Jun 2012 18:59:08 +0200 javatools (0.42) unstable; urgency=low * Add support for Java7 in jh_depends. The jvm "open" now defaults to any OpenJDK version. The "open6" and "open7" values can be used to depend on a specific one. -- Niels Thykier Tue, 19 Jun 2012 11:48:47 +0200 javatools (0.41ubuntu1) quantal; urgency=low * Merge from Debian testing. Remaining changes: - Pre-generate tutorial.html; remove the build dependency on markdown. -- James Page Mon, 28 May 2012 17:12:23 +0100 javatools (0.41) unstable; urgency=low [ Sylvestre Ledru ] * jh_makepkg: - Switch the OpenJDK6 path to the multiarch one. - Remove the sun-java6 support since it has been removed from the archive - Provide the support for OpenJDK 7 - Create the new package under the source format 3.0 - -doc packages are now in the doc section. [ Niels Thykier ] * Produce a better error message when a non-existent Jar file is passed to jh_manifest. * Try to parse arguments passed via -O for jh_lib.sh as regular options, but ignore them if they are unknown. Previously, -O options was silently ignored. * Remove support for using the "sun" (and "sun6") JVM with jh_depends, as Debian is no longer ships the Sun/Oracle Java. * Bump libarchive-zip-perl depends as 1.30.5 was still affected by #654899. * jh_depends no longer emits dependencies with java-runtime or java2-runtime. The minimum generated dependency is now java5-runtime. * Corrected class version calculation on big-endian architectures. Thanks to Kai Ruschenburg for the report and the correction. (Closes: #661632) * Use Standards-Versions 3.9.3 and the new DEP-5 URI in jh_makepkg for newly generated packages. * Bumped Standards-Versions 3.9.3 - no changes required. * Ensure the test suite fails if the java-arch.sh test fails. -- Niels Thykier Tue, 13 Mar 2012 20:12:40 +0100 javatools (0.40ubuntu2) quantal; urgency=low * No-change rebuild with openjdk-7 as default-jdk. -- James Page Fri, 18 May 2012 11:40:12 +0100 javatools (0.40ubuntu1) precise; urgency=low * Merge from Debian testing. Remaining changes: - Pre-generate tutorial.html; remove the build dependency on markdown. -- Micah Gersten Sun, 12 Feb 2012 01:54:43 -0600 javatools (0.40) unstable; urgency=low * Fixed a regression jh_build (introduced in 0.38). (Closes: #656872) * Fixed the java architecture for s390x. -- Niels Thykier Mon, 23 Jan 2012 11:32:54 +0100 javatools (0.39) unstable; urgency=low * Corrected java-arch.sh output for armhf, sh4 and powerpcspe. -- Niels Thykier Tue, 17 Jan 2012 13:31:58 +0100 javatools (0.38) unstable; urgency=low * Added missing empty line the in d/control generated by jh_makepkg * Bumped debhelper compat to 8 in packages generated by jh_makepkg * Fixed the "find" expressions in jh_repack to only remove files named "*.jar" or "*.class". Thanks to Andrew Ross for the report. (Closes: #646514) * Fixed a bug where jh_build would generate manifests with lines longer than some jar implementations would allow. Thanks to Giovanni Mascellani for the report. (Closes: #653412) * Fixed a bug where java-propose-classpath would "hide" javax imports. Thanks to Jan Janak for the report and the correction. (Closes: #653731) * Bumped dependency on libarchive-zip-perl due to some issues with the previous version that caused corrupt jar files. For more information, please refer to #654899. Thanks to Wookey for the analysis and for identifying the source of the issue. (Closes: #634089) -- Niels Thykier Mon, 16 Jan 2012 21:29:39 +0100 javatools (0.37ubuntu1) oneiric; urgency=low * Merge from debian unstable. (LP: #807047) Remaining changes: - Pre-generate tutorial.html; remove the build dependency on markdown. -- Angel Abad Fri, 08 Jul 2011 21:48:59 +0200 javatools (0.37) unstable; urgency=low [ Niels Thykier ] * Do not assume that $pkg/usr/share/doc is present when jh_depends runs. (Closes: #632620) * Applied changes from NMU. - depend on gcj-jdk rather than gcj for java-propose-classpath. * Added support for -s/--same-arch in jh_lib and related shell scripts. (Closes: #632619) [ Matthew Johnson ] * Default to -source 1.5 in jh_build unless specified in the extra args (Closes: #591874) -- Niels Thykier Wed, 06 Jul 2011 14:53:12 +0200 javatools (0.36.1ubuntu1) oneiric; urgency=low * Merge from debian unstable. (LP: #802524) Remaining changes: - Pre-generate tutorial.html; remove the build dependency on markdown. -- Angel Abad Mon, 27 Jun 2011 14:52:20 +0200 javatools (0.36ubuntu1) oneiric; urgency=low * Merge with Debian; remaining changes: - Pre-generate tutorial.html; remove the build dependency on markdown. -- Matthias Klose Tue, 07 Jun 2011 17:53:44 +0200 javatools (0.36) unstable; urgency=low * Made jh_manifest always follow symlinks - the fix for this in 0.35 was incomplete. (Closes: #626329) -- Niels Thykier Sat, 04 Jun 2011 13:30:53 +0200 javatools (0.35ubuntu1) oneiric; urgency=low * Pre-generate tutorial.html; remove the build dependency on markdown. -- Matthias Klose Tue, 24 May 2011 12:47:37 +0200 javatools (0.35) unstable; urgency=low * Made jh_manifest always follow symlinks even if they are passed via command line. (Closes: #626329) * Made jh_manifest fail if there are jar files it cannot find, unless the jar has been excluded. This may cause packages to FTBFS instead of silently not shipping a jar file. (Closes: #626327) * Improved support for --no-act in jh_manifest. * Made jh_depends ignore links to jars as these most likely points to real jar files that it will end up processing any way. (Closes: #610817) -- Niels Thykier Sat, 14 May 2011 17:27:59 +0200 javatools (0.34) unstable; urgency=low * Fixed a regression in 0.33 that in some cases would make jh_installlibs install in to the system root and not the package root. (Closes: #624503) * Removed the -O option from jh_build since it clashed with a common debhelper option. The longer form (--javadoc-opts) is still available and should be used instead. * Made all "jh_lib.sh"-based tools ignore the -O option, which is used by dh in some cases. If you have been using -O with jh_build please switch to --javadoc-opts instead. (Closes: #623506, #624388) -- Niels Thykier Fri, 29 Apr 2011 19:14:56 +0200 javatools (0.33) unstable; urgency=low [ Matthew Johnson ] * Fixed some bugs in jh_makepkg (Closes: #593351) * Support epochs in jh_installibs version mangling (Closes: #617897) [ Niels Thykier ] * Bumped Standards-Version 3.9.2 - no changes required. - Also bumped S-V in jh_makepkg. * Removed DMUA flag; no longer needed. * Removed -5/--sun5 option from jh_makepkg. * Used gcj-jdk instead of java-gcj-compat-dev in jh_makepkg. * Put the JDK dependency in Build-Depends of the control files generated by jh_makepkg, since it is needed by the clean rule. * Made cdbs run jh_installlibs before jh_manifest and jh_classpath. (Closes: #621857) * Converted tutorial into markdown format. * jh_installlibs now properly picks up the version of native packages. (Closes: #612404) * Made jh_installlibs respect its --tmpdir option. Previously it was silently ignored. * Added missing B-D-I on perl (for pod2man). * Migrated jh_generateorbitdir to the perl Manifest handler. * Fixed typo in jh_generateorbitdir and in jh_compilefeatures. * Fixed jh_classpath, which was horribly broken after the 0.32 upload. - It now adds debian/ automatically if it appears to be needed. * Made jh_manifest check the package dir if given a jar file, if said jar file does not exist. * Updated file suggestions for jh_classpath and added a note about the sequence change in the tutorial. * Updated jh_makepkg: - It now creates a separate doc package for the javadoc if making a library package. - It now adds ${java:Recommends} to all binary packages added. * Replaced old copyright template with a DEP-5 version. Thanks to Martin Quinson for the suggestion and the template. (Closes: #623035) -- Niels Thykier Sun, 17 Apr 2011 11:39:48 +0200 javatools (0.32) unstable; urgency=low [ Niels Thykier ] * Fixed quoting issue in jh_compilefeatures. * Renamed a function in the Eclipse module. * fetch-eclipse-source script to create tarballs from some eclipse upstreams. Its requirements have been added to javahelper's suggests. * Replaced jh_libs with jh_installlibs in the description of javahelper. * Bumped Standards-Versions to 3.9.0 - no changes required. * jh_depends now treats "headless" for the --jvm option differently. if "headless" is present then all JREs will be specified using their headless version. If headless is the only value, it will be read as "headless default". * jh_depends no longer recognises "sun5" as a valid JVM, since this has been removed from the archive. "sun" is now an alias of "sun6". * The --jvm "gcj" value for jh_depends now uses gcj-jre and not java-gcj-compat, since the latter is now a virtual package. * Made jh_depends produce (>= ${source:Version}) instead of (= ${binary:Version}). The latter would break with binNMUs. * jh_depends now generates a dependency list for javadocs based on which system javadocs they have been linked against. These packages are added to the new ${java:Recommends} variable. * jh_installeclipse now always emits ${orbit:Depends} even if it would be empty. * Fixed a formatting issue in the eclipse helpers. * Rewrote jh_manifest using debhelper as backend. - it now produces deterministic output (Closes: #574029) - removed all depends on python. - comments are now allowed in d/manifest files. - it will now produce a warning if a jar file listed in a d/manifest- file cannot be found (unless the jar was excluded). * Reordered the javahelper sequence so that jh_installlibs is now run before jh_classpath and jh_manifest. [ Matthew Johnson ] * If jars aren't specified by absolute path try finding them under /usr/share/java (Closes: #586783) * jh_build will now -link any javadoc in a package that you build-depend on * fix jh_build documentation -- Matthew Johnson Sun, 04 Jul 2010 10:04:17 +0000 javatools (0.31) unstable; urgency=low [ Matthew Johnson ] * Put javadoc in doc-base section Programming/Java (Closes: #579391) * Use debian instead of debian_bundle: the latter is deprecated [ Niels Thykier ] * Fixed missing clean of the orbitdeps cache. * Made jh_generateorbitdir handle absolute paths correctly. * Updated jh_{generateorbitdir,installeclipse} manpages. * Use "readlink -f" rather than "realpath". (Closes: #580840). Thanks to Colin Watson. * Added missing set -e to jarwrapper's prerm and postinst. * Corrected versioned depends on debhelper. * Corrected reference to javahelper's tutorials in the eclipse helpers. * Added manpage for jh_clean, jarwrapper and jardetector. * Removed the deprecated jh_libs command. - It has been deprecated since 0.6 (Feb 2008) * Updated the synopsis of the java-propose-classpath package to better describe what it provides. -- Niels Thykier Sun, 30 May 2010 21:18:34 +0200 javatools (0.30) unstable; urgency=low [ Niels Thykier ] * Added myself to uploaders. * Created debhelper-like scripts for building eclipse features and added a dh7 sequence. * Added Vcs-* fields. * Replaced references to "dh_clean -k" with "dh_prep" in the tutorial. (Closes: #571097) * Added DM-Upload-Allowed. * Bumped Standards-Version to 3.8.4 - no changes required. [ Matthew Johnson ] * Make it a 3.0 (native) package -- Matthew Johnson Tue, 30 Mar 2010 00:11:37 +0100 javatools (0.29) unstable; urgency=low * keep --version and jh_makepkg depends up to date with latest javahelper version number * Use default-jdk-doc instead of classpath-doc for javadoc * Fix jh_build --help * Fix passing of javadoc-opts to jh_build (Closes: #567880) * Change maintainers to pkg-java * Add -t/--transitive flag to jh_linkjars (and fix obvious bug in it) (Closes: #565728) * Add sparc64 architecture translator (Closes: #570501) -- Matthew Johnson Sat, 20 Feb 2010 13:08:24 +0000 javatools (0.28) unstable; urgency=low * Reorder things in javahelper.pm and .mk to make jh_classpath and manifest work with jh_installlibs * add various version mangling options to jh_installlibs -- Matthew Johnson Wed, 20 Jan 2010 23:31:37 +0000 javatools (0.27) unstable; urgency=low * jh_installjavadoc now allows you to install to a configurable path (e.g. the one in the library package which you are meant to install to, rather than the one in the doc package) * jh_installibs will detect jars with -$VERSION in their name already and handle them correctly (it must match the upstream version in the changelog) * Build javadoc by default in jh_build and don't pass -J in the .pm (fails when you also pass other args via dh). Also, don't complain at spurious args if we've detected running with dh. * Add jh_linkjars command to create/remove symlink farms from build-deps * Update tutorials * Make cdbs class call jh_clean * Ensure that cdbs class is included before ant.mk so that jh_linkjars works -- Matthew Johnson Sun, 17 Jan 2010 13:28:06 +0000 javatools (0.26) unstable; urgency=low * Oops fix cleaning of jars in cdbs class * -s should actually be -a, oops (Closes: #560869) -- Matthew Johnson Sun, 13 Dec 2009 01:44:29 +0000 javatools (0.25) unstable; urgency=low * Actually, can't use empty files in debian/ as flags for jh_installjavadoc * Add jh_repack for use with uscan (Closes: #560060) * Update tutorials * Reference tutorials from man pages -- Matthew Johnson Sat, 12 Dec 2009 17:06:41 +0000 javatools (0.24) unstable; urgency=low * Add jh_installjavadoc and have jh_build create the javadoc * jh_makepkg depend on default-jdk not default-jdk-builddep * jh_makepkg doesn't use dh_javadoc -- Matthew Johnson Tue, 08 Dec 2009 23:27:16 +0000 javatools (0.23) unstable; urgency=low * Fix detecting dependencies between binary packages from the same source (Closes: #543109) * Add a java-vars.mk with useful variables for building Java programs and also a java-arch.sh to both jarwrapper and javahelper for anything which does not use make (runtime and build-time variants) (Closes: #558109) * Add a -X option to jh_depends to ignore certain packages for depends (Closes: #559303) -- Matthew Johnson Sat, 05 Dec 2009 13:44:20 +0000 javatools (0.22) unstable; urgency=low * Fix typo in description * Add misc:Depends to java-propose-classpath -- Matthew Johnson Thu, 13 Aug 2009 00:03:11 +0100 javatools (0.21) unstable; urgency=low * Fix bug in jh_manifest when manifest file doesn't exist * Treat DH_VERBOSE as a -v flag to all programs * Split java-propose-classpath off to a separate package to avoid a hard dependency on gcj * Add jh_classpath which isn't tied specifically to manifest files * Fix jh_build not to require a JAVA_HOME if it's not actually trying to build * Update jh_makepkg to produce dh 7 packages * Fix bug in jh_depends which results in a jarwrapper dependency but no jvm -- Matthew Johnson Sat, 08 Aug 2009 13:46:17 +0100 javatools (0.20) unstable; urgency=low * Add dh 7 module from أحمد المحمودي (Closes: #536895) * Fix handling of jars which are symlinks not shipped in a deb (eg alternatives) (Closes: #537057) * Change java-propose-classpath to use jar xf not unzip and remove dependency on zip (Closes: #537059) * Fix handling of multiple Debian-java-home entries (patch from أحمد المحمودي) (Closes: #537074) * Fix jh_manifest reading of manifest lines with embedded line breaks and CRLF (patch from أحمد المحمودي) (Closes: #537241, #537262) * Add jh_clean for use from dh helper * Add option to use jh_build from debian/javabuild for use from dh helper * Fix jh_installlibs when the jar is not at the top level * Change this package to using dh 7 -- Matthew Johnson Sat, 18 Jul 2009 01:16:42 +0100 javatools (0.19) unstable; urgency=low * Remove depends on icepick, use ugly hexdump hack instead, since I don't want to depend on openjdk (Closes: #532122) * Also, fix depends checking of packages with a Main-Class but no Debian-Java-Home * Change to sections java/devel * Fix bashism in jarwrapper (Closes: #530110) * Have propose-classpath check that symlinks point to real files before reading them (Closes: #510590) -- Matthew Johnson Sun, 07 Jun 2009 09:52:24 +0100 javatools (0.18) unstable; urgency=low * Add cdbs class for javahelper * Merge experimental class version checking * Remove depends from jarwrapper on a JRE, everything using jarwrapper will need a JRE anyway. * Move to section java * Bump standards version -- Matthew Johnson Sun, 22 Mar 2009 15:27:41 +0000 javatools (0.17.experimental2) experimental; urgency=low * Fix the alternate depends to be correct -- Matthew Johnson Mon, 10 Nov 2008 21:16:23 +0000 javatools (0.17.experimental1) experimental; urgency=low * Add checking for class version in determining alternate depends -- Matthew Johnson Sun, 09 Nov 2008 22:59:14 +0000 javatools (0.17) unstable; urgency=medium * Remove build-arch-stamp and build-indep-stamp in all modes (Closes: #505066) * More manifest entry handling fixes, including in jh_depends and some tests (Closes: #503890) -- Matthew Johnson Sun, 09 Nov 2008 22:05:34 +0000 javatools (0.16) unstable; urgency=medium * Don't append a space to manifest entries (Closes: #501516) -- Matthew Johnson Fri, 10 Oct 2008 21:00:09 +0000 javatools (0.15) unstable; urgency=medium * Add dependency on devscripts (Closes: #499538) -- Matthew Johnson Fri, 19 Sep 2008 22:24:49 +0000 javatools (0.14) unstable; urgency=low * Change openjdk dependency to be openjdk-6-jre, package name was wrong! -- Matthew Johnson Mon, 21 Jul 2008 11:31:29 +0100 javatools (0.13) unstable; urgency=low * Rewrite jh_manifest in python to better obey jar manifest specs (Closes: #489214) * Completely recreate jar to work around fastjar bugs (Closes: #489432) -- Matthew Johnson Sun, 13 Jul 2008 00:29:51 +0100 javatools (0.12) unstable; urgency=low * Use openjdk instead of icedtea * jh_build needs to expand directory arguments to files because Sun Java does not support it. Also add better error handling for missing parameters. -- Matthew Johnson Mon, 30 Jun 2008 11:24:07 +0100 javatools (0.11) unstable; urgency=low * Fix missing "" to enable embedded spaces in jh_lib-parsed options -- Matthew Johnson Tue, 13 May 2008 01:43:40 +0100 javatools (0.10) unstable; urgency=low * Update to default-jdk/jre packages and default-java path -- Matthew Johnson Sat, 26 Apr 2008 12:54:10 +0100 javatools (0.9) unstable; urgency=low * Add --clean to jh_makepkg, removes common errors in Java source packages, such as: - built class files - built jar files - jar files from other packages - built javadoc trees -- Matthew Johnson Fri, 28 Mar 2008 14:47:47 +0000 javatools (0.8) unstable; urgency=low * Fix bug in jh_manifest when passing multiple jars on the commandline * Fix bug in jh_depends creating multiple identical dependencies * depend on realpath -- Matthew Johnson Wed, 26 Mar 2008 01:17:36 +0000 javatools (0.7) unstable; urgency=low * Calls dh_testdir in places, therefore, must depend on debhelper! * Bump Standards-Version -- Matthew Johnson Wed, 06 Feb 2008 16:16:12 +0000 javatools (0.6) unstable; urgency=low * Add tutorials as docs * jh_makepkg use build-indep (patch from "Bernhard R. Link" ) * change jh_libs to jh_installibs, jh_libs is a script which prints a warning and then calls jh_installibs * Add maven2 to build systems in jh_makepkg (needs testing) * Allow multiple entries in Debian-Java-Home * Use unversioned jcf-dump * java-propose-classpath can take class names as parameters -- Matthew Johnson Fri, 01 Feb 2008 12:25:17 +0000 javatools (0.5) unstable; urgency=low * Rename source package, add build-helper binary package * Add help2man manpages -- Matthew Johnson Sun, 13 Jan 2008 17:43:00 +0000 jarwrapper (0.4) unstable; urgency=low * Depend on java1-runtime | java2-runtime rather than java-runtime. (Closes: #460235) -- Matthew Johnson Sat, 12 Jan 2008 12:04:26 +0000 jarwrapper (0.3) unstable; urgency=low * Depend on fastjar for detector (Closes: #442911) * Change maintainer address -- Matthew Johnson Wed, 05 Dec 2007 10:23:36 +0000 jarwrapper (0.2) unstable; urgency=low * Remove bashisms -- Matthew Johnson Mon, 20 Aug 2007 23:35:47 +0100 jarwrapper (0.1) unstable; urgency=low * Initial release (Closes: #423081) -- Matthew Johnson Wed, 09 May 2007 17:50:24 +0100 javatools-0.45ubuntu1/jh_generateorbitdir0000775000000000000000000001405412265203313015621 0ustar #!/usr/bin/perl =head1 NAME jh_generateorbitdir - Creates and populates an orbit dir used by pde-build for third-party jar files. =cut use strict; use warnings; use autodie; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); use Debian::Debhelper::Dh_Lib; use Debian::Javahelper::Eclipse qw(:constants); use Debian::Javahelper::Java qw(parse_manifest_fd); use Debian::Javahelper::Manifest qw(MAIN_SECTION); =head1 SYNOPSIS B [S>] [B<--orbit-dir=>I] [S>] =head1 DESCRIPTION jh_generateorbitdir is a javahelper program that handles creation of an orbit dependency dir. This directory has to be populated with non-eclipse jar files. However, eclipse refers to these jars by their "symbolic name". jh_generateorbitdir can extract this name from the jar's manifest (provided it has the OSGi metadata) and create a symlink to it. jh_generateorbitdir will replace regular files with symlinks if they are present in the orbit dir and clash with the name of one of the orbit jars. If an orbit jar name clashes with a symlink in the orbit dir, then jh_generateorbitdir will assume that the given jar has already been symlinked correctly. In this case the jar file is still recorded in the cache (see below). jh_generateorbitdir will also check the default installation for jar files on Debian systems (at the time of writing /usr/share/java), if it cannot find the jar in the current dir. Jar files replaced by jh_generateorbitdir will be recorded so that jh_installeclipse can replace with symlinks them post install. =head1 FILES =over 4 =item debian/eclipse.orbitdeps List of orbit dependencies - one per line. This can be used as an alternative to passing it per command line. =back =head1 OPTIONS =over 4 =item B<--orbit-dir=>I Specifies the directory from where the orbit-dir is or should be created. Defauls to "debian/.eclipse_build/orbitdeps". =back =cut my $orbitdir = undef; my $cachefile = 'debian/orbitdeps.debhelper'; my $infile = 'debian/eclipse.orbitdeps'; my @orbitdeps; my @include = (q{.}, '/usr/share/java'); my $tmpdir = undef; my $orbit_fd; init(options => { 'orbit-dir=s' => \$orbitdir, }); $orbitdir = 'debian/.eclipse-build/orbitdeps' unless(defined($orbitdir)); @orbitdeps = @ARGV; if( -e $infile){ push(@orbitdeps, filearray($infile)); } # If there is nothing to do then do not bother continuing. exit(0) unless(scalar(@orbitdeps) > 0); # make sure we always clean up our tmpdir in case of common signals. $SIG{'INT'} = \&sighandler; $SIG{'TERM'} = \&sighandler; if( ! $dh{NO_ACT}){ open($orbit_fd, '>>', $cachefile); } doit('mkdir', '-p', $orbitdir); foreach my $jar (find_jars(@orbitdeps)){ my $manifest = read_manifest($jar); my $msect = $manifest->get_section(MAIN_SECTION); my $symName = $msect->get_value(${\EOB_SYM_NAME}, 1); my $version = $msect->get_value(${\EOB_BUNDLE_VERSION}, 1); error("$jar did not have any OSGi metadata") unless(defined($symName) && defined($version)); if( -l "$orbitdir/${symName}_${version}.jar"){ my $ltarget = readlink("$orbitdir/${symName}_${version}.jar"); if(defined($ltarget)){ #Use target print {$orbit_fd} "$ltarget, $symName, $version\n" unless($dh{NO_ACT}); } else { warning('Cannot determine target of ' . "$orbitdir/${symName}_${version}.jar; jh_installeclipse " . 'will not be able to replace this post-install.' ); } # skip if already linked next; } error("No touching $orbitdir/${symName}_${version}.jar - it is a dir") if( -d "$orbitdir/${symName}_${version}.jar"); doit('rm', '-f', "$orbitdir/${symName}_${version}.jar") if( -e "$orbitdir/${symName}_${version}.jar"); print ${orbit_fd} "$jar, $symName, $version\n" unless($dh{NO_ACT}); doit('ln', '-s', $jar, "$orbitdir/${symName}_${version}.jar"); } if( ! $dh{NO_ACT}){ close($orbit_fd); } exit 0; sub read_manifest { my $jar = shift; my $zip = Archive::Zip->new(); my ($con, $stat); my $fd; my $manifest; $zip->read( "$jar" ) == AZ_OK or error("Could not read $jar: $!"); ($con, $stat) = $zip->contents( 'META-INF/MANIFEST.MF' ); error("Could not read manifest from $jar ($stat): $!") unless(!defined($stat) || $stat == AZ_OK); error("$jar has no manifest") unless(defined($stat)); open($fd, '<', \$con); $manifest = parse_manifest_fd($fd, $jar); close($fd); return $manifest; } sub sighandler { my $sig = shift; doit('rm', '-fr', $tmpdir) if(defined($tmpdir)); error("Caught signal $sig"); } sub find_jars{ my @inc = (q{.}, '/usr/share/java'); my @res = (); foreach my $globpattern (@_){ my @i = @inc; my $found = 0; # Only use inc-path if there is no path. @i = (q{}) if($globpattern =~ m@/@o); glob_loop: foreach my $p (@inc){ foreach my $s (q{}, '.jar') { my @matches; if($p eq ''){ @matches = glob("$globpattern$s"); } else { @matches = glob("$p/$globpattern$s"); } # skip if nothing matched or it was not a glob and the file does not exist. next if (scalar(@matches) == 0 || ! -e $matches[0]); push(@res, @matches); $found = 1; last glob_loop; } } error("Could not find any matches for $globpattern") unless($found); } return @res; } =head1 EXAMPLE jh_generateorbitdir --orbit-dir orbit asm3 oro Will generate a folder called orbit with two symlinks based on asm3 and oro's symbolic name. =head1 SEE ALSO L This program is a part of javahelper and uses debhelper as backend. There are also tutorials in /usr/share/doc/javahelper. =head1 AUTHOR Niels Thykier =head1 COPYRIGHT AND LICENSE Copyright 2010 by Niels Thykier This tool is free software; you may redistribute it and/or modify it under the terms of GNU GPL 2. =cut javatools-0.45ubuntu1/tutorial.html0000664000000000000000000005522512265203313014417 0ustar Javahelper Tutorial

Packaging Java with Javatools

Javatools replaces the existing jarwrapper package and also contains programs to help packagers in creating packages for Java programs and libraries.

Packaging tools

The javahelper package consists of several small programs which make packaging Java programs and libraries easier. They are generally designed to work in the same fashion as the debhelper programs, but start with the jh_ prefix.

All of the programs have their command line arguments documented in manpages.

jh_build

Many Java programs and libraries are distributed without sane build systems. jh_build provides a simple interface for building Java source code into Jars, including setting the appropriate entries in the manifest.

In almost all cases all that needs to be done to call jh_build is to set JAVA_HOME and CLASSPATH and then call jh_build with the name of the jar and the directory containing the source.

JAVA_HOME=/usr/lib/jvm/default-java
CLASSPATH=/usr/share/java/esd.jar:/usr/share/java/jsch.jar
jh_build weirdx.jar src

This command will compile all the Java files under src, set the classpath in the manifest and build it all into weirdx.jar.

A couple of other options are worth mentioning. If this jar contains an application rather than a library then the -m or --main option can be used to set the Main-Class attribute in the manifest which will allow the resulting jar file to be be executed

Alternatively, you may provide a debian/javabuild file containing one jar per line, each jar name followed by a list of source files or directories. In this case you can call jh_build with no jar or source and it will build those jars. The jars will then be removed by jh_build --clean.

jh_build also provides a --clean parameter which should be called in the clean target of debian/rules. It is called for you by jh_clean

jh_build will also create javadoc, but only for the last jar built in each package. It can be installed automatically using jh_installjavadoc (see below).

jh_installlibs

For library packages Debian Java policy currently requires that the libraries be installed to /usr/share/java in a versioned format and with an unversioned symlink. jh_installlibs will take a jar and correctly install it.

As with debhelper programs, this can either take a jar as a parameter, or read a list of jars from a file in the Debian directory. It also follows the -p, -i and -a semantics of debhelper for selecting which packages to install the jar to. When operating on a package, jh_installlibs will read the list of library jars from debian/package.jlibs or debian/jlibs.

The jlibs file is a list of jars to install, one per line, and works exactly the same as listing them on the command line. Each jar is installed to debian/$package/usr/share/java/ in the appropriate versioned and unversioned forms.

If the jars built by upstream already contain the version number, this will be stripped before installing. jh_installlibs will also try to strip the upstream version number of any dfsg suffix. Other version-mangling options or explicit version numbers can also be provided.

jh_depends

jh_depends works like dpkg-shlibdeps, but for jar files. For each jar in the package it takes the jars on which it depends and finds the packages to which they belong. These are included in the debhelper substvars as ${java:Depends}. The control file can then just list that variable which is filled in automatically.

This is done by reading the Class-Path attribute from the manifest of each jar. Jar files should include this attribute to prevent applications which use them from needing a full recursive classpath in their startup scripts and to prevent unneccessary transitions when the library changes its dependencies. If the package is not built with jh_build and the upstream build system does not set it correctly then jh_manifest or jh_classpath can be used to fix this.

If the application uses executable jars (see Runtime support below) then jh_depends will also add the appropriate depends on jarwrapper and the correct Java runtime.

As of version 0.32, jh_depends also checks installed javadocs for links to system installed javadocs. It will use this to populate the ${java:Recommends} variable, which can be used for the doc package.

Note that both substvars are always created even if they are empty, like debhelper does with ${misc:Depends}.

jh_manifest

Many upstream build systems do not set the Class-Path attribute in the jars they create. This leads to several unwanted problems, such as expanding the classpath which applications have to use and introducing unneccessary transitions. They also may not set the Main-Class attribute. Both of these are required for running jars with the -jar parameter.

jh_manifest can fix the manifest files of jars. It can either read from a manifest file in the Debian directory or run in a mode which updates all the jars with the CLASSPATH environment variable.

The manifest files can either be debian/package.manifest or debian/manifest. The format of this file is a list of jars and indented below each one a list of manifest elements to set:

usr/share/weirdx/weirdx.jar:
 Main-Class: com.jcraft.weirdx.WeirdX
 Debian-Java-Home: /usr/lib/jvm/default-java

Note: Prior to javahelper 0.32 (0.33 if you used cdbs), jh_manifest would be run before jh_installlibs. In these versions the jars were usually referred to by their location in the build directories rather than their install location.

jh_classpath

If you are just setting the classpath then this command is simpler than jh_manifest. jh_classpath can either take jars on the command line with the classpath specified on the command line or in the CLASSPATH environment variable.

Alternatively, it can read classpaths from a debian/classpath or debian/package.classpath file. This should be one jar per line specifying the jar followed by it's space-separated classpath:

usr/share/java/bar.jar /usr/share/java/quux.jar
usr/share/java/foo.jar /usr/share/java/bar.jar /usr/share/java/baz.jar

Note: Prior to javahelper 0.32 (0.33 if you used cdbs), jh_classpath would be run before jh_installlibs. In these versions the jars were usually referred to by their location in the build directories rather than their install location.

jh_exec

The Runtime support section below describes running executable jars directly. jh_exec will scan package directories for jars in the paths, or symlinks to jar from the paths, and ensure that they have been set executable if necessary.

jh_installjavadoc

If you have javadoc which has been built by your build system, then jh_installjavadoc will install it in the correct location and register it with doc-base for you. Either run jh_installjavadoc with the directory containing the javadoc as a parameter, or it will read debian/javadoc or debian/$package.javadoc which should contain a single path to the javadoc for that package.

If you have used jh_build that will automatically have created javadoc. To install that put the string "internal" in the javadoc file and it will be installed.

The second parameter, or the second string on the line in the javadoc file, can be used to override the install location, for example, so that a -doc package can install to /usr/share/doc/$library/api.

jh_linkjars

If upstream ship convenience copies of third-party jar files which have been removed (see jh_repack below), but the build system refers to that directory, jh_linkjars can be used to populate the directory with symlinks to the packaged jars in /usr/share/java.

It is called either with a directory on the command line or by specifying one target directory per line in the file debian/linkjars.

jh_linkjars will scan all of the (installed) build-dependencies and create a symlink to every jar which is installed by those packages in the target directory.

jh_linkjars can be called with -u to remove all the symlinks in the clean target. This is done automatically by jh_clean.

jh_clean

jh_clean removes any files which have been created during the build by other jh_ commands, such as jh_build and jh_linkjars

jh_makepkg

jh_makepkg will create template Debian packages for Java programs and libraries similar to dh-make. It should be run in the source directory and it will create the orig.tar.gz and most of the files in the Debian directory, which need only small changes neccessary to build the package.

jh_repack

jh_repack provides functionality to help clean your upstream tarball of prebuilt jars, classfiles and javadoc. If you want to do this whenever you download a new version you can use jh_repack as a uscan helper. Just put jh_repack as the command at the end of the uscan line. E.g.

version=3
http://www.matthew.ath.cx/projects/salliere/ (?:.*/)?salliere-?_?([\d+\.]+|\d+)\.(tar.*|tgz|zip|gz|bz2|) debian jh_repack

Alternatively you can run it by hand:

jh_repack --upstream-version <version> <tarball>

jh_repack will remove any .class files, any .jar files, the whole directory tree containing javadoc and any empty directories as a result of the above.

java-propose-classpath

Some upstreams have complicated classpaths which may not be obvious to the packager when using jh_manifest to set the Class-Path attribute. java-propose-classpath will unpack a jar and look at the symbols imported to the class files, then scan all the jars in /usr/share/java. This should not be run in the build since it is slow, and there may be ambiguities that the packager must resolve. It is still very useful for the packager as most of the time it will get it right automatically.

To avoid bloating the recursive build-deps of packages, java-propose-classpath is in a separate package to javahelper. It should not be on any package's build-depends.

jh_installeclipse

jh_installeclipse will install eclipse features built by eclipse's pde-build script. It supports most of debhelpers normal options. Features can either be put in the $package.eh-install or be given per command-line. By default jh_installeclipse expects pde-build to have been run from debian/.eclipse-build; if you decide to run it from another directory, you should use --pde-build-dir to tell jh_installeclipse where pde-build was run from.

jh_installeclipse knows where pde-build dumps its output, so only the name of the feature should be given. It supports file globbing both in the files and per command-line (though in the latter case your shell may attempt to expand the globs if they are not properly escaped or quoted).

Due two the way the underlying build system works; orbit dependencies will be embedded directly into the installation. jh_installeclipse will replace any orbit dependencies imported by jh_generateorbitdir. If you add/import orbit dependencies yourself through other means, you must replace them yourselves after running jh_installeclipse.

Finally, jh_installeclipse will output a ${orbit:Depends} variable if it replaces any orbit dependency for that package.

jh_generateorbitdir

jh_generateorbitdir is an javahelper program that handles creation of an orbit dependency dir. This directory has to be populated with non-eclipse jar files. However, eclipse refers to these jars by their "symbolic name". jh_generateorbitdir can extract this name from the jar's manifest (provided it has the OSGi metadata) and create a symlink to it.

jh_generateorbitdir will replace regular files with symlinks if they are present in the orbit dir and clash with the name of one of the orbit jars. If an orbit jar name clashes with a symlink in the orbit dir, then jh_generateorbitdir will assume that the given jar has already been symlinked and skip it.

jh_generateorbitdir will also check the default installation for jar files on Debian systems (at the time of writing /usr/share/java), if it cannot find the jar in the current dir.

If present, jh_generateorbitdir will read debian/eclipse.orbitdeps and add the jar files listed in it to the list of orbit dependencies.

jh_setupenvironment

jh_setupenvironment is a javahelper program that handles creating an environment for building an eclipse feature. It does not setup an orbit dir (use jh_generateorbitdir for that). It will copy files specified in debian/eclipse.environment as well as those given on command line into the environment dir. If no files are given per command line and the environment file is not present (or is empty), it will default to org.eclipse.*

jh_compilefeatures

jh_compilefeatures handles compilation of eclipse features. It will read debian/eclipse.features as a list of features to compile and their dependencies. The first item on a line is the id of the feature and the remaining are either ids of previously compiled features or features installed on the system (identified by the folder they are installed in).

By default jh_compilefeatures will set the source and the target version of the class files to 1.5. This can be overriden by explicitly changing the build options (see man jh_compilefeatures for more information).

java-vars.mk

You can include /usr/share/javahelper/java-vars.mk in your debian/rules to get the following variables defined:

  • JAVA_HOME

    If you have not already set it, will default to the default JDK for the architecture (you must depend on default-jdk or -headless if you are not overriding this). To override this set JAVA_HOME before including java-vars.mk

  • JAVA_ARCH

    The JVM version of the build architecture (eg ppc not powerpc)

  • JRE_HOME

    If $JAVA_HOME/jre exists then that, otherwise $JAVA_HOME

  • JVM_CLIENT_DIR and JVM_SERVER_DIR

    Set if the respective types of JVM are installed.

If you need the Java architecture in a non-make context then you can use /usr/share/javahelper/java-arch.sh instead.

Runtime support

Javatools also provides some runtime support. Unlike compiled programs, or purely interpreted programs with hash-bang lines, Java programs cannot be directly executed. Many upstreams expect them to be run using java -jar jarname or java classname. This is not generally acceptible in systems which expect to just be able to run the command or launch it from a menu. As a result, many packagers are writing wrapper scripts which just call java with the correct classpath, jar and main class.

jarwrapper

There is an alternative to wrapper scripts, however. The binfmt_misc kernel module allows the kernel to call out to a program in userspace to execute specific types of file. jarwrapper registers itself as a handler for executable jars. This is done by reading values from the manifest file.

In order for executable jars to work the following attributes must or may be defined in the manifest. These attributes can be set using jh_build and jh_manifest.

  • Main-Class: The name of the class to be run when the application starts. (REQUIRED)

  • Class-Path: The path to all the jar files on which this jar depends. (REQUIRED unless empty)

  • Debian-Java-Home: A Debian-specific property if this application depends on a specific runtime. Specify the path to the runtime which should be used. Multiple space-separated paths may be given if any of the runtimes will work. (OPTIONAL)

  • Debian-Java-Parameters: A Debian-specific property if this application needs extra options to the JVM. (OPTIONAL)

Java Architecture

If you need to know the JVM architecture name at runtime (for example to put libjvm.so on the LD_LIBRARY_PATH) then jarwrapper also provides /usr/share/jarwrapper/java-arch.sh which will either print the current one or convert a debian arch name to a JVM arch name.

Putting it together

This section shows the debian packaging generated by jh_makepkg for an application and a library using jh_build.

Sample Library Packaging

debian/control

Source: jsch
Section: java
Priority: optional
Maintainer: Matthew Johnson <mjj29@debian.org>
Build-Depends: debhelper (>= 7), javahelper, default-jdk, libzlib-java
Standards-Version: 3.9.1
Homepage: http://www.jcraft.com/jsch/

Package: libjsch-java
Architecture: all
Depends: ${java:Depends}, ${misc:Depends}
Description: Java secure channel
 JSch is a pure Java implementation of SSH2. JSch allows you to
 connect to an sshd server and use port forwarding, X11 forwarding,
 file transfer, etc., and you can integrate its functionality
 into your own Java programs. JSch is licensed under a BSD style
 license.

debian/rules

#!/usr/bin/make -f

export JAVA_HOME=/usr/lib/jvm/default-java
export CLASSPATH=/usr/share/java/zlib.jar

build: build-stamp
build-stamp:
    dh_testdir
    jh_build jsch.jar src
    touch $@

clean:
    dh_testdir
    dh_testroot
    jh_build --clean
    dh_clean
    rm -f build-stamp jsch.jar

install: build
    dh_testdir
    dh_testroot
    dh_prep
    dh_installdirs

binary-arch: build install
    # Java packages are arch: all, nothing to do here

binary-indep: build install
    # Create the package here
    dh_testdir
    dh_testroot
    dh_prep
    dh_install -i
    jh_installjavadoc -i
    dh_installdocs -i
    dh_installchangelogs -i
    jh_installlibs -i
    jh_depends -i
    dh_compress -i
    dh_fixperms -i
    dh_installdeb -i
    dh_gencontrol -i
    dh_md5sums -i
    dh_builddeb -i

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install

debian/libjsch-java.jlibs

jsch.jar

debian/libjsch-java.javadoc

internal

Sample Application Packaging

debian/control

Source: salliere
Section: misc
Priority: optional
Maintainer: Matthew Johnson <mjj29@debian.org>
Build-Depends: debhelper (>= 7), default-jdk,
               libmatthew-debug-java, libcsv-java,
               libitext-java, javahelper
Standards-Version: 3.9.1

Package: salliere
Architecture: all
Depends: ${java:Depends}, ${misc:Depends}
Description: Short Description
 Long Description

debian/rules

#!/usr/bin/make -f
export JAVA_HOME=/usr/lib/jvm/default-java
export CLASSPATH=/usr/share/java/csv.jar:/usr/share/java/debug-disable.jar:/usr/share/java/itext.jar

build: build-stamp
build-stamp:
    dh_testdir
    # Build the package
    jh_build salliere.jar src
    touch $@

clean:
    dh_testdir
    dh_testroot
    rm -f build-stamp salliere.jar
    jh_build --clean
    dh_clean

install: build
    dh_testdir
    dh_testroot
    dh_prep
    dh_installdirs

binary-arch: build install
    # Java packages are arch: all, nothing to do here

binary-indep: build install
    # Create the package here
    dh_testdir
    dh_testroot
    dh_prep
    dh_install -i
    dh_installdocs -i
    dh_installchangelogs -i
    jh_manifest -i
    dh_link -i
    jh_exec -i
    jh_depends -i
    dh_compress -i
    dh_fixperms -i
    dh_installdeb -i
    dh_gencontrol -i
    dh_md5sums -i
    dh_builddeb -i

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install

debian/salliere.install

salliere.jar usr/share/salliere

debian/salliere.links

usr/share/salliere/salliere.jar usr/bin

Using javahelper with CDBS

Javahelper 0.18 introduces a CDBS class for javahelper. It runs all the jh_ commands after dh_install* and dh_link and has options for running jh_build under the build target.

The jh_ commands are invoked once per package. You can pass options to all the invocations using the JH_EXEC_ARGS, JH_INSTALLLIBS_ARGS, JH_MANIFEST_ARGS and JH_DEPENDS_ARGS variables.

To invoke jh_build you must either set JH_BUILD_JAR and JH_BUILD_SOURCE and JAVA_HOME or have a debian/javabuild file and set JAVA_HOME. Optionally you can also set CLASSPATH and JH_BUILD_ARGS.

Please note: you MUST include javahelper.mk before ant.mk.

The above debian/rules can be rewritten with CDBS as follows:

#!/usr/bin/make -f
export JAVA_HOME=/usr/lib/jvm/default-java
export CLASSPATH=/usr/share/java/csv.jar:/usr/share/java/debug-disable.jar:/usr/share/java/itext.jar
JH_BUILD_JAR=salliere.jar
JH_BUILD_SRC=src

include /usr/share/cdbs/1/class/javahelper.mk

Using javahelper with dh

Javahelper 0.20 introduces a dh extension for javahelper. It runs all the jh_ commands after dh_install* and dh_link and also runs jh_build if you have a debian/javabuild file.

The above debian/rules can be rewritten with dh 7 as follows:

debian/javabuild

salliere.jar src

debian/rules

#!/usr/bin/make -f

export JAVA_HOME=/usr/lib/jvm/default-java
export CLASSPATH=/usr/share/java/csv.jar:/usr/share/java/debug-disable.jar:/usr/share/java/itext.jar

%:
    dh $@ --with javahelper
javatools-0.45ubuntu1/jh_scanjavadoc0000775000000000000000000000076112265203313014544 0ustar #!/usr/bin/perl # Internal command - do not use directly. # # Finds Dependencies of javadocs. use strict; use warnings; use autodie; use Debian::Javahelper::Java qw(find_package_for_existing_files scan_javadoc); my @dep = (); foreach my $doclink ( map { scan_javadoc($_) } @ARGV){ next unless ( -f "$doclink/package-list" ); $doclink = "$doclink/package-list" unless ( -l $doclink); push(@dep, $doclink); } print join(', ', find_package_for_existing_files(@dep)), "\n" if(@dep); javatools-0.45ubuntu1/jh_installlibs0000775000000000000000000000626712265203313014617 0ustar #!/bin/bash -- set -e . /usr/share/javahelper/jh_lib.sh syntax() { echo -e "Usage: jh_installlibs [options] [jars]" echo -e "Options:" echo -e "\t-h --help: show this text" echo -e "\t-V --version: show the version" echo -e "\t-i --indep: act on all Arch: all packages" echo -e "\t-a --arch: act on all Arch-specific packages" echo -e "\t-s --same-arch: alias of --arch for compatibility with debhelper" echo -e "\t-p --package=: package to act on (default=all)" echo -e "\t-P --tmpdir=: package directory (default=\$CWD/debian/package)" echo -e "\t-v --verbose: show more information while running" echo -e "\t-n --no-act: don't actually do anything, just print the results" echo -e "\t--no-mangle: don't try and sanitize the upstream version number" echo -e "\t--upstream-version=: manually set the upstream version" echo -e "\t--version-strip=: manually supply the regex to remove from the upstream version number" exit 1 } ARGS="i indep a arch s same-arch p package P tmpdir v verbose n no-act no-mangle upstream-version version-strip" parseargs "$@" dh_testdir FULL_VERSION="`dpkg-parsechangelog | sed -n '/^Version:/s/^[^:]*: \(.*\)$/\1/p'`" VERSION="`echo "$FULL_VERSION" | sed -n 's/\(.*:\)\?\([^-]*\)\(-.*\)\?/\2/p' `" VERBOSE="`getarg v verbose`" DEFAULT_VERSION_MANGLE=".dfsg[0-9]*$" function processjar() { p="$1" j="$2" from="$j" to="`basename "$j"`" if [ -n "`getarg upstream-version`" ]; then VERSION="`getarg upstream-version`" elif [ -n "`getarg no-mangle`" ]; then true elif [ -n "`getarg version-strip`" ]; then VERSION="$(sed "s/`getarg version-strip`//" <<< $VERSION )" else VERSION="$(sed "s/$DEFAULT_VERSION_MANGLE//" <<< $VERSION )" fi if [ "$to" != "${to%-${VERSION}.jar}" ]; then to="${to%-${VERSION}.jar}.jar" fi if [ -n "`getarg n no-act`" ]; then echo mkdir -p "$PACKAGEDIR/usr/share/java" echo install -m 644 "$from" "$PACKAGEDIR/usr/share/java/${to%.jar}-${VERSION}.jar" echo ln -sf ${to%.jar}-${VERSION}.jar "$PACKAGEDIR/usr/share/java/$to" else if [ -n "$VERBOSE" ]; then echo "Installing library $j into package $p" fi mkdir -p "$PACKAGEDIR/usr/share/java" install -m 644 "$from" "$PACKAGEDIR/usr/share/java/${to%.jar}-${VERSION}.jar" ln -sf ${to%.jar}-${VERSION}.jar "$PACKAGEDIR/usr/share/java/$to" fi } if [ "$ARGC" != "0" ] ; then p="`firstpackage`" PACKAGEDIR="`getarg P tmpdir`" if [ -z "$PACKAGEDIR" ]; then PACKAGEDIR="`pwd`/debian/$p" else PACKAGEDIR=`readlink -f $PACKAGEDIR` fi for (( i=0; i < $ARGC; i++ )); do j=${ARGV[i]} processjar "$p" "$j" done exit 0 fi for p in `findpackages`; do PACKAGEDIR="`getarg P tmpdir`" if [ -z "$PACKAGEDIR" ]; then PACKAGEDIR="`pwd`/debian/$p" else PACKAGEDIR=`readlink -f $PACKAGEDIR` fi if [ -n "$VERBOSE" ]; then echo "Searching $PACKAGEDIR for $p" fi FILE= if [ -f debian/$p.jlibs ]; then FILE=debian/$p.jlibs elif [ -f debian/jlibs ]; then FILE=debian/jlibs else continue fi IFS=' ' for i in `cat "$FILE"`; do processjar "$p" "$i" done unset PACKAGEDIR done javatools-0.45ubuntu1/java-vars.mk0000664000000000000000000000212612265203313014101 0ustar # Define useful Java-related variables. May be overridden by the package. # In particular, JAVA_HOME should be overridden before including this file, # so that it can give JRE_HOME and the CLIENT/SERVER dirs relative to the # correct JAVA_HOME # # The root of the JDK installation JAVA_HOME?=/usr/lib/jvm/default-java DPKG_ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH | cut -d- -f2) # Architecture that sun uses for libjvm.so directory etc JAVA_ARCH=$(shell /usr/share/javahelper/java-arch.sh $(DPKG_ARCH)) # Location of the JRE (JRE sub-directory or not?) JRE_HOME=$(shell if [ -d $(JAVA_HOME)/jre ]; then echo $(JAVA_HOME)/jre; else echo $(JAVA_HOME); fi ) # may or may not be set, depends if the JVM ships a server VM or not JVM_CLIENT_DIR=$(shell if [ -d $(JRE_HOME)/lib/$(JAVA_ARCH)/client ]; then echo $(JRE_HOME)/lib/$(JAVA_ARCH)/client; fi ) JVM_SERVER_DIR=$(shell if [ -d $(JRE_HOME)/lib/$(JAVA_ARCH)/server ]; then echo $(JRE_HOME)/lib/$(JAVA_ARCH)/server; fi ) #print-vars: # @echo $(JAVA_HOME) # @echo $(JAVA_ARCH) # @echo $(JRE_HOME) # @echo $(JVM_CLIENT_DIR) # @echo $(JVM_SERVER_DIR) javatools-0.45ubuntu1/jardetector.pod0000664000000000000000000000070512265203313014671 0ustar =head1 NAME jardetector - binfmt helper to check if a zip/jar file contains a MANIFEST. =head1 SYNOPSIS jardetector > =head1 DESCRIPTION This is a helper script for binfmt to verify that a zip/jar file contains a MANIFEST, it is normally not needed to run this command directly. =head1 SEE ALSO L The javahelper tutorials in /usr/share/doc/javahelper. These tutorials are available in the I package. =cut javatools-0.45ubuntu1/java-propose-classpath.10000664000000000000000000000056412265203313016332 0ustar .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. .TH JAVAHELPER "1" "January 2008" "Javahelper Version 0.5" "User Commands" .SH NAME Javahelper \- Part of the Java Helper packaging tools. Refer to the tutorials in /usr/share/doc/javahelper for more detail .SH SYNOPSIS .B java-propose-classpath \fI-c\fR | \fI\fR .SH DESCRIPTION javatools-0.45ubuntu1/jh_build.10000664000000000000000000000211212265203313013513 0ustar .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. .TH JAVAHELPER "1" "January 2008" "Javahelper Version 0.5" "User Commands" .SH NAME Javahelper \- Part of the Java Helper packaging tools Refer to the tutorials in /usr/share/doc/javahelper for more detail .SH SYNOPSIS .B jh_build [\fIoptions\fR] [\fI \fR] .SH OPTIONS .HP \fB\-h\fR \fB\-\-help\fR: show this text .HP \fB\-V\fR \fB\-\-version\fR: show the version .HP \fB\-m\fR \fB\-\-main=\fR: Use this class as the main class .HP \fB\-j\fR \fB\-\-java\-home=\fR: Set the JAVA_HOME variable .HP \fB\-o\fR \fB\-\-javacopts=\fR: Options to the Java compiler .HP \fB\-J\fR \fB\-\-javadoc\fR: Build javadoc .HP \fB\-N\fR \fB\-\-no-javadoc\fR: Don't build javadoc .HP \fB\-\-javadoc-opts=\fR: Options to the Javadoc compiler .HP \fB\-\-clean\fR: clean the build tree .SS "Environment Variables:" .IP JAVA_HOME: path to the JDK to use CLASSPATH: classpath to compile with and set in the manifest JH_JAR_EXTRA: extra files to be included in the jar javatools-0.45ubuntu1/tutorial-header.html0000664000000000000000000000010212265203313015625 0ustar Javahelper Tutorial javatools-0.45ubuntu1/jh_installeclipse0000775000000000000000000001615212265203313015304 0ustar #!/usr/bin/perl =head1 NAME jh_installeclipse - Installs eclipse features built by pde-build into package build directories =cut use strict; use warnings; use autodie; use Debian::Debhelper::Dh_Lib; use Debian::Javahelper::Eclipse qw(:constants install_zipped_feature); =head1 SYNOPSIS B [S>] [B<--install-name=>I] [B<--pde-build-dir=>I] [S>] =head1 DESCRIPTION jh_installeclipse is a javahelper program that handles installing eclipse features built by pde-build into package build directories. These features can be specified either in the package's eh-install file or via command-line. jh_installeclipse uses debhelper behind the scenes and are therefore subject to the compat level (e.g. when parsing eh-install files). jh_installeclipse will replace all the embedded orbit depends imported by jh_generateorbitdeps with symlinks post install. The symlinked jar files will also be used to populate ${orbit:Depends} variable. =head1 FILES =over 4 =item debian/I.eh-install List the eclipse features to install into each package and optionally under which name. The format is a set of lines, where each line lists a file or files to install, and at the end of the line tells the name it should be installed under. You may use wildcards in the names of the files to install. If name is not present, eh_install will either use the install name given on the command line or attempt to guess it from the package name. It is perfectly legal for two or more features to be installed under the same name. =back =head1 OPTIONS =over 4 =item B<--install-name=>I Specifies the name to install under if it is not given in the file. It is perfectly legal to install more than one feature under the same name. =item B<--pde-build-dir=>I Specifies the directory from where pde-build was run. Defauls to "debian/.eclipse_build". =back =cut my %archpackages; my $pdebdir = undef; my $fallback = undef; my $orbitcfile = 'debian/orbitdeps.debhelper'; my @orbitdeps = (); my %needed; init(options => { 'pde-build-dir=s' => \$pdebdir, 'install-name=s' => \$fallback }); # Use default value if none are given. $pdebdir = 'debian/.eclipse-build' unless(defined($pdebdir)); $pdebdir =~ s@/*$@@; # remove trailing slash, looks better. # Append the actual output dir. $pdebdir = "$pdebdir/build/rpmBuild"; if( -e $orbitcfile) { # Read the orbit data from jh_generateorbitdir open(my $fd, '<', $orbitcfile); while( my $line = <$fd>){ my ($sysjar, $orbjar); chomp($line); ($sysjar, $orbjar, undef) = split(/\s*+,\s*+/o, $line); push(@orbitdeps, {${\EOB_SYM_NAME} => $orbjar, ${\EOB_SYS_JAR} => $sysjar}); } close($fd); } # gather a hash of arch dependent packages; their stuff is installed # under lib rather than share. foreach my $arch (getpackages('arch')){ $archpackages{$arch} = 1; } foreach my $package (@{$dh{DOPACKAGES}}) { my $installfile = pkgfile($package, 'eh-install'); my $dropins; my $lineno = 0; my $defdname = $fallback; my @infiles; next if($installfile eq q{}); $defdname = $1 if($package =~ m/^eclipse-(.+)/o); $dropins = get_dropins_path($package); @infiles = filedoublearray($installfile); if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { push @infiles, [@ARGV]; } foreach my $line (@infiles) { my ($zipglob, $dname, $other) = @$line; error("Trailing text in $installfile ($other)") if(defined($other) && length($other) > 0); $dname = $defdname unless(defined($dname) && length($dname) > 0); error("Missing (and could not guess) eclipse-name for $zipglob for $package - please provide a default.") unless(defined($dname) && length($dname) > 0); foreach my $zip (glob("$pdebdir/$zipglob")){ foreach my $ext ((q{}, '.zip', '.ZIP')){ # Guess common extensions - mostly for the "non-globable cases". if( -e "$zip${ext}"){ $zip = "$zip${ext}"; last; } } install_zipped_feature($zip, "$dropins/$dname", \@orbitdeps, $package, \%needed); } } } while ( my ($sysjar, $users) = each(%needed) ){ my ($pkg, $ver) = find_dependency($sysjar); if(!defined($pkg)){ warning("Cannot determine the package providing $sysjar."); next; } $ver =~ s/-1$//o; foreach my $pack (keys(%$users)){ addsubstvar($pack, 'orbit:Depends', $pkg, ">= $ver"); } } foreach my $package (@{$dh{DOPACKAGES}}){ my $ext=pkgext($package); my $substvars="debian/${ext}substvars"; if (! -e $substvars || system('grep', '-q', '^orbit:Depends=', $substvars) != 0) { complex_doit("echo orbit:Depends= >> $substvars"); } } exit(0); # Determines where to install something for a given package. sub get_dropins_path{ my $package = shift; my $prefix = tmpdir($package) . '/usr/'; $prefix .= exists($archpackages{$package})?'lib':'share'; return "$prefix/eclipse/dropins"; } sub find_dependency{ my $sysjar = shift; my $deppkg = undef; my $depver = undef; my %pkgtable; verbose_print("dpkg -S $sysjar"); open(my $fd, '-|', 'dpkg', '-S', $sysjar); while( my $input = <$fd> ){ my ($p, $f); chomp($input); ($p, $f) = split(/\s*+:\s*+/o, $input); if($f eq $sysjar){ $pkgtable{$p} = 1; } } close($fd); if(scalar(keys(%pkgtable)) > 0){ verbose_print('dpkg -l'); open(my $dfd, '-|', 'dpkg', '-l'); while( chomp(my $line = <$dfd>) ){ my ($pname, $version); next if ($line !~ m/^.i/o); (undef, $pname, $version, undef) = split(/\s++/o, $line); if(exists($pkgtable{$pname})){ $deppkg = $pname; $depver = $version; } } close($dfd); } return ($deppkg, $depver); } =head1 EXAMPLE Suppose your package builds org.eclipse.emf and org.eclipse.xsd and you want to put org.eclipse.emf into eclipse-emf and org.eclipse.xsd into eclipse-xsd. Then make debian/eclipse-emf.eh-install contain: org.eclipse.emf and debian/eclipse-xsd.eh-install contain: org.eclipse.xsd jh_installeclipse will then install org.eclipse.emf into usr/share/eclipse/dropins/emf/ and xsd into usr/share/eclipse/dropins/xsd/. In case your package is not called eclipse-I, or you want to install two different features into the same package, you will have to provide a name. Suppose you wanted to install both eclipse above into a single package called foo, then debian/foo.eh-install should contain: org.eclipse.emf emf org.eclipse.xsf xsd =head1 SEE ALSO L This program is a part of javahelper and uses debhelper as backend. There are also tutorials in /usr/share/doc/javahelper. =head1 AUTHOR Niels Thykier =head1 COPYRIGHT AND LICENSE Copyright 2010 by Niels Thykier This tool is free software; you may redistribute it and/or modify it under the terms of GNU GPL 2. =cut javatools-0.45ubuntu1/jh_build0000775000000000000000000001257112265203313013371 0ustar #!/bin/bash -- EXECDIRS="bin usr/bin usr/games" set -e . /usr/share/javahelper/jh_lib.sh syntax() { echo -e "Usage: jh_build [options] [ ]" echo -e "Options:" echo -e "\t-h --help: show this text" echo -e "\t-V --version: show the version" echo -e "\t-q --quiet: don't print the build commands as they are executed" echo -e "\t-m --main=: Use this class as the main class" echo -e "\t-j --java-home=: Set the JAVA_HOME variable" echo -e "\t-o --javacopts=: Options to the Java compiler" echo -e "\t--clean: clean the build tree" echo -e "\t-N --no-javadoc: Disable building javadoc" echo -e "\t-J --javadoc: Enable building javadoc" echo -e "\t--javadoc-opts=: Options to javadoc" echo -e "Environment Variables:" echo -e "\tJAVA_HOME: path to the JDK to use" echo -e "\tCLASSPATH: classpath to compile with and set in the manifest" echo -e "\tJH_JAR_EXTRA: extra files to be included in the jar" exit 1 } ARGS="q quiet m main j java-home o javacopts J javadoc N no-javadoc O javadoc-opts clean" parseargs "$@" if [ -n "`getarg clean`" ]; then rm -rf debian/_jh_manifest* debian/_jh_build* if [ -f debian/javabuild ]; then rm -f `awk '{print $1}' < debian/javabuild` fi exit 0 fi if [ -n "`getarg j java-home`" ]; then JAVA_HOME="`getarg j java-home`" elif [ -z "$JAVA_HOME" ]; then if [ -d /usr/lib/jvm/default-java ]; then JAVA_HOME=/usr/lib/jvm/default-java elif [ -d /usr/lib/jvm/java-gcj ]; then JAVA_HOME=/usr/lib/jvm/java-gcj else JAVA_HOME=invalid fi fi JH_JAVAC_OPTS="`getarg o javacopts`" JH_JAVADOC_OPTS="`getarg O javadoc-opts`" if ! grep -- -source <<< "$JH_JAVAC_OPTS" &>/dev/null; then if ! grep -- -target <<< "$JH_JAVAC_OPTS" &>/dev/null; then JH_JAVAC_OPTS="-source 1.5 -target 1.5 $JH_JAVAC_OPTS" else JH_JAVAC_OPTS="-source 1.5 $JH_JAVAC_OPTS" fi fi if ! grep -- -source <<< "$JH_JAVADOC_OPTS" &>/dev/null; then JH_JAVADOC_OPTS="-source 1.5 $JH_JAVADOC_OPTS" fi function dobuild() { jarfile="$1" shift ext="`basename "$jarfile" .jar`" srcdirs= srcfiles= while [ -n "$1" ]; do if [ -f "$1" ]; then srcfiles="$srcfiles $1" elif [ -d "$1" ]; then srcdirs="$srcdirs $1" else echo "Ignoring $1 because it does not exist" fi shift done if [ "$JAVA_HOME" == "invalid" ]; then echo "Cannot find any JAVA_HOME: aborting" 1>&2 exit 1 fi rm -f debian/_jh_manifest.$ext ( if [ -n "$CLASSPATH" ]; then echo -n "Class-Path: " echo $CLASSPATH | sed 's/:/ /g' fi if [ -n "`getarg m main`" ]; then echo "Main-Class: `getarg m main`" echo "Debian-Java-Home: $JAVA_HOME" fi ) | perl -p -e 's/(.{72})(?=.)/$1\n /go' >> debian/_jh_manifest.$ext # (NB: see D::JH::Java::write_manifest_section_fd on the regex above) CLASSPATHDOCS="`for i in $(grep-dctrl --no-field-names --show-field Build-Depends,Build-Depends-Indep -F source "$pkg" debian/control | tr , ' ' | sed 's/([^)]*)//g') ; do dpkg -L $i 2>/dev/null | grep /usr/share/doc/.*/api$; done | sed 's/^/-link /' | xargs`" mkdir -p debian/_jh_build.$ext if [ -n "$srcdirs" ]; then if [ -z "`getarg q quiet`" ]; then echo find $srcdirs -name '*.java' -and -type f -print0 '|' xargs -0 $JAVAC -cp $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.$ext $JH_JAVAC_OPTS $srcfiles fi find $srcdirs -name '*.java' -and -type f -print0 | xargs -0 $JAVAC -cp $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.$ext $JH_JAVAC_OPTS $srcfiles if [ -n "`getarg J javadoc`" ] || [ -z "`getarg N no-javadoc`" ]; then if [ -z "`getarg q quiet`" ]; then echo find $srcdirs -name '*.java' -and -type f -print0 '|' xargs -0 $JAVADOC $CLASSPATHDOCS -classpath $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.javadoc/api -quiet $JH_JAVADOC_OPTS $srcfiles fi find $srcdirs -name '*.java' -and -type f -print0 | xargs -0 $JAVADOC $CLASSPATHDOCS -classpath $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.javadoc/api -quiet $JH_JAVADOC_OPTS $srcfiles fi elif [ -n "$srcfiles" ]; then if [ -z "`getarg q quiet`" ]; then echo $JAVAC -cp $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.$ext $JH_JAVAC_OPTS $srcfiles fi $JAVAC -cp $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.$ext $JH_JAVAC_OPTS $srcfiles if [ -n "`getarg J javadoc`" ] || [ -z "`getarg N no-javadoc`" ]; then if [ -z "`getarg q quiet`" ]; then echo $JAVADOC $CLASSPATHDOCS -classpath $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.javadoc/api -quiet $JH_JAVADOC_OPTS $srcfiles fi $JAVADOC $CLASSPATHDOCS -classpath $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.javadoc/api -quiet $JH_JAVADOC_OPTS $srcfiles fi else exit 0 fi touch "$jarfile" jarpath="`readlink -f "$jarfile"`" ( cd debian/_jh_build.$ext; if [ -z "`getarg q quiet`" ]; then echo $JAR cfm "$jarpath" ../_jh_manifest.$ext * fi $JAR cfm "$jarpath" ../_jh_manifest.$ext * ) if [ -n "$JH_JAR_EXTRA" ]; then if [ -z "`getarg q quiet`" ]; then echo $JAR uf "$jarpath" $JH_JAR_EXTRA fi $JAR uf "$jarpath" $JH_JAR_EXTRA fi } JAVAC="${JAVA_HOME}/bin/javac" JAVADOC="${JAVA_HOME}/bin/javadoc" JAR="${JAVA_HOME}/bin/jar" jarfile="${ARGV[0]}" if [ -z "$jarfile" ]; then if [ -f debian/javabuild ]; then cat debian/javabuild | while read line; do dobuild $line done fi else dobuild "${ARGV[@]}" fi javatools-0.45ubuntu1/jh_installjavadoc0000775000000000000000000000564612265203313015275 0ustar #!/bin/bash -- set -e . /usr/share/javahelper/jh_lib.sh syntax() { echo -e "Usage: jh_installjavadoc [options] [src] [target]" echo -e "Options:" echo -e "\t-h --help: show this text" echo -e "\t-V --version: show the version" echo -e "\t-i --indep: act on all Arch: all packages" echo -e "\t-a --arch: act on all Arch-specific packages" echo -e "\t-s --same-arch: alias of --arch for compatibility with debhelper" echo -e "\t-p --package=: package to act on (default=all)" echo -e "\t-P --tmpdir=: package directory (default=\$CWD/debian/package)" echo -e "\t-v --verbose: show more information while running" echo -e "\t-n --no-act: don't actually do anything, just print the results" echo -e "\t-A --author=: Author of the javadoc" exit 1 } ARGS="A author i indep a arch s same-arch p package P tmpdir v verbose n no-act" parseargs "$@" dh_testdir VERBOSE="`getarg v verbose`" AUTHOR="`getarg A author`" function installjavadoc() { package="$1" src="$2" target="$3" if [ -z "$AUTHOR" ]; then AUTHOR="The authors of $package" fi if [ -z "$src" ]; then echo "Error: trying to install from empty source" exit 1 fi if [ ! -d "$src" ]; then echo "Javadoc source $src does not exist or is not a directory, skipping" return fi if [ -z "$target" ]; then target="debian/$package/usr/share/doc/$package/api" docbasepath="/usr/share/doc/$package/api" else docbasepath="/$target" target="debian/$package/$target" fi if [ -n "$VERBOSE" ]; then echo "Installing javadoc from $src into package $package" fi if [ -n "`getarg n no-act`" ]; then echo mkdir -p "`dirname "$target"`" echo cp -r "$src" "$target" echo cat \> debian/$package.doc-base.javadoc else cat > debian/$package.doc-base.javadoc <> debian/.javahelper_clean mkdir -p "`dirname "$target"`" cp -r "$src" "$target" fi } if [ "$ARGC" != "0" ] ; then p="`firstpackage`" installjavadoc "$p" "${ARGV[0]}" "${ARGV[1]}" exit 0 fi for p in `findpackages`; do PACKAGEDIR="`getarg P tmpdir`" if [ -z "$PACKAGEDIR" ]; then PACKAGEDIR="`pwd`/debian/$p" else PACKAGEDIR=`readlink -f $PACKAGEDIR` fi DIR= if [ -f debian/$p.javadoc ]; then DIR="`awk '{print $1}' debian/$p.javadoc`" TARGET="`awk '{print $2}' debian/$p.javadoc`" elif [ -f debian/javadoc ]; then DIR="`awk '{print $1}' debian/javadoc`" TARGET="`awk '{print $2}' debian/javadoc`" else continue fi if [ "$DIR" = "internal" ] && [ -d debian/_jh_build.javadoc/api ]; then DIR=debian/_jh_build.javadoc/api fi installjavadoc "$p" "$DIR" "$TARGET" unset PACKAGEDIR done javatools-0.45ubuntu1/jh_installjavadoc.10000664000000000000000000000171712265203313015424 0ustar .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. .TH JAVAHELPER "1" "January 2008" "Javahelper Version 0.5" "User Commands" .SH NAME Javahelper \- Part of the Java Helper packaging tools Refer to the tutorials in /usr/share/doc/javahelper for more detail .SH SYNOPSIS .B jh_installjavadoc [\fIoptions\fR] [\fIsourcedir\fR] .SH OPTIONS .HP \fB\-h\fR \fB\-\-help\fR: show this text .HP \fB\-V\fR \fB\-\-version\fR: show the version .HP \fB\-i\fR \fB\-\-indep\fR: act on all Arch: all packages .HP \fB\-a\fR \fB\-\-arch\fR: act on all Arch\-specific packages .HP \fB\-p\fR \fB\-\-package=\fR: package to act on (default=all) .HP \fB\-P\fR \fB\-\-tmpdir=\fR: package directory (default=$CWD/debian/package) .HP \fB\-v\fR \fB\-\-verbose\fR: show more information while running .HP \fB\-n\fR \fB\-\-no\-act\fR: don't actually do anything, just print the results .HP \fB\-a\fR \fB\-\-author=\fR: Javadoc author javatools-0.45ubuntu1/jarwrapper0000775000000000000000000000203012265203313013753 0ustar #!/bin/sh -- set -e JAR=$1 shift if [ -z "$JAR" ]; then echo "Jarwrapper must be run with a jar as the first parameter. Doing so via binfmt_misc is a good way to do it" exit 1 fi JAR="`readlink -f "$JAR"`" TEMP="`mktemp -d`" (cd "$TEMP"; fastjar xf "$JAR" META-INF/MANIFEST.MF) NEW_JAVA_HOMES="`sed -n '/^Debian-Java-Home:/s/^[^:]*: *//p' "$TEMP/META-INF/MANIFEST.MF"`" JAVAOPTS="`sed -n '/^Debian-Java-Parameters:/s/^[^:]*: *//p' "$TEMP/META-INF/MANIFEST.MF"`" rm -rf "$TEMP" for i in $NEW_JAVA_HOMES; do if [ -x "$i/bin/java" ]; then JAVA="$i/bin/java" JAVA_HOME="$i" elif [ -x "$i/jre/bin/java" ]; then JAVA="$i/jre/bin/java" JAVA_HOME="$i/jre" fi done if [ -z "$JAVA" ]; then JAVA=java fi if which "$JAVA" >/dev/null 2>&1; then export LD_LIBRARY_PATH=/usr/lib/jni exec $JAVA $JAVAOPTS -Djava.library.path=/usr/lib/jni -jar "$JAR" "$@" else echo "In order to run Java programs you must install a compatible JRE. If you don't know what JRE you need, default-jre is probably a good bet" fi javatools-0.45ubuntu1/eclipse_helper.pm0000664000000000000000000000072212265203313015177 0ustar # DH Sequence for eclipse helper. ## no critic (Modules::RequireExplicitPackage) use strict; use warnings; use autodie; use Debian::Debhelper::Dh_Lib; # Build rules insert_after('dh_auto_build', 'jh_setupenvironment'); insert_after('jh_setupenvironment', 'jh_generateorbitdir'); insert_after('jh_generateorbitdir', 'jh_compilefeatures'); # Install rules insert_after('dh_install', 'jh_installeclipse'); # Clean rules insert_before('dh_clean', 'jh_clean'); 1; javatools-0.45ubuntu1/jh_makepkg.10000664000000000000000000000331612265203313014042 0ustar .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. .TH JAVAHELPER "1" "January 2008" "Javahelper Version 0.5" "User Commands" .SH NAME Javahelper \- Part of the Java Helper packaging tools Refer to the tutorials in /usr/share/doc/javahelper for more detail .SH SYNOPSIS .B jh_makepkg [\fIoptions\fR] .SH OPTIONS .HP \fB\-h\fR \fB\-\-help\fR: show this text .HP \fB\-V\fR \fB\-\-version\fR: show the version .HP \fB\-p\fR \fB\-\-package=\fR: Set the name of the package (defaults to directory name without version) .HP \fB\-m\fR \fB\-\-maintainer=\fR: Set the maintainer name (defaults to DEBFULLNAME, NAME, or the user's full name) .HP \fB\-e\fR \fB\-\-email=\fR: Set the maintainer email (defaults to DEBEMAIL EMAIL or user@host) .HP \fB\-v\fR \fB\-\-upstream=\fR: Set the upstream version (defaults to the directory name after a \-) .HP \fB\-c\fR \fB\-\-clean\fR: Tidy up common problems with Java source packages. Removes .class, .jar files and pre-built javadoc trees before creating the orig.tar.gz .IP Pick One: \fB\-l\fR \fB\-\-library\fR: This is a library package \fB\-a\fR \fB\-\-app\fR: This is an application package Pick One: \fB\-t\fR \fB\-\-ant\fR: Build with ant \fB\-k\fR \fB\-\-makefiles\fR: Build with make \fB\-n\fR \fB\-\-none\fR: Create own buildsystem Pick One: \fB\-g\fR \fB\-\-gcj\fR: Build with gcj \fB\-d\fR \fB\-\-default\fR: Build with default free compiler \fB\-o\fR \fB\-\-openjdk\fR: Build with OpenJDK 6 \fB\-o7\fR \fB\-\-openjdk7\fR: Build with OpenJDK 7 .SS "Environment Variables:" .IP DEBEMAIL: Default maintainer email address EMAIL: Default maintainer email address DEBFULLNAME: Default maintainer name NAME: Default maintainer name javatools-0.45ubuntu1/jh_compilefeatures0000775000000000000000000001517412265203313015463 0ustar #!/usr/bin/perl =head1 NAME jh_compilefeatures - Compiles eclipse features using pde-build. =cut use strict; use warnings; use autodie; use Cwd(); use Debian::Debhelper::Dh_Lib; use Debian::Javahelper::Eclipse qw(install_zipped_feature); =head1 SYNOPSIS B [S>] [S>] [B<--pde-build-dir=>I] [S>] =head1 DESCRIPTION jh_compilefeatures is a javahelper program that handles compiling features using pde-build. These features can be specified either in debian/eclipse.features or via command-line. jh_compilefeatures uses debhelper behind the scenes and are therefore subject to the compat level (e.g. when parsing the eclipse.features file). When specifying the dependencies for a feature, jh_compilefeatures will see if this feature has just been compiled and will use the dependency if it is among the results. This can be used together with debian/eclipse.features. Dependencies are always resolved by first checking if it is a recently built feature and if not, then the system installed eclipse's dropins folders will be checked. Currently jh_compilefeatures do not clean up between builds, which means the dependencies for previous builds are present for the current build. Nevertheless, do not rely on this, as this behavior is subject to change. Note: jh_compilefeatures will I rearrange the build order for you in order to do this. Note: that jh_compilefeatures will not error out if it cannot find a missing dependency. This is due to the underlying builder being unable to detect this. =head1 FILES =over 4 =item debian/eclipse.features List the eclipse features to compile and their dependencies. The first item on the line is the feature to compile and the following items are considered dependencies. A dependency can either be a dropins folder or a previous built feature. jh_compilefeatures will find it as long as it is installed in the system eclipse's dropins folder or it has just been compiled. =back =head1 OPTIONS =over 4 =item B<--pde-build-dir=>I Specifies the directory from where pde-build is to be run. Defauls to "debian/.eclipse_build". =item B<--feature-deps=>I A space separated list of dependencies. These dependencies will be used to compile all features passed by command-line. Features read from debian/eclipse.features are unaffected by this. =item B<--build-opts=>I Pass args to the underlying builder. These options are passed to all features built. This defaults to "-DjavacTarget=1.5 -DjavacSource=1.5" if not set. This can be disabled by passing the empty string. =item B<--jvm-args=>I Pass args to the JVM. These options are passed to all features built. =item B<--orbit-dir=>I Specifies where the Orbit dependencies can be found. This is only needed if the orbit dir is in an unusual location. =item B<--pde-build=>I Use a non-standard pde-build command to compile the features. =item B<--pde-args=args> Passes args directly to pde-build. Note, jh_compilefeatures have specialised options for some of pde-build options and these should be used whenever possible. These options are passed to all features built. =item B<--ignore-java-home> Skip the check of JAVA_HOME. Since the underlying builder uses ant (and therefore java), the build should ensure it always uses the expected java implementation. Use this if you (for whatever reason) need to declare the specific java implementation without being able to use JAVA_HOME. Note: You still have to tell the underlying builder which java to use. =back =cut my $pdebdir = undef; my $ffile = 'debian/eclipse.features'; my @features = (); my $fdeps = q{}; my $orbitdir = undef; my $pdebcmd = undef; my $bopts = undef; my $pdeargs = q{}; my $jvmargs = q{}; my $ignoreJH = 0; init(options => { 'pde-build-dir=s' => \$pdebdir, 'feature-deps=s' => \$fdeps, 'orbit-dir=s' => \$orbitdir, 'pde-build=s' => \$pdebcmd, 'build-opts=s' => \$bopts, 'pde-args=s' => \$pdeargs, 'jvm-args=s' => \$jvmargs, 'ignore-java-home' => \$ignoreJH, }); error('pde-build uses ant, therefore JAVA_HOME must be set.') unless(($ENV{'JAVA_HOME'}//q{}) ne q{} or $ignoreJH); # Use default value if none are given. $pdebdir = 'debian/.eclipse-build' unless(defined($pdebdir)); $pdebdir =~ s@/*$@@; # remove trailing slash, looks better. $orbitdir = "$pdebdir/orbitdeps" unless(defined($orbitdir)); $pdebcmd = '/usr/lib/eclipse/buildscripts/pde-build' unless(defined($pdebcmd)); $bopts = '-DjavacTarget=1.5 -DjavacSource=1.5' unless(defined($bopts)); $orbitdir = Cwd::abs_path($orbitdir) unless($orbitdir =~ m@^/@); if( -e $ffile){ @features = filedoublearray($ffile); } error("$pdebdir does not exist") if(scalar(@ARGV) + scalar(@features) > 0 && ! -d $pdebdir); foreach my $arg (@ARGV){ compile($arg, split(m/\s++/o, $fdeps)); } foreach my $feat (@features){ compile(@$feat); } exit(0); sub compile{ my $feat = shift; my @args = (); my @deps = (); DEP_LOOP: foreach my $d (@_){ # Check if we just built this feature. foreach my $s (q{}, '.zip', '.ZIP') { my $zip = "$pdebdir/$d$s"; if( -e $zip ){ install_zipped_feature($zip, "$pdebdir/build/SDK"); next DEP_LOOP; } } push(@deps, $d); } push(@args, '-o', escape_shell($orbitdir)) if(defined($orbitdir) && -d $orbitdir); push(@args, '-j', escape_shell($jvmargs)) if($jvmargs ne q{}); push(@args, '-a', escape_shell($bopts)) if($bopts ne q{}); push(@args, '-d', escape_shell(join(q{ }, @deps))) if(scalar(@deps) > 0); push(@args, $pdeargs); complex_doit('cd', $pdebdir , '&&', $pdebcmd, @args, '-f', $feat); } =head1 EXAMPLE A sample debian/eclipse.features org.eclipse.tm.terminal emf org.eclipse.rse.sdk org.eclipse.tm.terminal depends on "emf", which is expected to be found in eclipse's dropins folder. org.eclipse.rse.sdk on the other hand has no dependencies beyond the eclipse platform. If needed you can also specify a previously built feature as a dependency: org.eclipse.some.feature org.eclipse.another.feature org.eclipse.some.feature rse Here org.eclipse.another.feature depends org.eclipse.some.feature, which was just built and also rse, which is expected to be in system installed eclipse's dropins. =head1 SEE ALSO L This program is a part of javahelper and uses debhelper as backend. There are also tutorials in /usr/share/doc/javahelper. =head1 AUTHOR Niels Thykier =head1 COPYRIGHT AND LICENSE Copyright 2010 by Niels Thykier This tool is free software; you may redistribute it and/or modify it under the terms of GNU GPL 2. =cut javatools-0.45ubuntu1/tutorial.txt0000664000000000000000000005251712265203313014273 0ustar Packaging Java with Javatools ============================= Javatools replaces the existing jarwrapper package and also contains programs to help packagers in creating packages for Java programs and libraries. Packaging tools --------------- The javahelper package consists of several small programs which make packaging Java programs and libraries easier. They are generally designed to work in the same fashion as the debhelper programs, but start with the `jh_` prefix. All of the programs have their command line arguments documented in manpages. jh_build -------- Many Java programs and libraries are distributed without sane build systems. `jh_build` provides a simple interface for building Java source code into Jars, including setting the appropriate entries in the manifest. In almost all cases all that needs to be done to call `jh_build` is to set `JAVA_HOME` and `CLASSPATH` and then call `jh_build` with the name of the jar and the directory containing the source. JAVA_HOME=/usr/lib/jvm/default-java CLASSPATH=/usr/share/java/esd.jar:/usr/share/java/jsch.jar jh_build weirdx.jar src This command will compile all the Java files under src, set the classpath in the manifest and build it all into weirdx.jar. A couple of other options are worth mentioning. If this jar contains an application rather than a library then the -m or --main option can be used to set the Main-Class attribute in the manifest which will allow the resulting jar file to be be executed Alternatively, you may provide a debian/javabuild file containing one jar per line, each jar name followed by a list of source files or directories. In this case you can call `jh_build` with no jar or source and it will build those jars. The jars will then be removed by `jh_build --clean`. `jh_build` also provides a --clean parameter which should be called in the clean target of debian/rules. It is called for you by `jh_clean` `jh_build` will also create javadoc, but only for the last jar built in each package. It can be installed automatically using `jh_installjavadoc` (see below). jh_installlibs -------------- For library packages Debian Java policy currently requires that the libraries be installed to /usr/share/java in a versioned format and with an unversioned symlink. `jh_installlibs` will take a jar and correctly install it. As with debhelper programs, this can either take a jar as a parameter, or read a list of jars from a file in the Debian directory. It also follows the -p, -i and -a semantics of debhelper for selecting which packages to install the jar to. When operating on a package, `jh_installlibs` will read the list of library jars from debian/package.jlibs or debian/jlibs. The jlibs file is a list of jars to install, one per line, and works exactly the same as listing them on the command line. Each jar is installed to debian/$package/usr/share/java/ in the appropriate versioned and unversioned forms. If the jars built by upstream already contain the version number, this will be stripped before installing. `jh_installlibs` will also try to strip the upstream version number of any dfsg suffix. Other version-mangling options or explicit version numbers can also be provided. jh_depends ---------- `jh_depends` works like `dpkg-shlibdeps`, but for jar files. For each jar in the package it takes the jars on which it depends and finds the packages to which they belong. These are included in the debhelper substvars as ${java:Depends}. The control file can then just list that variable which is filled in automatically. This is done by reading the Class-Path attribute from the manifest of each jar. Jar files should include this attribute to prevent applications which use them from needing a full recursive classpath in their startup scripts and to prevent unneccessary transitions when the library changes its dependencies. If the package is not built with `jh_build` and the upstream build system does not set it correctly then `jh_manifest` or `jh_classpath` can be used to fix this. If the application uses executable jars (see Runtime support below) then `jh_depends` will also add the appropriate depends on jarwrapper and the correct Java runtime. As of version 0.32, `jh_depends` also checks installed javadocs for links to system installed javadocs. It will use this to populate the ${java:Recommends} variable, which can be used for the doc package. Note that both substvars are always created even if they are empty, like debhelper does with ${misc:Depends}. jh_manifest ----------- Many upstream build systems do not set the Class-Path attribute in the jars they create. This leads to several unwanted problems, such as expanding the classpath which applications have to use and introducing unneccessary transitions. They also may not set the Main-Class attribute. Both of these are required for running jars with the -jar parameter. `jh_manifest` can fix the manifest files of jars. It can either read from a manifest file in the Debian directory or run in a mode which updates all the jars with the `CLASSPATH` environment variable. The manifest files can either be debian/package.manifest or debian/manifest. The format of this file is a list of jars and indented below each one a list of manifest elements to set: usr/share/weirdx/weirdx.jar: Main-Class: com.jcraft.weirdx.WeirdX Debian-Java-Home: /usr/lib/jvm/default-java Note: Prior to javahelper 0.32 (0.33 if you used cdbs), `jh_manifest` would be run before `jh_installlibs`. In these versions the jars were usually referred to by their location in the build directories rather than their install location. jh_classpath ------------ If you are just setting the classpath then this command is simpler than `jh_manifest`. `jh_classpath` can either take jars on the command line with the classpath specified on the command line or in the `CLASSPATH` environment variable. Alternatively, it can read classpaths from a debian/classpath or debian/package.classpath file. This should be one jar per line specifying the jar followed by it's space-separated classpath: usr/share/java/bar.jar /usr/share/java/quux.jar usr/share/java/foo.jar /usr/share/java/bar.jar /usr/share/java/baz.jar Note: Prior to javahelper 0.32 (0.33 if you used cdbs), `jh_classpath` would be run before `jh_installlibs`. In these versions the jars were usually referred to by their location in the build directories rather than their install location. jh_exec ------- The Runtime support section below describes running executable jars directly. `jh_exec` will scan package directories for jars in the paths, or symlinks to jar from the paths, and ensure that they have been set executable if necessary. jh_installjavadoc ----------------- If you have javadoc which has been built by your build system, then `jh_installjavadoc` will install it in the correct location and register it with doc-base for you. Either run `jh_installjavadoc` with the directory containing the javadoc as a parameter, or it will read debian/javadoc or debian/$package.javadoc which should contain a single path to the javadoc for that package. If you have used `jh_build` that will automatically have created javadoc. To install that put the string "internal" in the javadoc file and it will be installed. The second parameter, or the second string on the line in the javadoc file, can be used to override the install location, for example, so that a -doc package can install to /usr/share/doc/$library/api. jh_linkjars ----------- If upstream ship convenience copies of third-party jar files which have been removed (see `jh_repack` below), but the build system refers to that directory, `jh_linkjars` can be used to populate the directory with symlinks to the packaged jars in /usr/share/java. It is called either with a directory on the command line or by specifying one target directory per line in the file debian/linkjars. `jh_linkjars` will scan all of the (installed) build-dependencies and create a symlink to every jar which is installed by those packages in the target directory. `jh_linkjars` can be called with -u to remove all the symlinks in the clean target. This is done automatically by `jh_clean`. jh_clean -------- `jh_clean` removes any files which have been created during the build by other `jh_` commands, such as `jh_build` and `jh_linkjars` jh_makepkg ---------- `jh_makepkg` will create template Debian packages for Java programs and libraries similar to `dh-make`. It should be run in the source directory and it will create the orig.tar.gz and most of the files in the Debian directory, which need only small changes neccessary to build the package. Note that `jh_makepkg` is *not* suitable for packages using the `maven` build system. Please consider using `mh_make` intead. jh_repack --------- `jh_repack` provides functionality to help clean your upstream tarball of prebuilt jars, classfiles and javadoc. If you want to do this whenever you download a new version you can use `jh_repack` as a uscan helper. Just put `jh_repack` as the command at the end of the uscan line. E.g. version=3 http://www.matthew.ath.cx/projects/salliere/ (?:.*/)?salliere-?_?([\d+\.]+|\d+)\.(tar.*|tgz|zip|gz|bz2|) debian jh_repack Alternatively you can run it by hand: jh_repack --upstream-version `jh_repack` will remove any .class files, any .jar files, the whole directory tree containing javadoc and any empty directories as a result of the above. java-propose-classpath ---------------------- Some upstreams have complicated classpaths which may not be obvious to the packager when using `jh_manifest` to set the Class-Path attribute. `java-propose-classpath` will unpack a jar and look at the symbols imported to the class files, then scan all the jars in /usr/share/java. This should not be run in the build since it is slow, and there may be ambiguities that the packager must resolve. It is still very useful for the packager as most of the time it will get it right automatically. To avoid bloating the recursive build-deps of packages, `java-propose-classpath` is in a separate package to javahelper. It should not be on any package's build-depends. jh_installeclipse ----------------- `jh_installeclipse` will install eclipse features built by eclipse's pde-build script. It supports most of debhelpers normal options. Features can either be put in the $package.eh-install or be given per command-line. By default `jh_installeclipse` expects pde-build to have been run from debian/.eclipse-build; if you decide to run it from another directory, you should use --pde-build-dir to tell `jh_installeclipse` where pde-build was run from. `jh_installeclipse` knows where pde-build dumps its output, so only the name of the feature should be given. It supports file globbing both in the files and per command-line (though in the latter case your shell may attempt to expand the globs if they are not properly escaped or quoted). Due two the way the underlying build system works; orbit dependencies will be embedded directly into the installation. `jh_installeclipse` will replace any orbit dependencies imported by `jh_generateorbitdir`. If you add/import orbit dependencies yourself through other means, you must replace them yourselves after running `jh_installeclipse`. Finally, `jh_installeclipse` will output a ${orbit:Depends} variable if it replaces any orbit dependency for that package. jh_generateorbitdir ------------------- `jh_generateorbitdir` is an javahelper program that handles creation of an orbit dependency dir. This directory has to be populated with non-eclipse jar files. However, eclipse refers to these jars by their "symbolic name". `jh_generateorbitdir` can extract this name from the jar's manifest (provided it has the OSGi metadata) and create a symlink to it. `jh_generateorbitdir` will replace regular files with symlinks if they are present in the orbit dir and clash with the name of one of the orbit jars. If an orbit jar name clashes with a symlink in the orbit dir, then `jh_generateorbitdir` will assume that the given jar has already been symlinked and skip it. `jh_generateorbitdir` will also check the default installation for jar files on Debian systems (at the time of writing /usr/share/java), if it cannot find the jar in the current dir. If present, `jh_generateorbitdir` will read debian/eclipse.orbitdeps and add the jar files listed in it to the list of orbit dependencies. jh_setupenvironment ------------------- `jh_setupenvironment` is a javahelper program that handles creating an environment for building an eclipse feature. It does not setup an orbit dir (use `jh_generateorbitdir` for that). It will copy files specified in debian/eclipse.environment as well as those given on command line into the environment dir. If no files are given per command line and the environment file is not present (or is empty), it will default to org.eclipse.* jh_compilefeatures ------------------ `jh_compilefeatures` handles compilation of eclipse features. It will read debian/eclipse.features as a list of features to compile and their dependencies. The first item on a line is the id of the feature and the remaining are either ids of previously compiled features or features installed on the system (identified by the folder they are installed in). By default `jh_compilefeatures` will set the source and the target version of the class files to 1.5. This can be overriden by explicitly changing the build options (see man `jh_compilefeatures` for more information). java-vars.mk ------------ You can include /usr/share/javahelper/java-vars.mk in your debian/rules to get the following variables defined: * `JAVA_HOME` If you have not already set it, will default to the default JDK for the architecture (you must depend on default-jdk or -headless if you are not overriding this). To override this set `JAVA_HOME` _before_ including java-vars.mk * `JAVA_ARCH` The JVM version of the build architecture (eg ppc not powerpc) * `JRE_HOME` If `$JAVA_HOME/jre` exists then that, otherwise `$JAVA_HOME` * `JVM_CLIENT_DIR` and `JVM_SERVER_DIR` Set if the respective types of JVM are installed. If you need the Java architecture in a non-make context then you can use /usr/share/javahelper/java-arch.sh instead. Runtime support =============== Javatools also provides some runtime support. Unlike compiled programs, or purely interpreted programs with hash-bang lines, Java programs cannot be directly executed. Many upstreams expect them to be run using java -jar jarname or java classname. This is not generally acceptible in systems which expect to just be able to run the command or launch it from a menu. As a result, many packagers are writing wrapper scripts which just call java with the correct classpath, jar and main class. jarwrapper ---------- There is an alternative to wrapper scripts, however. The binfmt_misc kernel module allows the kernel to call out to a program in userspace to execute specific types of file. jarwrapper registers itself as a handler for executable jars. This is done by reading values from the manifest file. In order for executable jars to work the following attributes must or may be defined in the manifest. These attributes can be set using `jh_build` and `jh_manifest`. * Main-Class: The name of the class to be run when the application starts. (REQUIRED) * Class-Path: The path to all the jar files on which this jar depends. (REQUIRED unless empty) * Debian-Java-Home: A Debian-specific property if this application depends on a specific runtime. Specify the path to the runtime which should be used. Multiple space-separated paths may be given if any of the runtimes will work. (OPTIONAL) * Debian-Java-Parameters: A Debian-specific property if this application needs extra options to the JVM. (OPTIONAL) Java Architecture ----------------- If you need to know the JVM architecture name at runtime (for example to put libjvm.so on the `LD_LIBRARY_PATH`) then jarwrapper also provides /usr/share/jarwrapper/java-arch.sh which will either print the current one or convert a debian arch name to a JVM arch name. Putting it together =================== This section shows the debian packaging generated by `jh_makepkg` for an application and a library using `jh_build`. Sample Library Packaging ------------------------ debian/control Source: jsch Section: java Priority: optional Maintainer: Matthew Johnson Build-Depends: debhelper (>= 7), javahelper, default-jdk, libzlib-java Standards-Version: 3.9.1 Homepage: http://www.jcraft.com/jsch/ Package: libjsch-java Architecture: all Depends: ${java:Depends}, ${misc:Depends} Description: Java secure channel JSch is a pure Java implementation of SSH2. JSch allows you to connect to an sshd server and use port forwarding, X11 forwarding, file transfer, etc., and you can integrate its functionality into your own Java programs. JSch is licensed under a BSD style license. debian/rules #!/usr/bin/make -f export JAVA_HOME=/usr/lib/jvm/default-java export CLASSPATH=/usr/share/java/zlib.jar build: build-stamp build-stamp: dh_testdir jh_build jsch.jar src touch $@ clean: dh_testdir dh_testroot jh_build --clean dh_clean rm -f build-stamp jsch.jar install: build dh_testdir dh_testroot dh_prep dh_installdirs binary-arch: build install # Java packages are arch: all, nothing to do here binary-indep: build install # Create the package here dh_testdir dh_testroot dh_prep dh_install -i jh_installjavadoc -i dh_installdocs -i dh_installchangelogs -i jh_installlibs -i jh_depends -i dh_compress -i dh_fixperms -i dh_installdeb -i dh_gencontrol -i dh_md5sums -i dh_builddeb -i binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install debian/libjsch-java.jlibs jsch.jar debian/libjsch-java.javadoc internal Sample Application Packaging ---------------------------- debian/control Source: salliere Section: misc Priority: optional Maintainer: Matthew Johnson Build-Depends: debhelper (>= 7), default-jdk, libmatthew-debug-java, libcsv-java, libitext-java, javahelper Standards-Version: 3.9.1 Package: salliere Architecture: all Depends: ${java:Depends}, ${misc:Depends} Description: Short Description Long Description debian/rules #!/usr/bin/make -f export JAVA_HOME=/usr/lib/jvm/default-java export CLASSPATH=/usr/share/java/csv.jar:/usr/share/java/debug-disable.jar:/usr/share/java/itext.jar build: build-stamp build-stamp: dh_testdir # Build the package jh_build salliere.jar src touch $@ clean: dh_testdir dh_testroot rm -f build-stamp salliere.jar jh_build --clean dh_clean install: build dh_testdir dh_testroot dh_prep dh_installdirs binary-arch: build install # Java packages are arch: all, nothing to do here binary-indep: build install # Create the package here dh_testdir dh_testroot dh_prep dh_install -i dh_installdocs -i dh_installchangelogs -i jh_manifest -i dh_link -i jh_exec -i jh_depends -i dh_compress -i dh_fixperms -i dh_installdeb -i dh_gencontrol -i dh_md5sums -i dh_builddeb -i binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install debian/salliere.install salliere.jar usr/share/salliere debian/salliere.links usr/share/salliere/salliere.jar usr/bin Using javahelper with CDBS -------------------------- Javahelper 0.18 introduces a CDBS class for javahelper. It runs all the `jh_` commands after `dh_install*` and `dh_link` and has options for running `jh_build` under the build target. The `jh_` commands are invoked once per package. You can pass options to all the invocations using the `JH_EXEC_ARGS`, `JH_INSTALLLIBS_ARGS`, `JH_MANIFEST_ARGS` and `JH_DEPENDS_ARGS` variables. To invoke `jh_build` you must either set `JH_BUILD_JAR` and `JH_BUILD_SOURCE` and `JAVA_HOME` or have a debian/javabuild file and set `JAVA_HOME`. Optionally you can also set `CLASSPATH` and `JH_BUILD_ARGS`. Please note: you _MUST_ include javahelper.mk before ant.mk. The above debian/rules can be rewritten with CDBS as follows: #!/usr/bin/make -f export JAVA_HOME=/usr/lib/jvm/default-java export CLASSPATH=/usr/share/java/csv.jar:/usr/share/java/debug-disable.jar:/usr/share/java/itext.jar JH_BUILD_JAR=salliere.jar JH_BUILD_SRC=src include /usr/share/cdbs/1/class/javahelper.mk Using javahelper with dh ------------------------ Javahelper 0.20 introduces a dh extension for javahelper. It runs all the `jh_` commands after `dh_install*` and `dh_link` and also runs `jh_build` if you have a debian/javabuild file. The above debian/rules can be rewritten with dh 7 as follows: debian/javabuild salliere.jar src debian/rules #!/usr/bin/make -f export JAVA_HOME=/usr/lib/jvm/default-java export CLASSPATH=/usr/share/java/csv.jar:/usr/share/java/debug-disable.jar:/usr/share/java/itext.jar %: dh $@ --with javahelper javatools-0.45ubuntu1/jh_manifest0000775000000000000000000002617612265203313014106 0ustar #!/usr/bin/perl =head1 NAME jh_manifest - Adds or/and modifies manifests for jars =cut use strict; use warnings; use autodie; use Cwd(); use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); use Debian::Debhelper::Dh_Lib; use Debian::Javahelper::Java qw(parse_manifest_fd write_manifest_fd); use Debian::Javahelper::Manifest qw(MAIN_SECTION); =head1 SYNOPSIS B [S>] [S>] I ... I B [S>] [S>] =head1 DESCRIPTION Javahelper tool to add or update manifests in a jar file. It can be used in two modes. If passed jar files, it will only process these jar files. Otherwise it will update all jar files in the packages it acts on. When processing a package, the L exclude option will make B ignore matching jar files. =head1 FILES =over 4 =item debian/I.manifest (or debian/manifest) This file consist of a list of jar files and values to add to their manifests. Values in this file will take precedence over values in the original manifest (and command line arguments over values in this file). It is allowed to list a link in this file instead of an actual jar file, provided that the link can be resolved when B processes it. If a jar file is listed here cannot be found, B will print a warning, unless the jar file has been excluded. As of javahelper >= 0.32, you may add comments in this file. If the line starts with a "#" it is completely ignored. This file is ignored if B is passed jar files via command line. =back =head1 OPTIONS =over 4 =item B<-c> I, B<--classpath=>I Sets the Class-Path attribute of all processed jar files to I. If not passed, then the CLASSPATH environment variable will be used in the given jar file do not have a Class-Path attribute. =item B<-m> I, B<--main=>I Sets the Main-Class attribute to I in all processed jar files. =item B<-o> I, B<--javaopts=>I Sets the Debian-Java-Parameters to I in all processed jar files. This attribute is used by jarwrapper to start java with extra options (e.g. to make more memory available). =item B<-j> I, B<--java-home=>I Sets the Debian-Java-Home attribute to I in all processed jars. This attribute is used by jarwrapper to determine which JVM to use. =back =cut my $cp = ''; my $mcl = ''; my $jvm = ''; my $jopt = ''; my $envcp = 0; init(options => { # -o clashes debhelper's "only scripts" 'javaopts|o=s' => \$jopt, 'java-home|j=s' => \$jvm, 'main|m=s' => \$mcl, 'classpath|c=s' => \$cp, 'version|V' => sub { print STDERR "Version has been removed - please stop using it\n"; exit(0) }, }); if(!$cp && ($ENV{'CLASSPATH'}//q{}) ne q{}){ $cp = $ENV{'CLASSPATH'}; $cp =~ s/:/ /go; $envcp = 1; } if(@ARGV){ my $pkg = $dh{FIRSTPACKAGE}; my $dir = tmpdir($pkg); verbose_print('Assuming targets exists due to --no-act') if $dh{NO_ACT}; foreach my $jar (@ARGV){ my $orig = $jar; my $target = $jar; my $link = 0; # Look for it in $dir if it does not exist directly. unless (-f $target) { # strip any leading / or ./ - it looks better and it # does not accidentally install a system install jar instead. $target =~ s@^\.?/+@@og; # Bail unless $dir/$target exists error("$target: $!") unless -f "$dir/$target"; $target = "$dir/$target"; } if ( -l $jar ){ # Follow links my $dest = Cwd::abs_path($target); error("Cannot resolve link $target: $!") unless $dest; $target = $dest; $link = 1; } # no-act implies others tools are in no-act mode as well error("Cannot update $jar: it does not exist.") unless -f $jar || !$dh{NO_ACT}; if ($link){ verbose_print("Updating symlinked $target (via $orig)"); } else { verbose_print("Updating $target"); } update_jar($target, undef) unless $dh{NO_ACT}; } inhibit_log(); # behave like the old jh_manifest. exit(0); } foreach my $package (@{$dh{DOPACKAGES}}) { my $man = pkgfile($package, 'manifest'); my $dir = tmpdir($package); my $manifests = {}; my $files = {}; my @links = (); my $find_cmd="find $dir "; my $fulldir = Cwd::abs_path($dir); # skip if it does not exist. if( ! -d $dir ){ verbose_print("Skipping $package - $dir does not exist (or is not a dir)."); next; } $manifests = parse_package_file($man) if($man); if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne q{}){ $find_cmd .= qq{ '!' \\( $dh{EXCLUDE_FIND} \\) -a }; } $find_cmd .= q{ -name '*.jar'}; verbose_print($find_cmd); open(my $jarfiles, '-|', $find_cmd); while( my $jar = <$jarfiles> ) { chomp($jar); if( -l $jar ) { $jar =~ s@^\Q$dir\E/*@@; verbose_print("Found symlink $jar"); push(@links, $jar); } else { $jar = Cwd::abs_path($jar); $jar =~ s@^\Q$fulldir\E/*@@; verbose_print("Found $jar"); $files->{$jar} = 1; } } close($jarfiles); # check the links first. foreach my $link (@links) { my $path = Cwd::abs_path("$dir/$link"); my $manifest = $manifests->{$link}; my $lp = $path; next unless(defined($manifest)); error("Cannot modify $link - it is a broken symlink or not possible to resolve,") unless( defined($path) && -e $path ); $lp =~ s@^\Q$fulldir\E/*@@; error("Conflicting manifests for $link (link) and $path,") if(exists($manifests->{$lp})); delete($files->{$lp}); delete($manifests->{$link}); verbose_print("Updating symlinked $path (using manifest for $link)"); update_jar("$path", $manifest) unless $dh{NO_ACT}; } foreach my $jar (keys(%$files)){ my $lp = $jar; my $manifest; $lp =~ s@^\Q$fulldir\E/*@@; $manifest = $manifests->{$lp}; delete($manifests->{$lp}); update_jar("$dir/$lp", $manifest) unless $dh{NO_ACT}; } if (keys(%$manifests) && !$dh{NO_ACT}) { # skip this with no-act, since other tools might be running in no-act # mode as well, so this might be a lot of false-positives. my $count = 0; foreach my $unused (keys(%$manifests)){ unless(excludefile($unused)){ warning("No jar in $package matching $unused."); $count++; } else { verbose_print("Ignoring unused entry for $unused in $package."); } } # Fail if there is at least one unignored unused manifest. exit 1 if $count; } } exit(0); sub parse_package_file{ my $pkgfile = shift; my $manifests = {}; my @jars; my @man; my $inlen = 0; open(my $file, '<', $pkgfile); while( my $line = <$file> ){ chomp($line); next if($line =~ m/^#/o); if($line =~ m/^ \s(\s*) /ox){ error("Manifest data not attached to a jar in $pkgfile") unless(@jars); $inlen = length($1) unless($inlen); $line = substr($line, 1 + $inlen); push(@man, $line); next; } if(@man){ my $mlines = join("\n", @man); my $manifest; open(my $mfd, '<', \$mlines); $manifest = parse_manifest_fd($mfd, $pkgfile); close($mfd); foreach my $j (@jars){ error("Two manifests for $j in $pkgfile,") if(exists($manifests->{$j})); $manifests->{$j} = $manifest; } @man = (); @jars = (); } next if($line eq q{}); if($line =~ m/\.jar:$/o){ $line =~ s@^/*@@o; $line =~ s@//+@/@og; $line =~ s/:$//o; push(@jars, $line); next; } print STDERR "Syntax error in $pkgfile ($line) - perhaps you are missing a \":\"?\n" if($line !~ m/:$/o); error("Unknown line in $pkgfile ($line),"); } if(@man){ my $mlines = join("\n", @man); my $manifest; open(my $mfd, '<', \$mlines); $manifest = parse_manifest_fd($mfd, $pkgfile); close($mfd); foreach my $j (@jars){ $manifests->{$j} = $manifest; } } close($file); return $manifests; } sub update_jar{ my $jar = shift; my $merge = shift; my $zip = Archive::Zip->new(); my $con; my $manifest; my $stat; my $dirty = 0; my $main; my $new_manifest = 0; # stringify or $zip will make a call back that fails. $zip->read( "$jar" ) == AZ_OK or error("Could not read $jar: $!"); ($con, $stat) = $zip->contents( 'META-INF/MANIFEST.MF' ); die("Could not read manifest from $jar ($stat): $!") unless(!defined($stat) || $stat == AZ_OK); if(defined($stat)) { verbose_print("Reading manifest from $jar"); open(my $fd, '<', \$con); $manifest = parse_manifest_fd($fd, $jar); close($fd); } else { verbose_print("$jar does not have a manifest."); $manifest = Debian::Javahelper::Manifest->new(); $new_manifest = 1; } if(defined($merge)){ $manifest->merge($merge); $dirty = 1; } $main = $manifest->get_section(MAIN_SECTION, 1); if($cp && (!$envcp || ($main->get_value('Class-Path')//q{}) eq q{})){ $main->set_value('Class-Path', $cp); $dirty = 1; } if($mcl){ $main->set_value('Main-Class', $mcl); $dirty = 1; } if($jvm){ $main->set_value('Debian-Java-Home', $jvm); $dirty = 1; } if($jopt){ $main->set_value('Debian-Java-Parameters', $jopt); $dirty = 1; } if($dirty){ my $var; my $mem; open(my $fd, '>', \$var); write_manifest_fd($manifest, $fd, $jar); close($fd); verbose_print("Updating manifest in $jar"); $zip->removeMember( 'META-INF/MANIFEST.MF' ) unless($new_manifest); $mem = $zip->addString($var, 'META-INF/MANIFEST.MF'); $mem->desiredCompressionMethod(COMPRESSION_DEFLATED); # This on the other hand may fail. $zip->overwrite() == AZ_OK or error("Writing modified jar ($jar) failed: $!"); } else { verbose_print("No update of $jar required."); } 1; } =head1 EXAMPLES An example debian/manifest file: # use the symlink so we do not have to update with the next upstream release. usr/share/java/my.jar: Class-Path: dep1.jar dep2.jar Main-Class: some.awesome.Class usr/share/java/dep2.jar: Class-Path: dep1.jar =head1 SEE ALSO L This program is a part of javahelper and uses debhelper as backend. There are also tutorials in /usr/share/doc/javahelper. =head1 AUTHOR Niels Thykier =head1 COPYRIGHT AND LICENSE Copyright 2010 by Niels Thykier This tool is free software; you may redistribute it and/or modify it under the terms of GNU GPL 2. =cut javatools-0.45ubuntu1/tests/0000775000000000000000000000000012265205647013033 5ustar javatools-0.45ubuntu1/tests/archs-out0000664000000000000000000000011212265203313014641 0ustar alpha amd64 arm arm arm parisc i386 ia64 mips mipsel ppc s390 s390x sparc javatools-0.45ubuntu1/tests/sample0000664000000000000000000000016012265203313014220 0ustar Manifest-Version: 1.0 Class-Path: /usr/share/java/hexdump.jar Created-By: 1.6.0_06 (Sun Microsystems Inc.) javatools-0.45ubuntu1/tests/onelong-out20000664000000000000000000000056412265203313015277 0ustar Manifest-Version: 1.0 Class-Path: /usr/share/java/usr/share/java/usr/share/java/usr/share/java /usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/j ava/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/shar e/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/hexdu mp.jar Created-By: 1.6.0_06 (Sun Microsystems Inc.) javatools-0.45ubuntu1/tests/archs-in0000664000000000000000000000012012265203313014437 0ustar alpha amd64 arm armeb armel hppa i386 ia64 mips mipsel powerpc s390 s390x sparc javatools-0.45ubuntu1/tests/onelong-in0000664000000000000000000000055312265203313015012 0ustar Manifest-Version: 1.0 Class-Path: /usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/hexdump.jar Created-By: 1.6.0_06 (Sun Microsystems Inc.) javatools-0.45ubuntu1/tests/long-in0000664000000000000000000000105412265203313014305 0ustar Manifest-Version: 1.0 Class-Path: /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar Created-By: 1.6.0_06 (Sun Microsystems Inc.) javatools-0.45ubuntu1/tests/long-out0000664000000000000000000000110512265203313014503 0ustar Manifest-Version: 1.0 Class-Path: /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /u sr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java /hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/ja va/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.ja r /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/ java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump. jar Created-By: 1.6.0_06 (Sun Microsystems Inc.) javatools-0.45ubuntu1/tests/long-out20000664000000000000000000000107112265203313014567 0ustar Manifest-Version: 1.0 Class-Path: /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr /share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexd ump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/sha re/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump. jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/j ava/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar Created-By: 1.6.0_06 (Sun Microsystems Inc.) javatools-0.45ubuntu1/tests/tests.sh0000775000000000000000000000700112265203313014516 0ustar #!/bin/bash -- set -e _DIR=`pwd` . ../jh_lib.sh.in [ "$JAVA_HOME" ] || JAVA_HOME="/usr/lib/jvm/default-java" JAR="$JAVA_HOME/bin/jar" if [ ! -x "$JAR" -a -x "/usr/bin/jar" ] ; then JAR="/usr/bin/jar" fi if readlink "$JAR" | grep -q "fastjar$" ; then echo "fastjar produces different results than we expect." >&2 echo "Skipping test" >&2 exit 0 fi run_jh_manifest() { cd .. echo "Running: perl -I./lib ./jh_manifest \"$@\"" perl -I./lib ./jh_manifest "$@" cd "$_DIR" } # checkmanifest [parameters...] checkmanifest() { error=0 source=$1 verify=$2 shift shift touch foo "$JAR" cfm test.jar $source foo run_jh_manifest "$@" "$_DIR/test.jar" "$JAR" xf test.jar META-INF/MANIFEST.MF if ! diff -u $verify META-INF/MANIFEST.MF > test.diff; then error=1 echo "ERROR: difference detected:" cat test.diff echo echo "Source:" cat $source echo echo "Parameters:" echo "$@" echo echo "Desired:" cat $verify echo echo "Actual:" cat META-INF/MANIFEST.MF fi rm -rf META-INF rm test.jar test.diff foo return $error } #checkextract checkextract() { LINE="`extractline "$1" "$2"`" if [ "$LINE" != "$3" ]; then echo "Failed to extract $2 from $1" echo "Desired: $3" echo "Actual: $LINE" fi } #checkarch input output checkarch() { OUT="`../java-arch.sh "$1"`" if ! [ "$OUT" = "$2" ]; then echo "Failed converting arch $1" echo "Desired $2" echo "Actual $OUT" return 1 fi return 0 } # checkarches inputfile output file checkarches () { i=1 RET=0 for a in `cat "$1"`; do if ! checkarch "$a" "`head -n$i "$2" | tail -n1`" ; then RET=1 fi i=$(( $i + 1 )) done if [ "$RET" != "0" ] ; then echo "TEST FAILED" fi exit $RET } checkmanifest sample sample checkmanifest long-in long-out checkmanifest onelong-in onelong-out checkmanifest sample long-out2 --classpath="/usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar" checkmanifest sample onelong-out2 --classpath=/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/hexdump.jar checkextract onelong-out2 Class-Path /usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/hexdump.jar checkextract long-out2 Class-Path "/usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar /usr/share/java/hexdump.jar" checkarches archs-in archs-out javatools-0.45ubuntu1/tests/onelong-out0000664000000000000000000000057312265203313015215 0ustar Manifest-Version: 1.0 Class-Path: /usr/share/java/usr/share/java/usr/share/java/usr/share/ja va/usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/sh are/java/usr/share/java/usr/share/java/usr/share/java/usr/share/java/ usr/share/java/usr/share/java/usr/share/java/usr/share/java/usr/share /java/hexdump.jar Created-By: 1.6.0_06 (Sun Microsystems Inc.) javatools-0.45ubuntu1/jh_depends.10000664000000000000000000000211012265203313014034 0ustar .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. .TH JAVAHELPER "1" "January 2008" "Javahelper Version 0.5" "User Commands" .SH NAME Javahelper \- Part of the Java Helper packaging tools Refer to the tutorials in /usr/share/doc/javahelper for more detail .SH SYNOPSIS .B jh_depends [\fIoptions\fR] .SH OPTIONS .HP \fB\-h\fR \fB\-\-help\fR: show this text .HP \fB\-V\fR \fB\-\-version\fR: print the version .HP \fB\-p\fR \fB\-\-package=\fR: package to act on (default=all) .HP \fB\-P\fR \fB\-\-tmpdir=\fR: package directory (default=$CWD/debian/package) .HP \fB\-v\fR \fB\-\-verbose\fR: show more information while running .HP \fB\-i\fR \fB\-\-indep\fR: work on all indep packages .HP \fB\-a\fR \fB\-\-arch\fR: work on all arch\-specific packages .HP \fB\-n\fR \fB\-\-no\-act\fR: don't actually do anything, just print the results .HP \fB\-j[\fR] \fB\-\-jvm[=\fR]: Options are: default, headless, gcj, open. May be a space-separated list .HP \fB\-X[\fR] \fB\-\-exclude[=\fR]: Don't include this package in depends javatools-0.45ubuntu1/jh_linkjars.10000664000000000000000000000123012265203313014231 0ustar .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. .TH JAVAHELPER "1" "January 2008" "Javahelper Version 0.5" "User Commands" .SH NAME Javahelper \- Part of the Java Helper packaging tools Refer to the tutorials in /usr/share/doc/javahelper for more detail .SH SYNOPSIS .B jh_installlibs [\fIoptions\fR] [\fIjars\fR] .SH OPTIONS .HP \fB\-h\fR \fB\-\-help\fR: show this text .HP \fB\-V\fR \fB\-\-version\fR: show the version .HP \fB\-v\fR \fB\-\-verbose\fR: show more information while running .HP \fB\-n\fR \fB\-\-no\-act\fR: don't actually do anything, just print the results .HP \fB\-u\fR \fB\-\-unlink\fR: Remove the links rather than adding them javatools-0.45ubuntu1/jh_exec.10000664000000000000000000000157012265203313013347 0ustar .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. .TH JAVAHELPER "1" "January 2008" "Javahelper Version 0.5" "User Commands" .SH NAME Javahelper \- Part of the Java Helper packaging tools Refer to the tutorials in /usr/share/doc/javahelper for more detail .SH SYNOPSIS .B jh_exec [\fIoptions\fR] .SH OPTIONS .HP \fB\-h\fR \fB\-\-help\fR: show this text .HP \fB\-V\fR \fB\-\-version\fR: print the version .HP \fB\-i\fR \fB\-\-indep\fR: run for all Arch: all packages .HP \fB\-a\fR \fB\-\-arch\fR: run for all Arch\-specific packages .HP \fB\-p\fR \fB\-\-package=\fR: package to act on (default=all) .HP \fB\-P\fR \fB\-\-tmpdir=\fR: package directory (default=$CWD/debian/package) .HP \fB\-v\fR \fB\-\-verbose\fR: show more information while running .HP \fB\-n\fR \fB\-\-no\-act\fR: don't actually do anything, just print the results javatools-0.45ubuntu1/jh_makepkg0000775000000000000000000002433212265203313013707 0ustar #!/bin/bash -- # options: # make, maven, ant, byhand # app, library # gcj COMPAT=8 STANDARDS=3.9.3 set -e . /usr/share/javahelper/jh_lib.sh syntax() { echo -e "Usage: jh_makepkg [options]" echo -e "Options:" echo -e "\t-h --help: show this text" echo -e "\t-V --version: show the version" echo -e "\t-p --package=: Set the name of the package (defaults to directory name without version)" echo -e "\t-m --maintainer=: Set the maintainer name (defaults to DEBFULLNAME, NAME, or the user's full name)" echo -e "\t-e --email=: Set the maintainer email (defaults to DEBEMAIL EMAIL or user@host)" echo -e "\t-v --upstream=: Set the upstream version (defaults to the directory name after a -)" echo -e "\t-c --clean: Tidy up common problems with Java source packages. Removes .class, .jar files and pre-built javadoc trees before creating the orig.tar.gz" echo -e "\tPick One:" echo -e "\t-l --library: This is a library package" echo -e "\t-a --app: This is an application package" echo -e "\tPick One:" echo -e "\t-t --ant: Builds with ant" echo -e "\t-M --maven: Builds with maven (deprecated, use mh_make instead)" echo -e "\t-k --makefiles: Builds with make" echo -e "\t-n --none: Create own buildsystem" echo -e "\tPick One:" echo -e "\t-g --gcj: Build with gcj" echo -e "\t-d --default: Build with default free platform compiler" echo -e "\t-o --openjdk: Build with openjdk 6" echo -e "\t-o7 --openjdk7: Build with openjdk 7" echo -e "Environment Variables:" echo -e "\tDEBEMAIL: Default maintainer email address" echo -e "\tEMAIL: Default maintainer email address" echo -e "\tDEBFULLNAME: Default maintainer name" echo -e "\tNAME: Default maintainer name" exit 1 } maven_not_supported() { echo "Sorry, but jh_makepkg is not good at generating package templates" >&2 echo "for maven based packages." >&2 echo >&2 echo "Please consider using mh_make instead" >&2 exit 1 } ARGS="p package m maintainer e email v upstream l library a app t ant k makefile n none g gcj o openjdk o7 openjdk7 M maven d default" parseargs "$@" if [ -n "`getarg M maven`" ]; then maven_not_supported fi BUILDDIR="`pwd`" if [ -z "`getarg v upstream`" ]; then VERSION="`basename "$BUILDDIR" | sed -n 's/^.*-//p'`" else VERSION="`getarg v upstream`" fi if [ -z "`getarg p package`" ]; then PACKAGE="`basename "$BUILDDIR" | sed -n 's/\(-.*\)\{0,1\}$//p'`" else PACKAGE="`getarg p package`" fi if [ -z "$VERSION" ]; then echo "Can't determine version from directory name `basename "$BUILDDIR"`, maybe it is not in the form package-version?" exit 1 fi if [ -z "$PACKAGE" ]; then echo "Can't determine package name from directory name `basename "$BUILDDIR"`, maybe it is not in the form package-version?" exit 1 fi if [ ! -f ../${PACKAGE}_${VERSION}.orig.tar.gz ]; then if [ -n "`getarg c clean`" ]; then echo "Cleaning up source tree before creating orig.tar.gz" find . -name '*.class' -print0 | xargs -0 rm -f find . -name '*.jar' -print0 | xargs -0 rm -f IFS=' ' for doctree in `find . -name allclasses-frame.html`; do TREE="`dirname $doctree`" rm -rf "$TREE"/* done find * -type d -print0 | xargs -0 rmdir -p --ignore-fail-on-non-empty fi echo "Creating package $PACKAGE version $VERSION." echo echo "Building from source in $BUILDDIR" cd .. echo "Creating orig source tarball: ${PACKAGE}_${VERSION}.orig.tar.gz" tar zcf "${PACKAGE}_${VERSION}.orig.tar.gz" "`basename "$BUILDDIR"`" cd "$BUILDDIR" fi if [ -n "`getarg e email`" ]; then DEBEMAIL="`getarg e email`" fi if [ -z "$DEBEMAIL" ]; then DEBEMAIL="$EMAIL" fi if [ -z "$DEBEMAIL" ] && [ -f /etc/mailname ]; then DEBEMAIL="`whoami`@`cat /etc/mailname`" fi if [ -z "$DEBEMAIL" ]; then DEBEMAIL="`whoami`@`hostname --fqdn`" fi if [ -n "`getarg m maintainer`" ]; then DEBFULLNAME="`getarg m maintainer`" fi if [ -z "$DEBFULLNAME" ]; then DEBFULLNAME="$NAME" fi if [ -z "$DEBFULLNAME" ] ; then DEBFULLNAME="$(getent passwd $(whoami) | cut -d: -f5 | cut -d, -f1)" fi echo "Packager: $DEBFULLNAME <$DEBEMAIL>" echo if [ -n "`getarg a app`" ]; then TYPE="app" elif [ -n "`getarg l library`" ]; then TYPE="lib" else echo "What type of package is it? Application, or Library?" echo "Select:" echo -e "\t[A] Application (Default)" echo -e "\t[L] Library" echo -n "[Al] $ " read t echo case $t in "L"|"l") TYPE="lib" echo "Selected: Library" ;; *) TYPE="app" echo "Selected: Application" ;; esac fi case $TYPE in "app") SECTION=misc SRCPACKAGE="$PACKAGE" BINPACKAGE="$PACKAGE" ;; "lib") SECTION=java SRCPACKAGE="$PACKAGE" BINPACKAGE="$PACKAGE" if ! echo $BINPACKAGE | grep "^lib" >/dev/null; then BINPACKAGE="lib$BINPACKAGE" fi if ! echo $BINPACKAGE | grep -- "-java$" >/dev/null; then BINPACKAGE="$BINPACKAGE-java" fi ;; esac if [ -n "`getarg t ant`" ]; then BUILD="ant" elif [ -n "`getarg k makefiles`" ]; then BUILD="make" elif [ -n "`getarg n none`" ]; then BUILD="byhand" else echo "What type of build system does it have? Ant, Makefiles, or None?" echo "Select:" echo -e "\t[A] Ant" echo -e "\t[M] Makefiles" echo -e "\t[V] Maven" echo -e "\t[N] None---make one for me (Default)" echo -n "[Namv] $ " read t echo case $t in "A"|"a") BUILD="ant" echo "Selected: Ant" ;; "M"|"m") BUILD="make" echo "Selected: Makefiles" ;; "V"|"v") BUILD="maven" echo "Selected: Maven" ;; *) BUILD="byhand" echo "Selected: No upstream build system" ;; esac fi case $BUILD in "make") ;; "ant") DEPENDS="$DEPENDS, ant" ;; "maven") maven_not_supported ;; "byhand") ;; esac if [ -n "`getarg d default`" ]; then COMP="default" elif [ -n "`getarg g gcj`" ]; then COMP="gcj" elif [ -n "`getarg o openjdk`" ]; then COMP="open" elif [ -n "`getarg o7 openjdk7`" ]; then COMP="open7" else echo "Which Java runtime does it need? Which free runtime?" echo "Select:" echo -e "\t[F] Default Free compiler/runtime (Default)" echo -e "\t[G] GCJ" echo -e "\t[o] OpenJDK 6" echo -e "\t[o7] OpenJDK 7" echo -n "[FGoo7] $ " read t echo case $t in "O"|"o") COMP="open" echo "Selected: OpenJDK 6" ;; "O7"|"o7") COMP="open7" echo "Selected: OpenJDK 7" ;; "g"|"G") COMP="gcj" echo "Selected: GCJ" ;; *) COMP="default" echo "Selected: Default Free compiler" ;; esac fi case $COMP in "gcj") COMPILER=gcj-jdk JAVA_HOME=/usr/lib/jvm/java-gcj ;; "default") COMPILER=default-jdk JAVA_HOME=/usr/lib/jvm/default-java ;; "open") COMPILER=openjdk-6-jdk JAVA_HOME="/usr/lib/jvm/java-6-openjdk-\$(shell dpkg-architecture -qDEB_HOST_ARCH)" JVM=open ;; "open7") COMPILER=openjdk-7-jdk JAVA_HOME="/usr/lib/jvm/java-7-openjdk-\$(shell dpkg-architecture -qDEB_HOST_ARCH)" JVM=open7 ;; esac YEAR=$(date +%Y) mkdir -p debian mkdir debian/source echo '3.0 (quilt)' > debian/source/format cat > debian/control < Build-Depends: debhelper (>= $COMPAT), $COMPILER, javahelper (>= $JAVATOOLS_VERSION) $DEPENDS Standards-Version: $STANDARDS Homepage: Package: $BINPACKAGE Architecture: all Depends: \${java:Depends}, \${misc:Depends} Recommends: \${java:Recommends} Description: Short Description Long Description END if [ "$TYPE" = "lib" ] ; then # add doc package template cat >> debian/control < debian/copyright </] Upstream-Name: [THE NAME UPSTREAM USES FOR THE SOFTWARE] Upstream-contact: [THE PREFERRED ADDRESS(ES) TO REACH THE UPSTREAM PROJECT] Source: [AN EXPLANATION FROM WHERE THE UPSTREAM SOURCE CAME FROM. TYPICALLY AN URL] [OTHER FIELDS] Files: * Copyright: Copyright $YEAR John Doe License: [STANDARD ABBREVIATION -- SEE "Short names" SECTION OF SPECIFICATION] [LICENSE TEXT] Files: debian/* Copyright: Copyright $YEAR $DEBFULLNAME <$DEBEMAIL> License: [STANDARD ABBREVIATION] [LICENSE TEXT] [OTHER FILE PARAGRAPHS] END echo $COMPAT > debian/compat EDITOR=true DEBFULLNAME="$DEBFULLNAME" DEBEMAIL="$DEBEMAIL" dch --create --package $SRCPACKAGE --newversion ${VERSION}-1 --distribution unstable --urgency low cat > debian/rules <> debian/rules < debian/javabuild ;; esac case $TYPE in "app") echo "$SRCPACKAGE.jar usr/share/$BINPACKAGE" > debian/$BINPACKAGE.install cat >> debian/$BINPACKAGE.manifest < Debian-Java-Home: $JAVA_HOME END echo "usr/share/$BINPACKAGE/$SRCPACKAGE.jar usr/bin/$SRCPACKAGE" > debian/$BINPACKAGE.links ;; "lib") echo "$SRCPACKAGE.jar" > debian/$BINPACKAGE.jlibs if [ "$BUILD" = "byhand" ]; then echo "internal" > debian/$BINPACKAGE-doc.javadoc else echo "" > debian/$BINPACKAGE-doc.javadoc fi ;; esac chmod +x debian/rules echo "Packaging created. You will have to edit most or all of the files in debian/ before it works" javatools-0.45ubuntu1/jh_clean.pod0000664000000000000000000000067212265203313014131 0ustar =head1 NAME jh_clean - Cleans up after javahelper commands. =head1 SYNOPSIS jh_clean [I] =head1 DESCRIPTION jh_clean cleans up after javahelper commands and should be run as a part of the clean rule. All options passed to jh_clean will be passed to L. =head1 SEE ALSO L Javahelper also have tutorials in /usr/share/doc/javahelper. Please refer to these for the full documentation of jh_clean. =cut javatools-0.45ubuntu1/jh_classpath.10000664000000000000000000000212412265203313014401 0ustar .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. .TH JAVAHELPER "1" "January 2008" "Javahelper Version 0.5" "User Commands" .SH NAME Javahelper \- Part of the Java Helper packaging tools Refer to the tutorials in /usr/share/doc/javahelper for more detail .SH SYNOPSIS .B jh_classpath [\fIoptions\fR] [\fI \fR...] .SH OPTIONS .HP \fB\-h\fR \fB\-\-help\fR: show this text .HP \fB\-v\fR \fB\-\-verbose\fR: show more information while running .HP \fB\-V\fR \fB\-\-version\fR: print the version .HP \fB\-n\fR \fB\-\-no\-act\fR: don't actually do anything, just print the results .SS "When reading manifest files for packages:" .HP \fB\-i\fR \fB\-\-indep\fR: run for all Arch: all packages .HP \fB\-a\fR \fB\-\-arch\fR: run for all Arch\-specific packages .HP \fB\-p\fR \fB\-\-package=\fR: package to act on (default=all) .HP \fB\-P\fR \fB\-\-tmpdir=\fR: package directory (default=$CWD/debian/package) .SS "When acting on a jar from the command line:" .HP \fB\-c\fR \fB\-\-classpath=\fR: The classpath to set (space separated) .HP