From 9bc589914dddd1ad393e20a024ca604a4a75a485 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 6 Aug 2024 15:56:34 -0300 Subject: fix: storage of queries in convert_dependencies --- src/luarocks/core/types/rockspec.tl | 16 +++------------- src/luarocks/rockspecs.tl | 15 ++++++++------- 2 files changed, 11 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/luarocks/core/types/rockspec.tl b/src/luarocks/core/types/rockspec.tl index b9ed54de..96464d3c 100644 --- a/src/luarocks/core/types/rockspec.tl +++ b/src/luarocks/core/types/rockspec.tl @@ -77,22 +77,12 @@ local record rockspec -- when converted: queries: {Query} end - - record BuildDependencies - {string} - queries: {Query} - end record ExternalDependencies {string} queries: {string: Query} end - - record TestDependencies - {string} - queries: {Query} - end - + record Hooks post_install: string @@ -113,8 +103,8 @@ local record rockspec description: Description build: Build dependencies: Dependencies - build_dependencies: BuildDependencies - test_dependencies: TestDependencies + build_dependencies: Dependencies + test_dependencies: Dependencies supported_platforms: {string} external_dependencies: ExternalDependencies variables: Variables diff --git a/src/luarocks/rockspecs.tl b/src/luarocks/rockspecs.tl index 1a782b0c..ab946e97 100644 --- a/src/luarocks/rockspecs.tl +++ b/src/luarocks/rockspecs.tl @@ -11,6 +11,7 @@ local util = require("luarocks.util") local vers = require("luarocks.core.vers") local rock = require("luarocks.core.types.rockspec") +local type Dependencies = rock.Dependencies local type Rockspec = rock.Rockspec local type Variables = rock.Variables @@ -64,9 +65,9 @@ local function platform_overrides(tbl?: {any: any}) tbl.platforms = nil end -local function convert_dependencies(dependencies: {string}): {Query}, string +local function convert_dependencies(dependencies: Dependencies): boolean, string if not dependencies then - return {} + return true end local qs: {Query} = {} for i = 1, #dependencies do @@ -76,7 +77,8 @@ local function convert_dependencies(dependencies: {string}): {Query}, string end qs[i] = parsed end - return qs + dependencies.queries = qs + return true end --- Set up path-related variables for a given rock. @@ -151,18 +153,17 @@ function rockspecs.from_persisted_table(filename: string, rockspec: Rockspec, gl rockspec.rocks_provided = util.get_rocks_provided(rockspec) - local err: string - rockspec.dependencies.queries, err = convert_dependencies(rockspec.dependencies) + local ok, err = convert_dependencies(rockspec.dependencies) if err then return nil, err end - rockspec.build_dependencies.queries, err = convert_dependencies(rockspec.build_dependencies) + ok, err = convert_dependencies(rockspec.build_dependencies) if err then return nil, err end - rockspec.test_dependencies.queries, err = convert_dependencies(rockspec.test_dependencies) + ok, err = convert_dependencies(rockspec.test_dependencies) if err then return nil, err end -- cgit v1.2.3-55-g6feb