From eaa637963bcfde283b411c14968b7903b02d6aa1 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Fri, 26 Jun 2026 00:11:37 +0200 Subject: Vendor import of pkgconf 2.9.91 Obtained from https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.9.91.tar.gz SHA1: 8ac84e584ff568dace16f9012efcec603b78ca34 - SHA256: 68de1892189f085ab21e735561c67b5a077b85e0ce29f91ac774c3ad1afbfc94 - SHA512: b069c7e9266059a126443392853b353845f0ebffd1591bdbc5582853016074d284d3b2f3a2b6588deb29a662bb712f05261c9bca81452d6de536018dbc9d4314 - One test folder in tests/lib1 had to be removed to avoid UTF-8 filenames in the tree. (Breaks `make create-source-packages`) Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57855 --- cli/spdxtool/util.c | 29 +++++++++-------------------- cli/spdxtool/util.h | 3 --- 2 files changed, 9 insertions(+), 23 deletions(-) (limited to 'cli/spdxtool') 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 @@ -160,24 +160,6 @@ spdxtool_util_set_spdx_license(pkgconf_client_t *client, const char *spdx_licens spdxtool_util_set_key(client, "spdx_license", spdx_license, "CC0-1.0"); } -/* - * !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 * @@ -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); -- cgit v1.3