2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-04 05:16:45 +00:00

Meta.pm: fix license to be an array (comply with CPAN::Meta::Spec)

git-svn-id: https://svn.fhem.de/fhem/trunk@19094 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2019-04-02 10:54:41 +00:00
parent 19fe83ebb5
commit dbd091be33
2 changed files with 61 additions and 16 deletions

View File

@ -2242,8 +2242,11 @@ sub CreateMetadataList ($$$) {
|| !defined( $modMeta->{resources}{repository} ) ) || !defined( $modMeta->{resources}{repository} ) )
); );
next next
if ( $mAttr eq 'release_date' if (
&& ( !defined( $modMeta->{x_vcs} ) ) ); $mAttr eq 'release_date'
&& ( !defined( $modMeta->{x_release_date} )
&& !defined( $modMeta->{x_vcs} ) )
);
next next
if ( $mAttr eq 'command_reference' if ( $mAttr eq 'command_reference'
&& $modType eq 'package' ); && $modType eq 'package' );
@ -2269,9 +2272,6 @@ sub CreateMetadataList ($$$) {
elsif ( defined( $modMeta->{x_vcs} ) ) { elsif ( defined( $modMeta->{x_vcs} ) ) {
$l .= $modMeta->{x_vcs}[7]; $l .= $modMeta->{x_vcs}[7];
} }
else {
$l .= '-';
}
} }
elsif ( $mAttr eq 'copyright' ) { elsif ( $mAttr eq 'copyright' ) {
@ -3532,11 +3532,13 @@ sub LoadInstallStatusPerl(;$) {
if ( exists( $modules{$modName} ) && !exists( $packages{$modName} ) ) { if ( exists( $modules{$modName} ) && !exists( $packages{$modName} ) ) {
$type = 'module'; $type = 'module';
} }
elsif ( exists( $packages{$modName} ) && !exists( $modules{$modName} ) ) elsif ( exists( $packages{$modName} )
&& !exists( $modules{$modName} ) )
{ {
$type = 'package'; $type = 'package';
} }
elsif ( exists( $packages{$modName} ) && exists( $modules{$modName} ) ) elsif (exists( $packages{$modName} )
&& exists( $modules{$modName} ) )
{ {
$type = 'module+package'; $type = 'module+package';
} }
@ -3580,8 +3582,8 @@ sub LoadInstallStatusPerl(;$) {
unless ( unless (
grep ( /^$modName$/, grep ( /^$modName$/,
@{ @{
$pkgStatus{Perl}{pkgs}{$pkg}{ $type . 's' } $pkgStatus{Perl}{pkgs}{$pkg}
{$mAttr} { $type . 's' }{$mAttr}
} ) } )
); );
@ -3718,7 +3720,8 @@ sub LoadInstallStatusPerl(;$) {
$pkgStatus{Perl}{pkgs}{$pkg}{status} = $pkgStatus{Perl}{pkgs}{$pkg}{status} =
'installed'; 'installed';
my $v = eval "$pkg->VERSION()"; my $v = eval "$pkg->VERSION()";
$pkgStatus{Perl}{installed}{$pkg} = $v ? $v : 0; $pkgStatus{Perl}{installed}{$pkg} =
$v ? $v : 0;
} }
} }
@ -3743,8 +3746,8 @@ sub LoadInstallStatusPerl(;$) {
$reqV; $reqV;
$pkgStatus{Perl}{analyzed} = 1 $pkgStatus{Perl}{analyzed} = 1
if ( if ( $modMeta->{x_prereqs_src} ne
$modMeta->{x_prereqs_src} ne 'META.json' 'META.json'
&& !$pkgStatus{Perl}{analyzed} ); && !$pkgStatus{Perl}{analyzed} );
} }
} }

View File

@ -1943,12 +1943,49 @@ m/(^#\s+(?:\d{1,2}\.\d{1,2}\.(?:\d{2}|\d{4})\s+)?[^v\d]*(v?(?:\d{1,3}\.\d{1,3}(?
$modMeta->{release_status} = 'stable'; $modMeta->{release_status} = 'stable';
} }
unless ( defined( $modMeta->{license} ) ) { unless ( defined( $modMeta->{license} ) ) {
$modMeta->{license} = 'unknown'; $modMeta->{license} = ['unknown'];
} }
unless ( defined( $modMeta->{author} ) ) { unless ( defined( $modMeta->{author} ) ) {
$modMeta->{author} = ['unknown <>']; $modMeta->{author} = ['unknown <>'];
} }
# ensure license is an array
if ( defined( $modMeta->{license} )
&& !ref( $modMeta->{license} ) )
{
$modMeta->{license} = [ $modMeta->{license} ];
}
# ensure author is an array
if ( defined( $modMeta->{author} )
&& !ref( $modMeta->{author} ) )
{
$modMeta->{author} = [ $modMeta->{author} ];
}
# ensure x_fhem_maintainer is an array
if ( defined( $modMeta->{x_fhem_maintainer} )
&& !ref( $modMeta->{x_fhem_maintainer} ) )
{
$modMeta->{x_fhem_maintainer} = [ $modMeta->{x_fhem_maintainer} ];
}
# ensure x_fhem_maintainer_github is an array
if ( defined( $modMeta->{x_fhem_maintainer_github} )
&& !ref( $modMeta->{x_fhem_maintainer_github} ) )
{
$modMeta->{x_fhem_maintainer_github} =
[ $modMeta->{x_fhem_maintainer_github} ];
}
# ensure resources/license is an array
if ( defined( $modMeta->{resources} )
&& defined( $modMeta->{resources}{license} )
&& !ref( $modMeta->{resources}{license} ) )
{
$modMeta->{resources}{license} = [ $modMeta->{resources}{license} ];
}
# Generate META information for FHEM core modules # Generate META information for FHEM core modules
if ( GetModuleSourceOrigin($modName) eq 'fhem' ) { if ( GetModuleSourceOrigin($modName) eq 'fhem' ) {
@ -1963,9 +2000,14 @@ m/(^#\s+(?:\d{1,2}\.\d{1,2}\.(?:\d{2}|\d{4})\s+)?[^v\d]*(v?(?:\d{1,3}\.\d{1,3}(?
} }
} }
if ( !$modMeta->{license} || $modMeta->{license} eq 'unknown' ) { if (
!$modMeta->{license}
|| ( ref( $modMeta->{license} ) eq 'ARRAY'
&& $modMeta->{license}[0] eq 'unknown' )
)
{
if ( defined( $modMeta->{x_vcs} ) ) { if ( defined( $modMeta->{x_vcs} ) ) {
$modMeta->{license} = 'GPL_2'; $modMeta->{license}[0] = 'GPL_2';
} }
} }
@ -3089,7 +3131,7 @@ sub __SetXVersion {
"abstract": "FHEM Entwickler Paket, um Metadaten Unterstützung zu aktivieren" "abstract": "FHEM Entwickler Paket, um Metadaten Unterstützung zu aktivieren"
} }
}, },
"version": "v0.4.0", "version": "v0.4.1",
"release_status": "testing", "release_status": "testing",
"author": [ "author": [
"Julian Pawlowski <julian.pawlowski@gmail.com>" "Julian Pawlowski <julian.pawlowski@gmail.com>"