From: Theo Buehler Subject: Re: Porting astral-sh/uv To: Denis Fondras Cc: ports@openbsd.org Date: Fri, 4 Jul 2025 11:49:01 +0200 On Fri, Jul 04, 2025 at 10:25:12AM +0200, Denis Fondras wrote: > On Thu, Jul 03, 2025 at 10:21:32PM +0200, Theo Buehler wrote: > > On Thu, Jul 03, 2025 at 10:08:16PM +0200, Denis Fondras wrote: > > > tb@ provided some clue. Thank you Theo. > > > > Attached is a port that builds a few cli binaries and leaves them > > in ${WRKSRC}/target/release. You can see if that's useful at all > > and at least it might get you started. > > > > It's rather hacky and it will be an utter pain to update. > > Thank you so much Theo :) > > Here is the complete port. It works on my machine, I can use uv for ${JOB}. That's good to hear. I could live with the port as it is now, but there are still a few things to consider: I have not yet figured out why the lzma-sys build doesn't pick up the system-provided liblzma from archivers/xz via pkg-config. IOW, why we need the MODCARGO_CRATES_KEEP = lzma-sys to make the build succeed? Another bit is that the way things are right now in the Config.toml, we could avoid the use of ${SUBST_VARS] and ${SUBST_CMD} by using a different DIST_TUPLE incantation. This simplifies the Cargo.toml patch a bit, but it will still fail to apply whenever upstream bump the crate hashes in their workspace. It would be nice to have a more robust approach for this, but that would probably require some non-trivial work in devel/cargo-generate-vendor. The simpler approach would look something like this. I'm not convinced it's better. Finally, I would drop 'Extremely fast' in the COMMENT. diff -pu ./Makefile.orig ./Makefile --- ./Makefile.orig Fri Jul 4 10:08:27 2025 +++ ./Makefile Fri Jul 4 11:20:05 2025 @@ -1,4 +1,4 @@ -COMMENT = Extremely fast Python package and project manager +COMMENT = Python package and project manager GH_ACCOUNT = astral-sh GH_PROJECT = uv @@ -9,13 +9,12 @@ PUBGRUB = 06ec5a5f59ffaeb6cf5079c6cb184467da06c9db REQWEST_MIDDLEWARE = ad8b9d332d1773fde8b4cd008486de5973e0a3f8 TL = 6e25b2ee2513d75385101a8ff9f591ef51f314ec -SUBST_VARS += ASYNC_ZIP PUBGRUB REQWEST_MIDDLEWARE TL +DIST_TUPLE += github charliermarsh rs-async-zip ${ASYNC_ZIP} ../rs-async-zip +DIST_TUPLE += github astral-sh pubgrub ${PUBGRUB} ../pubgrub +DIST_TUPLE += github astral-sh reqwest-middleware ${REQWEST_MIDDLEWARE} \ + ../reqwest-middleware +DIST_TUPLE += github astral-sh tl ${TL} ../tl -DIST_TUPLE += github charliermarsh rs-async-zip ${ASYNC_ZIP} . -DIST_TUPLE += github astral-sh pubgrub ${PUBGRUB} . -DIST_TUPLE += github astral-sh reqwest-middleware ${REQWEST_MIDDLEWARE} . -DIST_TUPLE += github astral-sh tl ${TL} . - # XXX - can we avoid this? MODCARGO_CRATES_KEEP = lzma-sys @@ -30,9 +29,6 @@ MODULES = devel/cargo CONFIGURE_STYLE = cargo MODCARGO_INSTALL_TARGET_PATHS = crates/uv-cli - -post-patch: - ${SUBST_CMD} ${WRKSRC}/Cargo.toml do-install: ${INSTALL_PROGRAM} ${WRKSRC}/target/release/uv ${PREFIX}/bin/uv diff -pu ./patches/patch-Cargo_toml.orig ./patches/patch-Cargo_toml --- patches/patch-Cargo_toml.orig Thu Jul 3 21:48:31 2025 +++ ./patches/patch-Cargo_toml Fri Jul 4 11:03:27 2025 @@ -6,7 +6,7 @@ Index: Cargo.toml async-trait = { version = "0.1.82" } async_http_range_reader = { version = "0.9.1" } -async_zip = { git = "https://github.com/charliermarsh/rs-async-zip", rev = "c909fda63fcafe4af496a07bfda28a5aae97e58d", features = ["bzip2", "deflate", "lzma", "tokio", "xz", "zstd"] } -+async_zip = { path = "../rs-async-zip-${ASYNC_ZIP}", features = ["bzip2", "deflate", "lzma", "tokio", "xz", "zstd"] } ++async_zip = { path = "../rs-async-zip", features = ["bzip2", "deflate", "lzma", "tokio", "xz", "zstd"] } axoupdater = { version = "0.9.0", default-features = false } backon = { version = "1.3.0" } base64 = { version = "0.22.1" } @@ -15,7 +15,7 @@ Index: Cargo.toml proc-macro2 = { version = "1.0.86" } procfs = { version = "0.17.0", default-features = false, features = ["flate2"] } -pubgrub = { git = "https://github.com/astral-sh/pubgrub", rev = "06ec5a5f59ffaeb6cf5079c6cb184467da06c9db" } -+pubgrub = { path = "../pubgrub-${PUBGRUB}" } ++pubgrub = { path = "../pubgrub" } quote = { version = "1.0.37" } rayon = { version = "1.10.0" } ref-cast = { version = "1.0.24" } @@ -25,8 +25,8 @@ Index: Cargo.toml reqwest = { version = "=0.12.15", default-features = false, features = ["json", "gzip", "deflate", "zstd", "stream", "rustls-tls", "rustls-tls-native-roots", "socks", "multipart", "http2", "blocking"] } -reqwest-middleware = { git = "https://github.com/astral-sh/reqwest-middleware", rev = "ad8b9d332d1773fde8b4cd008486de5973e0a3f8", features = ["multipart"] } -reqwest-retry = { git = "https://github.com/astral-sh/reqwest-middleware", rev = "ad8b9d332d1773fde8b4cd008486de5973e0a3f8" } -+reqwest-middleware = { path = "../reqwest-middleware-${REQWEST_MIDDLEWARE}/reqwest-middleware", features = ["multipart"] } -+reqwest-retry = { path = "../reqwest-middleware-${REQWEST_MIDDLEWARE}/reqwest-retry" } ++reqwest-middleware = { path = "../reqwest-middleware/reqwest-middleware", features = ["multipart"] } ++reqwest-retry = { path = "../reqwest-middleware/reqwest-retry" } rkyv = { version = "0.8.8", features = ["bytecheck"] } rmp-serde = { version = "1.3.0" } rust-netrc = { version = "0.1.2" } @@ -35,7 +35,7 @@ Index: Cargo.toml textwrap = { version = "0.16.1" } thiserror = { version = "2.0.0" } -tl = { git = "https://github.com/astral-sh/tl.git", rev = "6e25b2ee2513d75385101a8ff9f591ef51f314ec" } -+tl = { path = "../tl-${TL}/"} ++tl = { path = "../tl/"} tokio = { version = "1.40.0", features = ["fs", "io-util", "macros", "process", "rt", "signal", "sync"] } tokio-stream = { version = "0.1.16" } tokio-util = { version = "0.7.12", features = ["compat", "io"] } @@ -44,7 +44,7 @@ Index: Cargo.toml unscanny = { version = "0.1.0" } url = { version = "2.5.2", features = ["serde"] } -version-ranges = { git = "https://github.com/astral-sh/pubgrub", rev = "06ec5a5f59ffaeb6cf5079c6cb184467da06c9db" } -+version-ranges = { path = "../pubgrub-${PUBGRUB}/version-ranges" } ++version-ranges = { path = "../pubgrub/version-ranges" } walkdir = { version = "2.5.0" } which = { version = "8.0.0", features = ["regex"] } windows = { version = "0.59.0", features = ["Win32_Storage_FileSystem"] } @@ -54,5 +54,5 @@ Index: Cargo.toml [patch.crates-io] -reqwest-middleware = { git = "https://github.com/astral-sh/reqwest-middleware", rev = "ad8b9d332d1773fde8b4cd008486de5973e0a3f8" } -reqwest-retry = { git = "https://github.com/astral-sh/reqwest-middleware", rev = "ad8b9d332d1773fde8b4cd008486de5973e0a3f8" } -+reqwest-middleware = { path = "../reqwest-middleware-${REQWEST_MIDDLEWARE}/reqwest-middleware" } -+reqwest-retry = { path = "../reqwest-middleware-${REQWEST_MIDDLEWARE}/reqwest-retry" } ++reqwest-middleware = { path = "../reqwest-middleware/reqwest-middleware" } ++reqwest-retry = { path = "../reqwest-middleware/reqwest-retry" }