diff options
Diffstat (limited to 'cli/spdxtool/util.c')
| -rw-r--r-- | cli/spdxtool/util.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/cli/spdxtool/util.c b/cli/spdxtool/util.c index e47bf0a1e61f..fa717aaa6102 100644 --- a/cli/spdxtool/util.c +++ b/cli/spdxtool/util.c @@ -163,24 +163,6 @@ spdxtool_util_set_spdx_license(pkgconf_client_t *client, const char *spdx_licens /* * !doc * - * .. c:function:: const char *spdxtool_util_get_spdx_license(pkgconf_client_t *client) - * - * Get license which SBOM is release in - * - * :param pkgconf_client_t* client: The pkgconf client being accessed. - * :return: SPDX license - */ -const char * -spdxtool_util_get_spdx_license(pkgconf_client_t *client) -{ - return pkgconf_tuple_find_global(client, "spdx_license"); -} - -static size_t last_id = 0; - -/* - * !doc - * * .. c:function:: char *spdxtool_util_get_spdx_id_int(pkgconf_client_t *client, char *part) * * Get spdxId with current URI. @@ -193,6 +175,7 @@ static size_t last_id = 0; char * spdxtool_util_get_spdx_id_int(pkgconf_client_t *client, const char *part) { + static size_t last_id = 0; const char *global_xsd_any_uri = spdxtool_util_get_uri_root(client); char sep = spdxtool_util_get_uri_separator(client); pkgconf_buffer_t current_uri = PKGCONF_BUFFER_INITIALIZER; @@ -260,7 +243,7 @@ spdxtool_util_get_iso8601_time(time_t *wanted_time) * * .. c:function:: char *spdxtool_util_get_current_iso8601_time(void) * - * Get ISO8601 current timestamp + * Get ISO8601 current timestamp, honouring SOURCE_DATE_EPOCH when set * * :return: Time string in ISO8601 format */ @@ -268,7 +251,13 @@ char * spdxtool_util_get_current_iso8601_time(void) { time_t now; - time(&now); + const char *source_date_epoch = getenv("SOURCE_DATE_EPOCH"); + + if (source_date_epoch != NULL && *source_date_epoch != '\0') + now = (time_t) strtoll(source_date_epoch, NULL, 10); + else + time(&now); + return spdxtool_util_get_iso8601_time(&now); } |
