Skip to content

Commit

Permalink
webapp: add more refined data to must-include projects (#1751)
Browse files Browse the repository at this point in the history
* webapp: add more refined data to must-include projects

Signed-off-by: David Korczynski <[email protected]>

* nit

Signed-off-by: David Korczynski <[email protected]>

---------

Signed-off-by: David Korczynski <[email protected]>
  • Loading branch information
DavidKorczynski authored Sep 30, 2024
1 parent 55c217f commit b31848b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import subprocess
import zipfile
from threading import Thread
from typing import List, Any

import constants
import oss_fuzz
Expand Down Expand Up @@ -53,6 +54,7 @@
'0')))

MUST_INCLUDES = set()
MUST_INCLUDE_WITH_LANG: List[Any] = []

logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
Expand Down Expand Up @@ -956,8 +958,14 @@ def update_db_files(db_timestamp,
extend_db_timestamps(db_timestamp, output_directory)

if must_include_not_in_ossfuzz:
to_dump = []
for project in must_include_not_in_ossfuzz:
for elem in MUST_INCLUDE_WITH_LANG:
if elem['project'] == project:
to_dump.append(elem)

with open('projects-not-in-oss-fuzz.json', 'w') as f:
f.write(json.dumps(list(must_include_not_in_ossfuzz)))
f.write(json.dumps(list(to_dump)))

# Write a zip folder the values that make sense to save
if should_include_details:
Expand Down Expand Up @@ -1158,12 +1166,21 @@ def setup_webapp_cache():


def extract_must_includes(must_include_arg):
global MUST_INCLUDE_WITH_LANG
must_include = set()
if os.path.isfile(must_include_arg):
with open(must_include_arg, "r") as f:
for line in f:
if line.strip():
must_include.add(line.strip())

if must_include_arg.endswith('.json'):
with open(must_include_arg, 'r') as f:
contents = json.load(f)
MUST_INCLUDE_WITH_LANG = contents
for project in contents:
must_include.add(project['project'])
else:
with open(must_include_arg, "r") as f:
for line in f:
if line.strip():
must_include.add(line.strip())
elif os.path.isdir(must_include_arg):
# Convenient when reading OSS-Fuzz-gen benchmark folder
for filename in os.listdir(must_include_arg):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ <h1 class="section__title">
{% endfor %}
{% for project in projects_not_in_ossfuzz %}
<tr>
<td>{{project}}</td>
<td>{{project.project}}</td>
<td>{{project.language}}</td>
<td>Not in OSS-Fuzz</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
</tr>
{% endfor %}
</tbody>
Expand Down

0 comments on commit b31848b

Please sign in to comment.