This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "UNNAMED PROJECT".
The branch, policy-dc10 has been updated via fcfda69b7e116b0575cb7644da072be9ca8748b0 (commit) from a0a89afdee5c5050b56bab7266d90f4b99e61c78 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fcfda69b7e116b0575cb7644da072be9ca8748b0 Author: Niels Thykier <ni...@thykier.net> Date: Thu Sep 30 16:34:20 2010 +0200 Make jh_manifest rewrite Class-Path if it points to a symlink. ----------------------------------------------------------------------- Summary of changes: jh_manifest | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 99 insertions(+), 0 deletions(-) diff --git a/jh_manifest b/jh_manifest index ce40882..cd003c1 100755 --- a/jh_manifest +++ b/jh_manifest @@ -84,6 +84,15 @@ Sets the Debian-Java-Home attribute to I</path/to/java/home> in all processed jars. This attribute is used by jarwrapper to determine which JVM to use. +=item B<--classpath-rewrite>, B<--no-classpath-rewrite> + +Whether jh_manifest should rewrite the values of Class-Path to include +"SONAME". By default it will do this (after applying any changes to +Class-Path). + +That is myjar.jar will be rewritten to (e.g.) myjar-X.jar if this is +enabled and myjar.jar is a symlink to myjar-X.jar. + =back =cut @@ -93,6 +102,9 @@ my $mcl = ''; my $jvm = ''; my $jopt = ''; my $envcp = 0; +my $cprw = 1; +my @packages; +my @incdir = ('/usr/share/java'); init(options => { # -o clashes debhelper's "only scripts" @@ -101,6 +113,7 @@ init(options => { "main|m=s" => \$mcl, "classpath|c=s" => \$cp, "version|V" => sub { print STDERR "Version has been removed - please stop using it\n"; exit(0) }, + "classpath-rewrite!" => \$cprw, }); if(!$cp && ($ENV{'CLASSPATH'}//'') ne ''){ @@ -109,6 +122,8 @@ if(!$cp && ($ENV{'CLASSPATH'}//'') ne ''){ $envcp = 1; } +...@packages = getpackages('both'); + if(@ARGV){ foreach my $jar (@ARGV){ update_jar($jar, undef); @@ -241,6 +256,87 @@ sub parse_package_file{ return $manifests; } +sub resolve_link{ + my $jar = shift; + my $link = shift; + my $reldir = shift//''; + my $tmp = shift//''; + my $target; + my $path; + my $patht; + $tmp .= "/" if($tmp); + if($reldir){ + return $link if( -e "$tmp$reldir/$link" && ! -l "$tmp$reldir/$link"); + $target = readlink("$tmp$reldir/$link"); + if($target = m@/@o){ + $reldir =~ s@/$@@og; + $path = "$reldir/$link"; + $patht = "$reldir/$target"; + } else { + # FIXME: Handle fishy links more gracefully (e.g. like normal relative symlinks). + # "Fishy" link (a.jar -> ../$something/a-1.jar) + # Resolve as absolute link + $link = "$reldir/$link"; + $reldir = ''; + } + } + if(!$reldir){ + return $link if( -e "$tmp$link" && ! -l "$tmp$link"); + $target = Cwd::abs_path("$tmp$link"); + $path = $link; + $patht = $target; + } + error("$tmp$path is a broken symlink or not possible to resolve, $!") + unless(defined($target) && (-e "$tmp$patht" || -e $patht)); + verbose_print("Rewriting $link to $target (in $jar)"); + return $target; +} + +sub rewrite_classpath{ + my $jar = shift; + my $cp = shift; + my $target; + my $rel = 0; + if( -e $cp ){ + return resolve_link($jar, $cp); + } + foreach my $inc (@incdir){ + if( -e "$inc/$cp" ){ + return resolve_link($jar, $cp, $inc); + } + } + # $cp definitely do not point to a system installed library + # but it could point to a library in a package we are currently working with. if( -e $cp || -e "/usr/share/java/$cp" ){ + foreach my $pkg (@packages){ + my $ptmpdir = tmpdir($pkg); + # Skip if it does not exists + next unless( -d $ptmpdir ); + $ptmpdir = Cwd::abs_path($ptmpdir) or error("Cannot resolve the path to the tempdir of $pkg,"); + if( -e "$ptmpdir/$cp"){ + return resolve_link($jar, $cp, '', $ptmpdir); + } + foreach my $inc (@incdir){ + if( -e "$ptmpdir/$inc/$cp" ){ + return resolve_link($jar, $cp, $inc, $ptmpdir); + } + } + } + error("Cannot find a jar matching $cp for $jar"); +} + +sub update_jar_classpath{ + my $jar = shift; + my $main = shift; + my $cp = $main->get_value('Class-Path')//''; + my @cpl; + my @ncp; + return 0 unless($cp); + @cpl = split(/\s++/o, $cp); + @ncp = map {$_ = rewrite_classpath($jar, $_) } @cpl; + $main->set_value('Class-Path', join(' ', @ncp)); + return 1; +} + sub update_jar{ my $jar = shift; my $merge = shift; @@ -286,6 +382,9 @@ sub update_jar{ $main->set_value('Debian-Java-Parameters', $jopt); $dirty = 1; } + if($cprw){ + $dirty = update_jar_classpath($jar, $main); + } if($dirty){ my $var; my $mem; hooks/post-receive -- UNNAMED PROJECT _______________________________________________ pkg-java-commits mailing list pkg-java-comm...@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/pkg-java-commits