diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2024-08-06 15:56:34 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-08-06 15:56:34 -0300 |
| commit | 9bc589914dddd1ad393e20a024ca604a4a75a485 (patch) | |
| tree | c359e3853941b5dfc580eadf2a8f4ef96c4620d6 | |
| parent | 7b077e55ae8352289c6e65c72bf274f3f102c80c (diff) | |
| download | luarocks-teal-convert-dependencies.tar.gz luarocks-teal-convert-dependencies.tar.bz2 luarocks-teal-convert-dependencies.zip | |
fix: storage of queries in convert_dependenciesteal-convert-dependencies
| -rw-r--r-- | src/luarocks/core/types/rockspec.tl | 16 | ||||
| -rw-r--r-- | src/luarocks/rockspecs.tl | 15 |
2 files changed, 11 insertions, 20 deletions
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 | |||
| 77 | -- when converted: | 77 | -- when converted: |
| 78 | queries: {Query} | 78 | queries: {Query} |
| 79 | end | 79 | end |
| 80 | |||
| 81 | record BuildDependencies | ||
| 82 | {string} | ||
| 83 | queries: {Query} | ||
| 84 | end | ||
| 85 | 80 | ||
| 86 | record ExternalDependencies | 81 | record ExternalDependencies |
| 87 | {string} | 82 | {string} |
| 88 | queries: {string: Query} | 83 | queries: {string: Query} |
| 89 | end | 84 | end |
| 90 | 85 | ||
| 91 | record TestDependencies | ||
| 92 | {string} | ||
| 93 | queries: {Query} | ||
| 94 | end | ||
| 95 | |||
| 96 | record Hooks | 86 | record Hooks |
| 97 | post_install: string | 87 | post_install: string |
| 98 | 88 | ||
| @@ -113,8 +103,8 @@ local record rockspec | |||
| 113 | description: Description | 103 | description: Description |
| 114 | build: Build | 104 | build: Build |
| 115 | dependencies: Dependencies | 105 | dependencies: Dependencies |
| 116 | build_dependencies: BuildDependencies | 106 | build_dependencies: Dependencies |
| 117 | test_dependencies: TestDependencies | 107 | test_dependencies: Dependencies |
| 118 | supported_platforms: {string} | 108 | supported_platforms: {string} |
| 119 | external_dependencies: ExternalDependencies | 109 | external_dependencies: ExternalDependencies |
| 120 | variables: Variables | 110 | 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") | |||
| 11 | local vers = require("luarocks.core.vers") | 11 | local vers = require("luarocks.core.vers") |
| 12 | 12 | ||
| 13 | local rock = require("luarocks.core.types.rockspec") | 13 | local rock = require("luarocks.core.types.rockspec") |
| 14 | local type Dependencies = rock.Dependencies | ||
| 14 | local type Rockspec = rock.Rockspec | 15 | local type Rockspec = rock.Rockspec |
| 15 | local type Variables = rock.Variables | 16 | local type Variables = rock.Variables |
| 16 | 17 | ||
| @@ -64,9 +65,9 @@ local function platform_overrides(tbl?: {any: any}) | |||
| 64 | tbl.platforms = nil | 65 | tbl.platforms = nil |
| 65 | end | 66 | end |
| 66 | 67 | ||
| 67 | local function convert_dependencies(dependencies: {string}): {Query}, string | 68 | local function convert_dependencies(dependencies: Dependencies): boolean, string |
| 68 | if not dependencies then | 69 | if not dependencies then |
| 69 | return {} | 70 | return true |
| 70 | end | 71 | end |
| 71 | local qs: {Query} = {} | 72 | local qs: {Query} = {} |
| 72 | for i = 1, #dependencies do | 73 | for i = 1, #dependencies do |
| @@ -76,7 +77,8 @@ local function convert_dependencies(dependencies: {string}): {Query}, string | |||
| 76 | end | 77 | end |
| 77 | qs[i] = parsed | 78 | qs[i] = parsed |
| 78 | end | 79 | end |
| 79 | return qs | 80 | dependencies.queries = qs |
| 81 | return true | ||
| 80 | end | 82 | end |
| 81 | 83 | ||
| 82 | --- Set up path-related variables for a given rock. | 84 | --- Set up path-related variables for a given rock. |
| @@ -151,18 +153,17 @@ function rockspecs.from_persisted_table(filename: string, rockspec: Rockspec, gl | |||
| 151 | 153 | ||
| 152 | rockspec.rocks_provided = util.get_rocks_provided(rockspec) | 154 | rockspec.rocks_provided = util.get_rocks_provided(rockspec) |
| 153 | 155 | ||
| 154 | local err: string | 156 | local ok, err = convert_dependencies(rockspec.dependencies) |
| 155 | rockspec.dependencies.queries, err = convert_dependencies(rockspec.dependencies) | ||
| 156 | if err then | 157 | if err then |
| 157 | return nil, err | 158 | return nil, err |
| 158 | end | 159 | end |
| 159 | 160 | ||
| 160 | rockspec.build_dependencies.queries, err = convert_dependencies(rockspec.build_dependencies) | 161 | ok, err = convert_dependencies(rockspec.build_dependencies) |
| 161 | if err then | 162 | if err then |
| 162 | return nil, err | 163 | return nil, err |
| 163 | end | 164 | end |
| 164 | 165 | ||
| 165 | rockspec.test_dependencies.queries, err = convert_dependencies(rockspec.test_dependencies) | 166 | ok, err = convert_dependencies(rockspec.test_dependencies) |
| 166 | if err then | 167 | if err then |
| 167 | return nil, err | 168 | return nil, err |
| 168 | end | 169 | end |
