Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion LICENSE.libuuid.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (C) 1996, 1997 Theodore Ts'o.
Copyright (C) 1996, 1997, 1998, 1999, 2007 Theodore Ts'o.
Copyright (C) 2017 Philip Prindeville.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Expand All @@ -25,3 +26,6 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.

libuuid also includes MD5 code written by Colin Plumb and SHA-1 code written
by Steve Reid, which their authors placed in the public domain.
43 changes: 38 additions & 5 deletions cpython-unix/build-uuid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,52 @@ ROOT=$(pwd)

export PATH=${TOOLS_PATH}/${TOOLCHAIN}/bin:${TOOLS_PATH}/host/bin:$PATH

tar -xf "libuuid-${UUID_VERSION}.tar.gz"
pushd "libuuid-${UUID_VERSION}"
tar -xf "util-linux-${UUID_VERSION}.tar.xz"
pushd "util-linux-${UUID_VERSION}"

CFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC"

# Error by default in Clang 16.
CFLAGS="${CFLAGS} -Wno-error=implicit-function-declaration"
UUID_CONFIGURE_FLAGS=()
if [[ "${TARGET_TRIPLE}" == *-linux-* ]]; then
UUID_CONFIGURE_FLAGS+=(--enable-libuuid-force-uuidd)
fi

# The ARMv7 GNU toolchains use glibc with 32-bit time_t. Keep the existing
# compatibility baseline even though timestamps after 2038 are not supported.
case "${TARGET_TRIPLE}" in
armv7-unknown-linux-gnueabi|armv7-unknown-linux-gnueabihf)
UUID_CONFIGURE_FLAGS+=(--disable-year2038)
;;
esac

# The util-linux configure script requires Linux headers globally, but libuuid
# does not use linux/version.h. Keep HAVE_LINUX_VERSION_H undefined while
# bypassing that check for musl; recheck this when updating util-linux.
if [[ "${TARGET_TRIPLE}" == *-linux-musl* ]]; then
export ac_cv_header_linux_version_h=unknown
fi

CFLAGS="${CFLAGS}" CPPFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC" LDFLAGS="${EXTRA_TARGET_LDFLAGS}" ./configure \
--build="${BUILD_TRIPLE}" \
--host="${TARGET_TRIPLE}" \
--prefix=/tools/deps \
--disable-shared
--localstatedir=/var \
--libdir=/tools/deps/lib \
--disable-all-programs \
--enable-libuuid \
--disable-libblkid \
--disable-libfdisk \
--disable-liblastlog2 \
--disable-libmount \
--disable-libsmartcols \
--disable-nls \
--disable-asciidoc \
--disable-dependency-tracking \
--without-python \
--without-systemd \
--disable-shared \
--enable-static \
"${UUID_CONFIGURE_FLAGS[@]}"

make -j "${NUM_CPUS}"
make -j "${NUM_CPUS}" install DESTDIR="${ROOT}/out"
13 changes: 13 additions & 0 deletions pythonbuild/disttests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@


class TestPythonInterpreter(unittest.TestCase):
@unittest.skipUnless(
sys.platform in ("darwin", "linux"), "bundled libuuid is used on Unix"
)
def test_uuid_generate_time_safe(self):
import _uuid # type: ignore
import uuid

self.assertTrue(_uuid.has_uuid_generate_time_safe)
data, status = _uuid.generate_time_safe()
self.assertEqual(uuid.UUID(bytes=data).version, 1)
self.assertIn(status, (0, -1))
self.assertIn(uuid.uuid1().is_safe, (uuid.SafeUUID.safe, uuid.SafeUUID.unsafe))

@unittest.skipUnless(os.name == "nt", "Windows executable names")
def test_windows_executables(self):
build_options = os.environ["BUILD_OPTIONS"].split("+")
Expand Down
8 changes: 4 additions & 4 deletions pythonbuild/downloads.json
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,10 @@
"license_file": "LICENSE.tcl.txt"
},
"uuid": {
"url": "https://sourceforge.net/projects/libuuid/files/libuuid-1.0.3.tar.gz",
"size": 318256,
"sha256": "46af3275291091009ad7f1b899de3d0cea0252737550e7919d17237997db5644",
"version": "1.0.3",
"url": "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.42/util-linux-2.42.4.tar.xz",
"size": 10729748,
"sha256": "fbd62a100ab7bb8746ba0661255c3c48185b1e9021507c624da01fbc696330ec",
"version": "2.42.4",
"library_names": [
"uuid"
],
Expand Down
27 changes: 26 additions & 1 deletion scripts/update_downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,31 @@ def releases(self, client: HttpClient) -> Iterable[Release]:
yield Release(version, url)


@dataclasses.dataclass(frozen=True)
class UtilLinuxDiscovery:
"""Find stable util-linux tarballs in the newest release series."""

index_url: str = "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/"

def releases(self, client: HttpClient) -> Iterable[Release]:
series = HtmlDiscovery(
self.index_url, r"^v(?P<version>[0-9]+\.[0-9]+)/$"
).releases(client)
for release in sorted(
series, key=lambda item: Version(item.version), reverse=True
):
files = list(
HtmlDiscovery(
release.url,
rf"^util-linux-(?P<version>{re.escape(release.version)}"
r"(?:\.[0-9]+)?)\.tar\.xz$",
).releases(client)
)
if files:
yield from files
return


@dataclasses.dataclass(frozen=True)
class GitHubReleaseDiscovery:
"""Discover release artifacts using the GitHub releases API."""
Expand Down Expand Up @@ -394,6 +419,7 @@ def xorg_policy(category: str, name: str, extension: str = "tar.gz") -> Policy:
artifact_url="https://prdownloads.sourceforge.net/tcl/tk{version}-src.tar.gz",
series=2,
),
"uuid": Policy(UtilLinuxDiscovery()),
"x11-util-macros": xorg_policy("util", "util-macros"),
"xcb-proto": html_policy(
"https://xcb.freedesktop.org/dist/",
Expand Down Expand Up @@ -428,7 +454,6 @@ def xorg_policy(category: str, name: str, extension: str = "tar.gz") -> Policy:
"tix": "source dependency snapshot",
"tk-windows-bin-904": "commit-pinned CPython binary dependency",
"tk-windows-bin-8615": "commit-pinned CPython binary dependency",
"uuid": "inactive upstream project",
"zlib-ng": "CPython source-deps snapshot must follow the upstream release",
"zstd": "CPython source-deps snapshot must follow the upstream release",
}
Expand Down
Loading