Skip to content

Commit

Permalink
chore: only extract versions from packages in the generator ecosystem
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed May 3, 2024
1 parent c2bd45e commit 64b3c33
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/generators/GenerateMavenVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ public static Map<String, List<String>> fetchPackageVersions() throws IOExceptio
osvs.forEach(osv -> osv.getJSONArray("affected").forEach(aff -> {
JSONObject affected = (JSONObject) aff;

if(affected.getJSONObject("package").getString("ecosystem").equals("Maven")) {
return;
}

String pkgName = affected.getJSONObject("package").getString("name");

if(!affected.has("versions")) {
Expand Down
4 changes: 4 additions & 0 deletions scripts/generators/generate-cran-versions.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ extract_packages_with_versions <- function(osvs) {

for (osv in osvs) {
for (affected in osv$affected) {
if (affected$package$ecosystem != "CRAN") {
next
}

package <- affected$package$name

if (!(package %in% names(result))) {
Expand Down
3 changes: 3 additions & 0 deletions scripts/generators/generate-debian-versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def extract_packages_with_versions(osvs):

for osv in osvs:
for affected in osv['affected']:
if not affected['package']['ecosystem'].startswith('Debian'):
continue

package = affected['package']['name']

if package not in dict:
Expand Down
4 changes: 4 additions & 0 deletions scripts/generators/generate-packagist-versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ function fetchPackageVersions(): array

foreach ($osvs as $osv) {
foreach ($osv['affected'] as $affected) {
if ($affected['package']['ecosystem'] !== 'Packagist') {
continue;
}

$package = $affected['package']['name'];

if (!isset($packages[$package])) {
Expand Down
3 changes: 3 additions & 0 deletions scripts/generators/generate-pypi-versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def extract_packages_with_versions(osvs):

for osv in osvs:
for affected in osv['affected']:
if affected['package']['ecosystem'] != 'PyPI':
continue

package = affected['package']['name']

if package not in dict:
Expand Down
2 changes: 2 additions & 0 deletions scripts/generators/generate-rubygems-versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def extract_packages_with_versions(osvs)

osvs.each do |osv|
osv["affected"].each do |affected|
next unless affected["package"]["ecosystem"] == "RubyGems"

package = affected["package"]["name"]

packages[package] ||= []
Expand Down

0 comments on commit 64b3c33

Please sign in to comment.