Skip to content

Commit

Permalink
Merge pull request #74 from scanoss/5.4.7
Browse files Browse the repository at this point in the history
5.4.7
  • Loading branch information
mscasso-scanoss authored Jun 24, 2024
2 parents 89697e4 + b1cf58a commit 2b15161
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 3 deletions.
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

0 comments on commit 2b15161

Please sign in to comment.