Skip to content

5.4.7 #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions inc/component.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ typedef struct component_data_t
int hits; /*used in binary analysis*/
char * file_path_ref;
int path_rank;
int url_stats[5];
} component_data_t;

component_data_t * component_init(void);
Expand Down
2 changes: 1 addition & 1 deletion inc/scanoss.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#define WFP_REC_LN 18

/* Log files */
#define SCANOSS_VERSION "5.4.6"
#define SCANOSS_VERSION "5.4.7"
#define SCAN_LOG "/tmp/scanoss_scan.log"
#define MAP_DUMP "/tmp/scanoss_map.dump"
#define SLOW_QUERY_LOG "/tmp/scanoss_slow_query.log"
Expand Down
8 changes: 8 additions & 0 deletions src/component.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ bool fill_component(component_data_t *component, uint8_t *url_key, char *file_pa
extract_csv(license, (char *)url_record, 5, sizeof(license));
extract_csv(purl, (char *)url_record, 6, sizeof(purl));
extract_csv(url, (char *)url_record, 7, sizeof(url));
/* Fill url stats if these are available*/
for (int i = 0; i < 5; i++) {
char stat[16] = "\0";
extract_csv(stat, (char *)url_record, 8+i, sizeof(url));
if (!*stat)
break;
component->url_stats[i] = atoi(stat);
}
strcpy(latest_version, version);

flip_slashes(vendor);
Expand Down
2 changes: 1 addition & 1 deletion src/health.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ bool print_health_item(uint8_t *key, uint8_t *subkey, int subkey_ln, uint8_t *da

int len = 0;

len += sprintf(&result[len]," \"health\":{\"creation_date\":\"%s\", ", isalnum(*creation_date) ? creation_date : "n");
len += sprintf(&result[len]," \"health\":{\"creation_date\":\"%s\", ", isalnum(*creation_date) ? creation_date : " ");
len += sprintf(&result[len],"\"last_update\":\"%s\", ", isalnum(*last_update) ? last_update : " ");
len += sprintf(&result[len],"\"last_push\":\"%s\", ", isalnum(*last_push) ? last_push : " ");
len += sprintf(&result[len],"\"stars\":%s, ", isdigit(*watchers_count) ? watchers_count : "null");
Expand Down
2 changes: 1 addition & 1 deletion src/license.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
3 = Declared in LICENSE file
4 = Scancode detection
5 = Scancode detection at mining time*/
const char *license_sources[] = {"component_declared", "file_spdx_tag", "file_header", "license_file", "scancode", "scancode"};
const char *license_sources[] = {"component_declared", "file_spdx_tag", "file_header", "license_file", "scancode", "scancode", "osselot"};

/**
* @brief Remove invalid characters from a license name
Expand Down
13 changes: 13 additions & 0 deletions src/report.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,19 @@ bool print_json_component(component_data_t * component)
char *url_id = md5_hex(component->url_md5);
printf("\"url_hash\": \"%s\"", url_id);
free(url_id);
//report url stats. An empty object is reported if there are not availables
printf(",\"url_stats\":{");
if (component->url_stats[0] > 0)
{
printf("\"total_files\":%d,"\
"\"indexed_files\":%d,"\
"\"source_files\":%d,"\
"\"ignored_files\":%d,"\
"\"package_size\":%d",
component->url_stats[0], component->url_stats[1], component->url_stats[2],
component->url_stats[3], component->url_stats[4]);
}
printf("}");

if (!(engine_flags & DISABLE_LICENSES))
{
Expand Down
Loading