[SCM] UNNAMED PROJECT branch, master, updated. 0.30-16-g10f7495

Niels Thykier nthykier-guest at alioth.debian.org
Tue Jun 29 15:04:28 UTC 2010


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, master has been updated
       via  10f7495f4eb4a13d3070b60157a143d275dbf420 (commit)
       via  a6d636be9e6e5f348254bf1ae6bb9d9cc4052c9d (commit)
       via  d361255ee7c7f2ee14e53cf45786343f260fc5a9 (commit)
      from  a67b191945a2c1a53fc9ff861f93d07ddcb7aa0b (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 10f7495f4eb4a13d3070b60157a143d275dbf420
Author: Niels Thykier <niels at thykier.net>
Date:   Tue Jun 29 17:04:21 2010 +0200

    Updated changelog.

commit a6d636be9e6e5f348254bf1ae6bb9d9cc4052c9d
Author: Niels Thykier <niels at thykier.net>
Date:   Tue Jun 29 17:02:54 2010 +0200

    Renamed installZippedFeature to install_zipped_feature - fits naming convention of other perl modules.

commit d361255ee7c7f2ee14e53cf45786343f260fc5a9
Author: Niels Thykier <niels at thykier.net>
Date:   Tue Jun 29 17:02:09 2010 +0200

    Added Java module to scan javadocs.

-----------------------------------------------------------------------

Summary of changes:
 Eclipse.pm                |   14 +++--
 Java.pm                   |  159 +++++++++++++++++++++++++++++++++++++++++++++
 debian/changelog          |    3 +
 debian/javahelper.install |    1 +
 debian/rules              |    1 +
 jh_compilefeatures        |    7 +-
 jh_installeclipse         |    2 +-
 7 files changed, 178 insertions(+), 9 deletions(-)

diff --git a/Eclipse.pm b/Eclipse.pm
index 02f0d3d..80f453c 100644
--- a/Eclipse.pm
+++ b/Eclipse.pm
@@ -13,7 +13,7 @@ use Debian::Debhelper::Dh_Lib('error', 'doit');
 use Exporter;
 use vars qw(@ISA @EXPORT);
 @ISA = qw(Exporter);
- at EXPORT = qw(EOB_SYM_NAME EOB_BUNDLE_VERSION EOB_SYS_JAR &installZippedFeature);
+ at EXPORT = qw(EOB_SYM_NAME EOB_BUNDLE_VERSION EOB_SYS_JAR &install_zipped_feature);
 
 =head1 SYNOPSIS
 
@@ -25,15 +25,19 @@ use vars qw(@ISA @EXPORT);
      EOB_SYS_JAR  => '/usr/share/java/commons-net2.jar'});
  #...
  # Install the feature to "$dropins/$name"
- installZippedFeature($zip, "$dropins/$name");
+ install_zipped_feature($zip, "$dropins/$name");
  #  and symlink the following orbitdeps.
- installZippedFeature($zip, "$dropins/$name", @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)
@@ -67,7 +71,7 @@ Only valid for an orbit dependency and cannot be used with manifests.
 
 =over 4
 
-=item installZippedFeature($fzip, $loc[, $orbitdeps[, $package, $needs]])
+=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 
@@ -103,7 +107,7 @@ use constant {
     
 };
 
-sub installZippedFeature{
+sub install_zipped_feature{
     my $fzip = shift;
     my $loc = shift;
     my $orbitdeps = shift//[];
diff --git a/Java.pm b/Java.pm
new file mode 100644
index 0000000..5829a21
--- /dev/null
+++ b/Java.pm
@@ -0,0 +1,159 @@
+package Java;
+
+=head1 NAME
+
+Debian::Javahelper::Java - Javahelper core library.
+
+=cut
+
+use strict;
+use warnings;
+
+use Cwd 'abs_path';
+use File::Spec;
+use Exporter;
+use vars qw(@ISA @EXPORT);
+ at ISA = qw(Exporter);
+ at EXPORT = qw(scan_javadoc find_package_for_existing_files);
+
+=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</usr/share/doc> and it also makes an assumption that the linked
+javadoc is in /usr/share/doc/<package>/<dir-or-symlink>. Of course,
+all Java Policy compliant packages provide their javadoc from there.
+
+If /usr/share/doc/<package>/<dir-or-symlink> appears to be a symlink,
+then it is followed (except for default-jdk-doc).
+
+=item find_package_for_existing_files(@files)
+
+Consults L<dpkg(1)> 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 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") or die("$docloc/$pack: $!");
+	# For each html file in $dir
+	foreach my $file ( grep { m/\.html$/iox } readdir($dir)){
+	    open(my $htfile, "<", "$docloc/$pack/$file") or
+		die("$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 link target ($target).\n";
+		    next;
+		}
+		# Follow the link (unless it is default-jdk-doc)
+		if( -l "/usr/share/doc/$packname/$apif" && $packname ne 'default-jdk-doc'){
+		    my $ltarget = abs_path("/usr/share/doc/$packname/$apif");
+		    $phash{$ltarget} = 1;
+		    next;
+		}
+		#print STDERR "$target -> ($packname, $apif)\n" unless(exists($debpack{"/usr/share/doc/$packname/$apif"}));	
+		$phash{"/usr/share/doc/$packname/$apif"} = 1;
+	    }
+	}
+	closedir($dir);
+    }
+    return keys(%phash);
+}
+
+sub slurp_file{
+    my $file = shift;
+    my @data;
+    open(my $handle, "<", $file) or die("$file: $!");
+    while(my $line = <$handle> ){
+	chomp($line);
+	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 " . join(" ", @_)) or die("Cannot run 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);
+}
+
+1;
+__END__
+
+=head1 AUTHOR
+
+Niels Thykier <niels at thykier.net>
+
+=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
diff --git a/debian/changelog b/debian/changelog
index 8b3f7b0..e7d37de 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,9 @@
 javatools (0.32) UNRELEASED; urgency=low
 
   * Fixed quoting issue in jh_compilefeatures.
+  * Created Debian::Javahelper::Java perl module to assist jh_depends
+    with finding linked javadocs.
+  * Renamed a function in the Eclipse module.
 
  -- Niels Thykier <niels at thykier.net>  Wed, 23 Jun 2010 16:16:59 +0200
 
diff --git a/debian/javahelper.install b/debian/javahelper.install
index 5754d36..0f42717 100644
--- a/debian/javahelper.install
+++ b/debian/javahelper.install
@@ -20,3 +20,4 @@ javahelper.mk /usr/share/cdbs/1/class
 javahelper.pm /usr/share/perl5/Debian/Debhelper/Sequence
 eclipse_helper.pm /usr/share/perl5/Debian/Debhelper/Sequence
 Eclipse.pm /usr/share/perl5/Debian/Javahelper/
+Java.pm /usr/share/perl5/Debian/Javahelper/
diff --git a/debian/rules b/debian/rules
index 6f450ba..c9b6a48 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,6 +17,7 @@ override_dh_auto_build:
 	$(POD2MAN) jh_compilefeatures tmp/jh_compilefeatures.1
 	$(POD2MAN) -s 1 jh_clean.pod tmp/jh_clean.1
 	$(POD2MAN) Eclipse.pm tmp/Debian::Javahelper::Eclipse.3
+	$(POD2MAN) Java.pm tmp/Debian::Javahelper::Java.3
 	# jarwrapper pod-based manpages
 	$(POD2MAN) -s 1 jarwrapper.pod tmp.jarwrapper/jarwrapper.1
 	$(POD2MAN) -s 1 jardetector.pod tmp.jarwrapper/jardetector.1
diff --git a/jh_compilefeatures b/jh_compilefeatures
index 779661d..9b860f7 100755
--- a/jh_compilefeatures
+++ b/jh_compilefeatures
@@ -7,8 +7,9 @@ jh_compilefeatures - Compiles eclipse features using pde-build.
 =cut
 
 use strict;
-use Cwd;
+use Cwd();
 use Debian::Debhelper::Dh_Lib;
+use Debian::Javahelper::Eclipse;
 
 =head1 SYNOPSIS
 
@@ -162,7 +163,7 @@ if( -e $ffile){
 error("$pdebdir does not exist") if(scalar(@ARGV) + scalar(@features) > 0 && ! -d $pdebdir);
 
 foreach my $arg (@ARGV){
-    compile($arg, split(/\s+/, $fdeps));
+    compile($arg, split(/\s+/o, $fdeps));
 }
 
 foreach my $feat (@features){
@@ -180,7 +181,7 @@ sub compile{
 	foreach my $s qw(. .zip .ZIP) {
 	    my $zip = "$pdebdir/$d$s";
 	    if( -e $zip ){
-		installZippedFeature($zip, "$pdebdir/build/SDK");
+		install_zipped_feature($zip, "$pdebdir/build/SDK");
 		next DEP_LOOP;
 	    }
 	}
diff --git a/jh_installeclipse b/jh_installeclipse
index 6b6f107..24433db 100755
--- a/jh_installeclipse
+++ b/jh_installeclipse
@@ -127,7 +127,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 		    last;
 		}
 	    }
-	    installZippedFeature($zip, "$dropins/$dname", \@orbitdeps, $package, \%needed);
+	    install_zipped_feature($zip, "$dropins/$dname", \@orbitdeps, $package, \%needed);
 	}
     }
 }


hooks/post-receive
-- 
UNNAMED PROJECT



More information about the pkg-java-commits mailing list