[csw-devel] SF.net SVN: gar:[17077] csw/mgar/pkg/cpan/makemake

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Fri Feb 17 23:19:44 CET 2012


Revision: 17077
          http://gar.svn.sourceforge.net/gar/?rev=17077&view=rev
Author:   dmichelsen
Date:     2012-02-17 22:19:44 +0000 (Fri, 17 Feb 2012)
Log Message:
-----------
cpan/makemake: Add license detection and automatic stub catalog names

Modified Paths:
--------------
    csw/mgar/pkg/cpan/makemake

Modified: csw/mgar/pkg/cpan/makemake
===================================================================
--- csw/mgar/pkg/cpan/makemake	2012-02-17 17:57:09 UTC (rev 17076)
+++ csw/mgar/pkg/cpan/makemake	2012-02-17 22:19:44 UTC (rev 17077)
@@ -12,6 +12,10 @@
 use version 0.77; # get latest bug-fixes and API
 use Data::Dumper;
 
+# For online retreival of catalogname for package
+use LWP::UserAgent;
+use JSON;
+
 # TBD:
 # [10:14] El_Che: no fix for require, but it gives you filenames of the source
 # [10:16] Dagobert: Ahhhh.... sorry, I missed that
@@ -275,8 +279,16 @@
 print MF "CATALOG_RELEASE = unstable\n";
 print MF "\n";
 
+foreach (qw(LICENSE LICENSE.LGPL COPYING Copying COPYRIGHT Artistic ARTISTIC GPL)) {
+  if( -f "$distdir/$_" ) {
+    print MF "LICENSE = $_\n\n";
+    last;
+  }
+}
+
 print MF "PACKAGES += $cswpkg\n";
 print MF "CATALOGNAME_$cswpkg = $cswcatalog\n";
+print MF "SPKG_DESC_$cswpkg = $description\n";
 
 # Do we have the package in the catalog and has it the same name?
 # dam at login [login]:/home/dam >  curl -s http://buildfarm.opencsw.org/pkgdb/rest/catalogs/current/sparc/SunOS5.9/pkgnames/CSWvim/
@@ -290,6 +302,42 @@
   print MF "RUNTIME_DEP_PKGS_$cswpkg += $p\n";
 }
 
+# Is this an obsoletion for an old package?
+my @oldpkgs = mod2pkg( $modname );
+if( @oldpkgs > 1 ) {
+  print STDERR "ERROR: More than one package for module '$modname' found: @oldpkgs\n";
+}
+my $oldpkg = shift @oldpkgs;
+if( $oldpkg ne $cswpkg ) {
+  print MF "OBSOLETED_BY_$cswpkg += $oldpkg\n";
+
+  my $ua = LWP::UserAgent->new;
+  $ua->timeout(300);
+  $ua->proxy(['http', 'ftp'], 'http://proxy:3128' );
+
+  my $catalog = "unstable";
+  my $arch = "sparc";
+  my $rel = "SunOS5.10";
+  
+  my $url = "http://buildfarm.opencsw.org/pkgdb/rest/catalogs/$catalog/$arch/$rel/pkgnames/$oldpkg/";
+
+  my $response = $ua->get( $url );
+
+  if ($response->is_success) {
+    my $json_string = $response->decoded_content;  # or whatever
+    if( $json_string eq "null" ) {
+      print "Couldn't find package $oldpkg in $catalog:$arch:$rel\n";
+    } else {
+      my $data = decode_json $json_string;
+      my $cname = $data->{catalogname};
+      print MF "CATALOGNAME_$oldpkg = ${cname}_stub\n";
+    }
+  } else {
+    print "Error getting $url\n" . $response->status_line;
+  }
+
+}
+
 print MF "\n";
 
 print MF "include gar/category.mk\n";

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list