diff options
| author | Pierre Pronchery <khorben@FreeBSD.org> | 2026-06-25 22:11:37 +0000 |
|---|---|---|
| committer | Pierre Pronchery <khorben@FreeBSD.org> | 2026-06-29 05:21:46 +0000 |
| commit | eaa637963bcfde283b411c14968b7903b02d6aa1 (patch) | |
| tree | c8923ff21bac1e9ac4b5e7107b8a071f27f2d8a2 /cli/spdxtool | |
| parent | ebcc78644e0cbc4141807c0887ef8d902cb91bb4 (diff) | |
Diffstat (limited to 'cli/spdxtool')
| -rw-r--r-- | cli/spdxtool/util.c | 29 | ||||
| -rw-r--r-- | cli/spdxtool/util.h | 3 |
2 files changed, 9 insertions, 23 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); } diff --git a/cli/spdxtool/util.h b/cli/spdxtool/util.h index be86d6e154d7..e39c173e64c5 100644 --- a/cli/spdxtool/util.h +++ b/cli/spdxtool/util.h @@ -102,9 +102,6 @@ spdxtool_util_get_spdx_version(pkgconf_client_t *client); void spdxtool_util_set_spdx_license(pkgconf_client_t *client, const char *spdx_license); -const char * -spdxtool_util_get_spdx_license(pkgconf_client_t *client); - char * spdxtool_util_get_spdx_id_int(pkgconf_client_t *client, const char *part); |
