[libmodule-install-doap-perl] 08/34: doap-deps work

Jonas Smedegaard js at alioth.debian.org
Thu Aug 8 16:13:47 UTC 2013


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository libmodule-install-doap-perl.

commit 6abb53b6cdd47cae7225ac62376bcdb562ce6c98
Author: Toby Inkster <mail at tobyinkster.co.uk>
Date:   Tue Jul 30 17:05:03 2013 +0100

    doap-deps work
    
    --HG--
    branch : Module-Install-DOAP
---
 lib/Module/Install/Admin/DOAP.pm |   42 ++++++++++++++++++++++++++++++++++++++
 meta/deps.ttl                    |   25 +++++++++++++++--------
 2 files changed, 59 insertions(+), 8 deletions(-)

diff --git a/lib/Module/Install/Admin/DOAP.pm b/lib/Module/Install/Admin/DOAP.pm
index e2166cd..2ce7d29 100644
--- a/lib/Module/Install/Admin/DOAP.pm
+++ b/lib/Module/Install/Admin/DOAP.pm
@@ -13,6 +13,7 @@ use RDF::Trine::Namespace qw[RDF RDFS OWL XSD];
 my $CPAN = RDF::Trine::Namespace->new('http://purl.org/NET/cpan-uri/terms#');
 my $DC   = RDF::Trine::Namespace->new('http://purl.org/dc/terms/');
 my $DOAP = RDF::Trine::Namespace->new('http://usefulinc.com/ns/doap#');
+my $DEPS = RDF::Trine::Namespace->new('http://ontologi.es/doap-deps#');
 my $FOAF = RDF::Trine::Namespace->new('http://xmlns.com/foaf/0.1/');
 my $NFO  = RDF::Trine::Namespace->new('http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#');
 my $SKOS = RDF::Trine::Namespace->new('http://www.w3.org/2004/02/skos/core#');
@@ -210,6 +211,47 @@ sub doap_metadata
 		}
 	}
 
+	foreach my $phase (qw/ configure build test runtime develop /)
+	{
+		foreach my $level (qw/ requirement recommendation suggestion /)
+		{
+			my $term = "$phase\_$level";
+			my $mi_term = {
+				configure_requirement  => 'configure_requires',
+				build_requirement      => 'build_requires',
+				test_requirement       => 'test_requires',
+				runtime_requirement    => 'requires',
+				build_recommendation   => 'recommends',
+				test_recommendation    => 'recommends',
+				runtime_recommendation => 'recommends',
+			}->{$term} or next;
+			
+			foreach my $dep ( $model->objects($uri, $DEPS->$term) )
+			{
+				if ($dep->is_literal)
+				{
+					warn $DEPS->$term . " expects a resource, not literal $dep!";
+					next;
+				}
+				
+				foreach my $ident ( $model->objects($dep, $DEPS->on) )
+				{
+					unless ($ident->is_literal
+					and     $ident->has_datatype
+					and     $ident->literal_datatype eq $DEPS->CpanIdentifier->uri)
+					{
+						warn "Dunno what to do with ${ident}... we'll figure something out eventually.";
+						next;
+					}
+					
+					my ($mod, $ver) = split /\s+/, $ident->literal_value;
+					$ver ||= 0;
+					$metadata->($mi_term => $mod => $ver);
+				}
+			}
+		}			
+	}
+
 	{
 		my @terms = qw(abstract_from author_from license_from perl_version_from readme_from requires_from version_from
 			no_index install_script requires_external_bin);
diff --git a/meta/deps.ttl b/meta/deps.ttl
index 604a832..d12338f 100644
--- a/meta/deps.ttl
+++ b/meta/deps.ttl
@@ -1,10 +1,19 @@
- at prefix : <http://purl.org/NET/cpan-uri/terms#> .
+ at prefix : <http://ontologi.es/doap-deps#> .
 
 <http://purl.org/NET/cpan-uri/dist/Module-Install-DOAP/project>
-	:requires
-		"Module::Install 1.00" ,
-		"Module::Install::RDF 0.004" ,
-		"Module::Install::Admin::RDF 0.004" ,
-		"RDF::Trine 0.133" ;
-	:test_requires
-		"Test::More 0.61" .
+	:runtime_requirement [
+		:on "Module::Install 1.00"^^:CpanIdentifier;
+	];
+	:runtime_requirement [
+		:on "Module::Install::RDF 0.004"^^:CpanIdentifier;
+	];
+	:runtime_requirement [
+		:on "Module::Install::Admin::RDF 0.004"^^:CpanIdentifier;
+	];
+	:runtime_requirement [
+		:on "RDF::Trine 0.133"^^:CpanIdentifier;
+	];
+	:test_requirement [
+		:on "Test::More 0.96"^^:CpanIdentifier;
+	];
+.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmodule-install-doap-perl.git



More information about the Pkg-perl-cvs-commits mailing list