2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 14:16:42 +00:00

Meta.pm: improved error handling

git-svn-id: https://svn.fhem.de/fhem/trunk@20009 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2019-08-17 11:06:17 +00:00
parent 75b1809fd5
commit 769dc09596

View File

@ -1136,7 +1136,7 @@ sub __GetMetadata {
# Static meta information # Static meta information
$modMeta->{dynamic_config} = 1; $modMeta->{dynamic_config} = 1;
$modMeta->{'meta-spec'} = { $modMeta->{'meta-spec'} = {
"version" => 2, "version" => 2,
"url" => "https://metacpan.org/pod/CPAN::Meta::Spec" "url" => "https://metacpan.org/pod/CPAN::Meta::Spec"
}; };
@ -1161,8 +1161,8 @@ sub __GetMetadata {
# $file[8] - plain extracted version number, may be undefined # $file[8] - plain extracted version number, may be undefined
$modMeta->{x_file} = \@file; $modMeta->{x_file} = \@file;
$modName = $file[4]; $modName = $file[4];
$modType = $file[3] || $file[2] eq 'fhem.pl' ? 'mod' : 'pkg'; $modType = $file[3] || $file[2] eq 'fhem.pl' ? 'mod' : 'pkg';
} }
# grep info from file content # grep info from file content
@ -2001,7 +2001,7 @@ m/(^#\s+(?:\d{1,2}\.\d{1,2}\.(?:\d{2}|\d{4})\s+)?[^v\d]*(v?(?:\d{1,3}\.\d{1,3}(?
$@ .= $@ .=
$modMeta->{x_file}[2] . ": Invalid version format '$modMeta->{version}'" $modMeta->{x_file}[2] . ": Invalid version format '$modMeta->{version}'"
if ( defined( $modMeta->{version} ) if ( defined( $modMeta->{version} )
&& $modMeta->{version} !~ m/^\d+\.\d+$/ ); && $modMeta->{version} !~ m/^\d+\.\d+(?:_\d+)?$/ );
# meta name # meta name
unless ( defined( $modMeta->{name} ) ) { unless ( defined( $modMeta->{name} ) ) {
@ -3190,12 +3190,12 @@ m/^((\S+) ((([0-9]+)-([0-9]+)-([0-9]+))_(([0-9]+):([0-9]+):([0-9]+))) (\d+) (?:\
} }
} }
else { # else {
Log 5, # Log 5,
__PACKAGE__ # __PACKAGE__
. "::__GetUpdatedata: $file: Ignoring line\n " # . "::__GetUpdatedata: $file: Ignoring line\n "
. $l; # . $l;
} # }
} }
close($fh); close($fh);
} }
@ -3243,23 +3243,18 @@ sub __SetXVersion {
); );
} }
# from META.json only
elsif ( $modMeta->{x_file}[7] eq 'META.json' )
{
$modMeta->{x_version} =
$modMeta->{x_file}[2] . ':'
. version->parse( $modMeta->{version} )->normal;
}
# Generate generic version to fill the gap # Generate generic version to fill the gap
elsif ( $modMeta->{x_file}[7] eq 'generated/blank' ) { elsif (defined( $modMeta->{x_file} )
&& defined( $modMeta->{x_file}[7] )
&& $modMeta->{x_file}[7] eq 'generated/blank' )
{
$modMeta->{x_version} = $modMeta->{x_file}[2] . ':?'; $modMeta->{x_version} = $modMeta->{x_file}[2] . ':?';
} }
if ( defined( $modMeta->{x_version} ) ) { if ( defined( $modMeta->{x_version} ) ) {
# Add modified date to extended version # Add modified date to extended version
if ( defined( $modMeta->{x_vcs} ) ) { if ( defined( $modMeta->{x_vcs} ) && defined( $modMeta->{x_vcs}[7] ) ) {
$modMeta->{x_version} .= '/' . $modMeta->{x_vcs}[7]; $modMeta->{x_version} .= '/' . $modMeta->{x_vcs}[7];
# #FIXME can't use modified time because FHEM Update currently # #FIXME can't use modified time because FHEM Update currently
@ -3271,7 +3266,11 @@ sub __SetXVersion {
# if ( defined( $modMeta->{x_vcs} ) # if ( defined( $modMeta->{x_vcs} )
# && $modMeta->{x_vcs}[16] ne $modMeta->{x_file}[6][9][0] ); # && $modMeta->{x_vcs}[16] ne $modMeta->{x_file}[6][9][0] );
} }
else { elsif (defined( $modMeta->{x_file} )
&& defined( $modMeta->{x_file}[6] )
&& defined( $modMeta->{x_file}[6][9] )
&& defined( $modMeta->{x_file}[6][9][2] ) )
{
$modMeta->{x_version} .= '/' . $modMeta->{x_file}[6][9][2]; $modMeta->{x_version} .= '/' . $modMeta->{x_file}[6][9][2];
} }
@ -3302,7 +3301,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.6.4", "version": "v0.6.5",
"release_status": "testing", "release_status": "testing",
"x_changelog": { "x_changelog": {
"2019-04-18": { "2019-04-18": {