From 5d0213ac55017e0453f83513ff6554c5c93d7f2b Mon Sep 17 00:00:00 2001 From: Yureka Date: Wed, 7 May 2025 09:25:21 +0200 Subject: [PATCH] lix-doc: remove meson pre-1.5 hacks Change-Id: I9786d59fc849ae93643d6128ebd598d9de8637f6 Signed-off-by: Yureka --- lix/lix-doc/meson.build | 12 ++------- lix/lix-doc/package.nix | 8 ------ meson.build | 29 +--------------------- meson/cargo-lock-to-wraps.py | 43 --------------------------------- subprojects/autocfg-rs.wrap | 6 ----- subprojects/countme-rs.wrap | 6 ----- subprojects/dissimilar-rs.wrap | 6 ----- subprojects/expect-test-rs.wrap | 6 ----- subprojects/hashbrown-rs.wrap | 6 ----- subprojects/memoffset-rs.wrap | 6 ----- subprojects/once_cell-rs.wrap | 6 ----- subprojects/rnix-rs.wrap | 6 ----- subprojects/rowan-rs.wrap | 6 ----- subprojects/rustc-hash-rs.wrap | 6 ----- subprojects/text-size-rs.wrap | 6 ----- 15 files changed, 3 insertions(+), 155 deletions(-) delete mode 100644 lix/lix-doc/package.nix delete mode 100755 meson/cargo-lock-to-wraps.py delete mode 100644 subprojects/autocfg-rs.wrap delete mode 100644 subprojects/countme-rs.wrap delete mode 100644 subprojects/dissimilar-rs.wrap delete mode 100644 subprojects/expect-test-rs.wrap delete mode 100644 subprojects/hashbrown-rs.wrap delete mode 100644 subprojects/memoffset-rs.wrap delete mode 100644 subprojects/once_cell-rs.wrap delete mode 100644 subprojects/rnix-rs.wrap delete mode 100644 subprojects/rowan-rs.wrap delete mode 100644 subprojects/rustc-hash-rs.wrap delete mode 100644 subprojects/text-size-rs.wrap diff --git a/lix/lix-doc/meson.build b/lix/lix-doc/meson.build index 132feebf3..586045769 100644 --- a/lix/lix-doc/meson.build +++ b/lix/lix-doc/meson.build @@ -1,13 +1,5 @@ -# FIXME: remove hack once we get rid of meson 1.4 -rnix_name = 'rnix-0.11-rs' -rowan_name = 'rowan-0.15-rs' -if meson.version().version_compare('< 1.5') - rnix_name = 'rnix-rs' - rowan_name = 'rowan-rs' -endif - -rnix = dependency(rnix_name) -rowan = dependency(rowan_name) +rnix = dependency('rnix-0.11-rs') +rowan = dependency('rowan-0.15-rs') lix_doc = static_library( 'lix_doc', diff --git a/lix/lix-doc/package.nix b/lix/lix-doc/package.nix deleted file mode 100644 index d3896e726..000000000 --- a/lix/lix-doc/package.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ rustPlatform, lib }: - -rustPlatform.buildRustPackage { - name = "lix-doc"; - - cargoLock.lockFile = ./Cargo.lock; - src = lib.cleanSource ./.; -} diff --git a/meson.build b/meson.build index f5c00b6c7..8940ca651 100644 --- a/meson.build +++ b/meson.build @@ -46,7 +46,7 @@ # in the build directory. project('lix', 'cpp', 'rust', - meson_version : '>=1.4.0', + meson_version : '>=1.5.0', version : run_command('bash', '-c', 'echo -n $(jq -r .version < ./version.json)$VERSION_SUFFIX', check : true).stdout().strip(), default_options : [ 'cpp_std=c++23', @@ -606,33 +606,6 @@ if cxx.get_id() in ['clang', 'gcc'] ) endif -# Until Meson 1.5ยน, we can't just give Meson a Cargo.lock file and be done with it. -# Meson will *detect* what dependencies are needed from Cargo files; it just won't -# fetch them. The Meson 1.5 feature essentially internally translates Cargo.lock entries -# to .wrap files, and that translation is incredibly straightforward, so let's just -# use a simple Python script to generate the .wrap files ourselves while we wait for -# Meson 1.5. Weirdly, it seems Meson will only detect dependencies from other -# dependency() calls, so we have to specify lix-doc's two top-level dependencies, -# rnix and rowan, manually, and then their dependencies will be recursively translated -# into more dependency() calls. -# -# When Meson translates a Cargo dependency, the string passed to `dependency()` follows -# a fixed format, which is important as the .wrap files' basenames must match the string -# passed to `dependency()` exactly. -# In Meson 1.4, this format is `$packageName-rs`. Meson 1.5 changes this to -# `$packageName-$shortenedVersionString-rs`, because of course it does, but we'll cross -# that bridge when we get there... -# -# [1]: https://github.com/mesonbuild/meson/commit/9b8378985dbdc0112d11893dd42b33b7bc8d1e62 -# FIXME: remove (along with its generated wrap files) when we get rid of meson 1.4 -run_command( - python, - meson.project_source_root() / 'meson/cargo-lock-to-wraps.py', - meson.project_source_root() / 'Cargo.lock', - meson.project_source_root() / 'subprojects', - check : true, -) - if is_darwin fs.copyfile( 'misc/launchd/org.nixos.nix-daemon.plist.in', diff --git a/meson/cargo-lock-to-wraps.py b/meson/cargo-lock-to-wraps.py deleted file mode 100755 index 811d7a219..000000000 --- a/meson/cargo-lock-to-wraps.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import tomllib -import sys - -DOWNLOAD_URI_FORMAT = 'https://crates.io/api/v1/crates/{crate}/{version}/download' - -WRAP_TEMPLATE = """ -[wrap-file] -method = cargo -directory = {crate}-{version} -source_url = {url} -source_filename = {crate}-{version}.tar.gz -source_hash = {hash} -""".lstrip() - -parser = argparse.ArgumentParser() -parser.add_argument('lockfile', help='path to the Cargo lockfile to generate wraps from') -parser.add_argument('outdir', help="the 'subprojects' directory to write .wrap files to") - -args = parser.parse_args() - -with open(args.lockfile, 'rb') as f: - lock_toml = tomllib.load(f) - -for dependency in lock_toml['package']: - try: - hash = dependency['checksum'] - except KeyError: - # The base package, e.g. lix-doc, won't have a checksum, and conveniently - # the base package is also not something we want a wrap file for. - # Doesn't that work out nicely? - continue - - crate = dependency['name'] - version = dependency['version'] - - url = DOWNLOAD_URI_FORMAT.format(crate=crate, version=version) - - wrap_text = WRAP_TEMPLATE.format(crate=crate, version=version, url=url, hash=hash) - with open(f'{args.outdir}/{crate}-rs.wrap', 'w') as f: - f.write(wrap_text) diff --git a/subprojects/autocfg-rs.wrap b/subprojects/autocfg-rs.wrap deleted file mode 100644 index 8e988f41e..000000000 --- a/subprojects/autocfg-rs.wrap +++ /dev/null @@ -1,6 +0,0 @@ -[wrap-file] -method = cargo -directory = autocfg-1.1.0 -source_url = https://crates.io/api/v1/crates/autocfg/1.1.0/download -source_filename = autocfg-1.1.0.tar.gz -source_hash = d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa diff --git a/subprojects/countme-rs.wrap b/subprojects/countme-rs.wrap deleted file mode 100644 index e160e34c0..000000000 --- a/subprojects/countme-rs.wrap +++ /dev/null @@ -1,6 +0,0 @@ -[wrap-file] -method = cargo -directory = countme-3.0.1 -source_url = https://crates.io/api/v1/crates/countme/3.0.1/download -source_filename = countme-3.0.1.tar.gz -source_hash = 7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636 diff --git a/subprojects/dissimilar-rs.wrap b/subprojects/dissimilar-rs.wrap deleted file mode 100644 index 5617b775b..000000000 --- a/subprojects/dissimilar-rs.wrap +++ /dev/null @@ -1,6 +0,0 @@ -[wrap-file] -method = cargo -directory = dissimilar-1.0.9 -source_url = https://crates.io/api/v1/crates/dissimilar/1.0.9/download -source_filename = dissimilar-1.0.9.tar.gz -source_hash = 59f8e79d1fbf76bdfbde321e902714bf6c49df88a7dda6fc682fc2979226962d diff --git a/subprojects/expect-test-rs.wrap b/subprojects/expect-test-rs.wrap deleted file mode 100644 index 701c5f0c5..000000000 --- a/subprojects/expect-test-rs.wrap +++ /dev/null @@ -1,6 +0,0 @@ -[wrap-file] -method = cargo -directory = expect-test-1.5.0 -source_url = https://crates.io/api/v1/crates/expect-test/1.5.0/download -source_filename = expect-test-1.5.0.tar.gz -source_hash = 9e0be0a561335815e06dab7c62e50353134c796e7a6155402a64bcff66b6a5e0 diff --git a/subprojects/hashbrown-rs.wrap b/subprojects/hashbrown-rs.wrap deleted file mode 100644 index d2876225a..000000000 --- a/subprojects/hashbrown-rs.wrap +++ /dev/null @@ -1,6 +0,0 @@ -[wrap-file] -method = cargo -directory = hashbrown-0.14.5 -source_url = https://crates.io/api/v1/crates/hashbrown/0.14.5/download -source_filename = hashbrown-0.14.5.tar.gz -source_hash = e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1 diff --git a/subprojects/memoffset-rs.wrap b/subprojects/memoffset-rs.wrap deleted file mode 100644 index e9cc37422..000000000 --- a/subprojects/memoffset-rs.wrap +++ /dev/null @@ -1,6 +0,0 @@ -[wrap-file] -method = cargo -directory = memoffset-0.9.1 -source_url = https://crates.io/api/v1/crates/memoffset/0.9.1/download -source_filename = memoffset-0.9.1.tar.gz -source_hash = 488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a diff --git a/subprojects/once_cell-rs.wrap b/subprojects/once_cell-rs.wrap deleted file mode 100644 index 03345d388..000000000 --- a/subprojects/once_cell-rs.wrap +++ /dev/null @@ -1,6 +0,0 @@ -[wrap-file] -method = cargo -directory = once_cell-1.19.0 -source_url = https://crates.io/api/v1/crates/once_cell/1.19.0/download -source_filename = once_cell-1.19.0.tar.gz -source_hash = 3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92 diff --git a/subprojects/rnix-rs.wrap b/subprojects/rnix-rs.wrap deleted file mode 100644 index b06f72336..000000000 --- a/subprojects/rnix-rs.wrap +++ /dev/null @@ -1,6 +0,0 @@ -[wrap-file] -method = cargo -directory = rnix-0.11.0 -source_url = https://crates.io/api/v1/crates/rnix/0.11.0/download -source_filename = rnix-0.11.0.tar.gz -source_hash = bb35cedbeb70e0ccabef2a31bcff0aebd114f19566086300b8f42c725fc2cb5f diff --git a/subprojects/rowan-rs.wrap b/subprojects/rowan-rs.wrap deleted file mode 100644 index 1baf3f9f2..000000000 --- a/subprojects/rowan-rs.wrap +++ /dev/null @@ -1,6 +0,0 @@ -[wrap-file] -method = cargo -directory = rowan-0.15.16 -source_url = https://crates.io/api/v1/crates/rowan/0.15.16/download -source_filename = rowan-0.15.16.tar.gz -source_hash = 0a542b0253fa46e632d27a1dc5cf7b930de4df8659dc6e720b647fc72147ae3d diff --git a/subprojects/rustc-hash-rs.wrap b/subprojects/rustc-hash-rs.wrap deleted file mode 100644 index 105234788..000000000 --- a/subprojects/rustc-hash-rs.wrap +++ /dev/null @@ -1,6 +0,0 @@ -[wrap-file] -method = cargo -directory = rustc-hash-1.1.0 -source_url = https://crates.io/api/v1/crates/rustc-hash/1.1.0/download -source_filename = rustc-hash-1.1.0.tar.gz -source_hash = 08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2 diff --git a/subprojects/text-size-rs.wrap b/subprojects/text-size-rs.wrap deleted file mode 100644 index 8c7f1f4fe..000000000 --- a/subprojects/text-size-rs.wrap +++ /dev/null @@ -1,6 +0,0 @@ -[wrap-file] -method = cargo -directory = text-size-1.1.1 -source_url = https://crates.io/api/v1/crates/text-size/1.1.1/download -source_filename = text-size-1.1.1.tar.gz -source_hash = f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233