Skip to content

Commit

Permalink
fix[get-FHEMRepository]: Do not query archived repos.
Browse files Browse the repository at this point in the history
  • Loading branch information
sidey79 committed Apr 19, 2024
1 parent a36976a commit f369a61
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Remove contrib from dependency scan
run: |
rm -r ./src/fhem/trunk/fhem/contrib
rm -r ./src/fhem/trunk/fhem/contrib || true
- uses: shogo82148/actions-setup-perl@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion scripts/get-FHEMRepositorys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ TAG="FHEM"
PER_PAGE=2000

# API-Anfrage an GitHub
response=$(curl -s "$BASE_URL?q=$TAG+language:Perl&sort=stars&order=desc&per_page=$PER_PAGE")
response=$(curl -s "$BASE_URL?q=$TAG+language:Perl+archived:false&sort=stars&order=desc&per_page=$PER_PAGE")

# Verarbeite die Antwort
if [[ $response == *"items"* ]]; then
Expand Down
61 changes: 34 additions & 27 deletions scripts/parse-METAJson.pl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
use Scalar::Util qw/blessed/;
use File::Find::Rule;
use JSON;

use Perl::PrereqScanner::NotQuiteLite::App;

my @directories = @ARGV;

#my $filename = @ARGV # path must be provided to our script
Expand Down Expand Up @@ -84,47 +85,53 @@ sub filter_nested_hashref {
}
}
close($fh);

my $module_requirements;

if (!@JSONlines)
{
print "aborting, no META.json found\n";
next;
}

$jsonString = join '', @JSONlines;


## Script breaks here, because we may have no version field which is requred to pass here

my $MetaHash;
eval {
$MetaHash = from_json($jsonString) ;
1;
} or do {
print q[[ failed ]]. $@;
next;
};

# my $app = Perl::PrereqScanner::NotQuiteLite::App->new(
# parsers => [qw/:installed/],
# suggests => 1,
# # recommends => 1,
# # perl_minimum_version => 1,
exclude_core => 1,

Check failure on line 101 in scripts/parse-METAJson.pl

View workflow job for this annotation

GitHub Actions / get_dependencies

Useless use of a constant ("exclude_core") in void context

Check failure on line 101 in scripts/parse-METAJson.pl

View workflow job for this annotation

GitHub Actions / get_dependencies

Useless use of a constant ("exclude_core") in void context
# private_re => $regex,
# );
# my $scannedprereqs = $app->run($filename);
# $module_requirements = $scannedprereqs->{'prereqs'};

} else {
$jsonString = join '', @JSONlines;
## Script breaks here, because we may have no version field which is requred to pass here

my $MetaHash;
eval {
$MetaHash = from_json($jsonString) ;
1;
} or do {
print q[[ failed ]]. $@;
next;
};
# requirements from the processed file
$module_requirements = filter_nested_hashref($MetaHash->{'prereqs'}, $regex);
}


# fix missing version information


my $cpanfile_requirements = $cpanfile->prereq_specs; # requirements from our cpanfile



my $module_requirements = $MetaHash->{'prereqs'}; # requirements from the processed file
$module_requirements = filter_nested_hashref($module_requirements, $regex);
#print Dumper $module_requirements;



# print Dumper $cpanfile_requirements;
print Dumper $module_requirements;
print Dumper $cpanfile_requirements;
# print Dumper $module_requirements;

# merge requirements together
my $struct = merge_hashes($cpanfile_requirements, $module_requirements);
#print Dumper $struct;
print Dumper $struct;

$cpanfile = Module::CPANfile->from_prereqs( $struct ); # update cpanfile object
print qq[$filename was processed successfull\n];
Expand Down

0 comments on commit f369a61

Please sign in to comment.