Skip to content

Commit 2b15161

Browse files
Merge pull request #74 from scanoss/5.4.7
5.4.7
2 parents 89697e4 + b1cf58a commit 2b15161

File tree

6 files changed

+25
-3
lines changed

6 files changed

+25
-3
lines changed

inc/component.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ typedef struct component_data_t
4343
int hits; /*used in binary analysis*/
4444
char * file_path_ref;
4545
int path_rank;
46+
int url_stats[5];
4647
} component_data_t;
4748

4849
component_data_t * component_init(void);

inc/scanoss.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#define WFP_REC_LN 18
4141

4242
/* Log files */
43-
#define SCANOSS_VERSION "5.4.6"
43+
#define SCANOSS_VERSION "5.4.7"
4444
#define SCAN_LOG "/tmp/scanoss_scan.log"
4545
#define MAP_DUMP "/tmp/scanoss_map.dump"
4646
#define SLOW_QUERY_LOG "/tmp/scanoss_slow_query.log"

src/component.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,14 @@ bool fill_component(component_data_t *component, uint8_t *url_key, char *file_pa
243243
extract_csv(license, (char *)url_record, 5, sizeof(license));
244244
extract_csv(purl, (char *)url_record, 6, sizeof(purl));
245245
extract_csv(url, (char *)url_record, 7, sizeof(url));
246+
/* Fill url stats if these are available*/
247+
for (int i = 0; i < 5; i++) {
248+
char stat[16] = "\0";
249+
extract_csv(stat, (char *)url_record, 8+i, sizeof(url));
250+
if (!*stat)
251+
break;
252+
component->url_stats[i] = atoi(stat);
253+
}
246254
strcpy(latest_version, version);
247255

248256
flip_slashes(vendor);

src/health.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ bool print_health_item(uint8_t *key, uint8_t *subkey, int subkey_ln, uint8_t *da
8484

8585
int len = 0;
8686

87-
len += sprintf(&result[len]," \"health\":{\"creation_date\":\"%s\", ", isalnum(*creation_date) ? creation_date : "n");
87+
len += sprintf(&result[len]," \"health\":{\"creation_date\":\"%s\", ", isalnum(*creation_date) ? creation_date : " ");
8888
len += sprintf(&result[len],"\"last_update\":\"%s\", ", isalnum(*last_update) ? last_update : " ");
8989
len += sprintf(&result[len],"\"last_push\":\"%s\", ", isalnum(*last_push) ? last_push : " ");
9090
len += sprintf(&result[len],"\"stars\":%s, ", isdigit(*watchers_count) ? watchers_count : "null");

src/license.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
3 = Declared in LICENSE file
5151
4 = Scancode detection
5252
5 = Scancode detection at mining time*/
53-
const char *license_sources[] = {"component_declared", "file_spdx_tag", "file_header", "license_file", "scancode", "scancode"};
53+
const char *license_sources[] = {"component_declared", "file_spdx_tag", "file_header", "license_file", "scancode", "scancode", "osselot"};
5454

5555
/**
5656
* @brief Remove invalid characters from a license name

src/report.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,19 @@ bool print_json_component(component_data_t * component)
248248
char *url_id = md5_hex(component->url_md5);
249249
printf("\"url_hash\": \"%s\"", url_id);
250250
free(url_id);
251+
//report url stats. An empty object is reported if there are not availables
252+
printf(",\"url_stats\":{");
253+
if (component->url_stats[0] > 0)
254+
{
255+
printf("\"total_files\":%d,"\
256+
"\"indexed_files\":%d,"\
257+
"\"source_files\":%d,"\
258+
"\"ignored_files\":%d,"\
259+
"\"package_size\":%d",
260+
component->url_stats[0], component->url_stats[1], component->url_stats[2],
261+
component->url_stats[3], component->url_stats[4]);
262+
}
263+
printf("}");
251264

252265
if (!(engine_flags & DISABLE_LICENSES))
253266
{

0 commit comments

Comments
 (0)