diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2015-04-18 14:35:39 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2015-04-18 14:35:39 -0300 |
| commit | cda43ce50660aa55aeb2c4d2d8e724f17fa7f863 (patch) | |
| tree | c0101d344da23143e27c5897f8e5898197d4e22c | |
| parent | 022c87d98ee1605e98d880f461297b0934a90719 (diff) | |
| parent | b6b67547ef5801502f1b63ec62c04923ceb77cef (diff) | |
| download | luarocks-cda43ce50660aa55aeb2c4d2d8e724f17fa7f863.tar.gz luarocks-cda43ce50660aa55aeb2c4d2d8e724f17fa7f863.tar.bz2 luarocks-cda43ce50660aa55aeb2c4d2d8e724f17fa7f863.zip | |
Merge branch 'master' of https://github.com/keplerproject/luarocks
| -rw-r--r-- | .travis.yml | 2 | ||||
| -rw-r--r-- | Makefile.setup.inc | 2 | ||||
| -rw-r--r-- | src/luarocks/build.lua | 36 | ||||
| -rw-r--r-- | src/luarocks/fetch/git_https.lua | 7 | ||||
| -rw-r--r-- | src/luarocks/install.lua | 49 | ||||
| -rw-r--r-- | src/luarocks/util.lua | 1 | ||||
| -rw-r--r-- | test/testing.lua | 12 | ||||
| -rwxr-xr-x | test/testing.sh | 5 | ||||
| -rw-r--r-- | win32/pe-parser.lua | 12 |
9 files changed, 107 insertions, 19 deletions
diff --git a/.travis.yml b/.travis.yml index 54778583..db762a84 100644 --- a/.travis.yml +++ b/.travis.yml | |||
| @@ -2,6 +2,8 @@ language: c | |||
| 2 | 2 | ||
| 3 | compiler: gcc | 3 | compiler: gcc |
| 4 | 4 | ||
| 5 | sudo: false | ||
| 6 | |||
| 5 | env: | 7 | env: |
| 6 | matrix: | 8 | matrix: |
| 7 | - LUA_VER=5.1.5 | 9 | - LUA_VER=5.1.5 |
diff --git a/Makefile.setup.inc b/Makefile.setup.inc index ef498e9b..0384a097 100644 --- a/Makefile.setup.inc +++ b/Makefile.setup.inc | |||
| @@ -16,5 +16,5 @@ help.lua util.lua index.lua cache.lua refresh_cache.lua loader.lua \ | |||
| 16 | admin_remove.lua fetch/hg.lua fetch/git_file.lua new_version.lua lint.lua \ | 16 | admin_remove.lua fetch/hg.lua fetch/git_file.lua new_version.lua lint.lua \ |
| 17 | purge.lua path.lua path_cmd.lua write_rockspec.lua doc.lua upload.lua \ | 17 | purge.lua path.lua path_cmd.lua write_rockspec.lua doc.lua upload.lua \ |
| 18 | upload/api.lua upload/multipart.lua fetch/git_http.lua fetch/hg_http.lua \ | 18 | upload/api.lua upload/multipart.lua fetch/git_http.lua fetch/hg_http.lua \ |
| 19 | fetch/hg_https.lua fetch/hg_ssh.lua | 19 | fetch/hg_https.lua fetch/hg_ssh.lua fetch/git_https.lua |
| 20 | 20 | ||
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index 96191b11..977be344 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
| @@ -37,6 +37,8 @@ or the name of a rock to be fetched from a repository. | |||
| 37 | rockspec. Allows to specify a different branch to | 37 | rockspec. Allows to specify a different branch to |
| 38 | fetch. Particularly for SCM rocks. | 38 | fetch. Particularly for SCM rocks. |
| 39 | 39 | ||
| 40 | --only-deps Installs only the dependencies of the rock. | ||
| 41 | |||
| 40 | ]]..util.deps_mode_help() | 42 | ]]..util.deps_mode_help() |
| 41 | 43 | ||
| 42 | --- Install files to a given location. | 44 | --- Install files to a given location. |
| @@ -157,9 +159,10 @@ end | |||
| 157 | -- @param deps_mode string: Dependency mode: "one" for the current default tree, | 159 | -- @param deps_mode string: Dependency mode: "one" for the current default tree, |
| 158 | -- "all" for all trees, "order" for all trees with priority >= the current default, | 160 | -- "all" for all trees, "order" for all trees with priority >= the current default, |
| 159 | -- "none" for no trees. | 161 | -- "none" for no trees. |
| 162 | -- @param build_only_deps boolean: true to build the listed dependencies only. | ||
| 160 | -- @return (string, string) or (nil, string, [string]): Name and version of | 163 | -- @return (string, string) or (nil, string, [string]): Name and version of |
| 161 | -- installed rock if succeeded or nil and an error message followed by an error code. | 164 | -- installed rock if succeeded or nil and an error message followed by an error code. |
| 162 | function build.build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_mode) | 165 | function build.build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_mode, build_only_deps) |
| 163 | assert(type(rockspec_file) == "string") | 166 | assert(type(rockspec_file) == "string") |
| 164 | assert(type(need_to_fetch) == "boolean") | 167 | assert(type(need_to_fetch) == "boolean") |
| 165 | 168 | ||
| @@ -181,13 +184,19 @@ function build.build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_m | |||
| 181 | end | 184 | end |
| 182 | end | 185 | end |
| 183 | 186 | ||
| 187 | local name, version = rockspec.name, rockspec.version | ||
| 188 | if build_only_deps then | ||
| 189 | util.printout("Stopping after installing dependencies for " ..name.." "..version) | ||
| 190 | util.printout() | ||
| 191 | return name, version | ||
| 192 | end | ||
| 193 | |||
| 184 | local ok | 194 | local ok |
| 185 | ok, err, errcode = deps.check_external_deps(rockspec, "build") | 195 | ok, err, errcode = deps.check_external_deps(rockspec, "build") |
| 186 | if err then | 196 | if err then |
| 187 | return nil, err, errcode | 197 | return nil, err, errcode |
| 188 | end | 198 | end |
| 189 | 199 | ||
| 190 | local name, version = rockspec.name, rockspec.version | ||
| 191 | if repos.is_installed(name, version) then | 200 | if repos.is_installed(name, version) then |
| 192 | repos.delete_version(name, version) | 201 | repos.delete_version(name, version) |
| 193 | end | 202 | end |
| @@ -341,9 +350,10 @@ end | |||
| 341 | -- @param deps_mode: string: Which trees to check dependencies for: | 350 | -- @param deps_mode: string: Which trees to check dependencies for: |
| 342 | -- "one" for the current default tree, "all" for all trees, | 351 | -- "one" for the current default tree, "all" for all trees, |
| 343 | -- "order" for all trees with priority >= the current default, "none" for no trees. | 352 | -- "order" for all trees with priority >= the current default, "none" for no trees. |
| 353 | -- @param build_only_deps boolean: true to build the listed dependencies only. | ||
| 344 | -- @return boolean or (nil, string, [string]): True if build was successful, | 354 | -- @return boolean or (nil, string, [string]): True if build was successful, |
| 345 | -- or false and an error message and an optional error code. | 355 | -- or false and an error message and an optional error code. |
| 346 | function build.build_rock(rock_file, need_to_fetch, deps_mode) | 356 | function build.build_rock(rock_file, need_to_fetch, deps_mode, build_only_deps) |
| 347 | assert(type(rock_file) == "string") | 357 | assert(type(rock_file) == "string") |
| 348 | assert(type(need_to_fetch) == "boolean") | 358 | assert(type(need_to_fetch) == "boolean") |
| 349 | 359 | ||
| @@ -356,24 +366,25 @@ function build.build_rock(rock_file, need_to_fetch, deps_mode) | |||
| 356 | local rockspec_file = path.rockspec_name_from_rock(rock_file) | 366 | local rockspec_file = path.rockspec_name_from_rock(rock_file) |
| 357 | ok, err = fs.change_dir(unpack_dir) | 367 | ok, err = fs.change_dir(unpack_dir) |
| 358 | if not ok then return nil, err end | 368 | if not ok then return nil, err end |
| 359 | ok, err, errcode = build.build_rockspec(rockspec_file, need_to_fetch, false, deps_mode) | 369 | ok, err, errcode = build.build_rockspec(rockspec_file, need_to_fetch, false, deps_mode, build_only_deps) |
| 360 | fs.pop_dir() | 370 | fs.pop_dir() |
| 361 | return ok, err, errcode | 371 | return ok, err, errcode |
| 362 | end | 372 | end |
| 363 | 373 | ||
| 364 | local function do_build(name, version, deps_mode) | 374 | local function do_build(name, version, deps_mode, build_only_deps) |
| 365 | if name:match("%.rockspec$") then | 375 | if name:match("%.rockspec$") then |
| 366 | return build.build_rockspec(name, true, false, deps_mode) | 376 | return build.build_rockspec(name, true, false, deps_mode, build_only_deps) |
| 367 | elseif name:match("%.src%.rock$") then | 377 | elseif name:match("%.src%.rock$") then |
| 368 | return build.build_rock(name, false, deps_mode) | 378 | return build.build_rock(name, false, deps_mode, build_only_deps) |
| 369 | elseif name:match("%.all%.rock$") then | 379 | elseif name:match("%.all%.rock$") then |
| 370 | local install = require("luarocks.install") | 380 | local install = require("luarocks.install") |
| 371 | return install.install_binary_rock(name, deps_mode) | 381 | local install_fun = build_only_deps and install.install_binary_rock_deps or install.install_binary_rock |
| 382 | return install_fun(name, deps_mode) | ||
| 372 | elseif name:match("%.rock$") then | 383 | elseif name:match("%.rock$") then |
| 373 | return build.build_rock(name, true, deps_mode) | 384 | return build.build_rock(name, true, deps_mode, build_only_deps) |
| 374 | elseif not name:match(dir.separator) then | 385 | elseif not name:match(dir.separator) then |
| 375 | local search = require("luarocks.search") | 386 | local search = require("luarocks.search") |
| 376 | return search.act_on_src_or_rockspec(build.run, name:lower(), version, deps.deps_mode_to_flag(deps_mode)) | 387 | return search.act_on_src_or_rockspec(build.run, name:lower(), version, deps.deps_mode_to_flag(deps_mode), build_only_deps and "--only-deps") |
| 377 | end | 388 | end |
| 378 | return nil, "Don't know what to do with "..name | 389 | return nil, "Don't know what to do with "..name |
| 379 | end | 390 | end |
| @@ -398,9 +409,12 @@ function build.run(...) | |||
| 398 | else | 409 | else |
| 399 | local ok, err = fs.check_command_permissions(flags) | 410 | local ok, err = fs.check_command_permissions(flags) |
| 400 | if not ok then return nil, err, cfg.errorcodes.PERMISSIONDENIED end | 411 | if not ok then return nil, err, cfg.errorcodes.PERMISSIONDENIED end |
| 401 | ok, err = do_build(name, version, deps.get_deps_mode(flags)) | 412 | ok, err = do_build(name, version, deps.get_deps_mode(flags), flags["only-deps"]) |
| 402 | if not ok then return nil, err end | 413 | if not ok then return nil, err end |
| 403 | local name, version = ok, err | 414 | local name, version = ok, err |
| 415 | if flags["only-deps"] then | ||
| 416 | return name, version | ||
| 417 | end | ||
| 404 | if (not flags["keep"]) and not cfg.keep_other_versions then | 418 | if (not flags["keep"]) and not cfg.keep_other_versions then |
| 405 | local ok, err = remove.remove_other_versions(name, version, flags["force"]) | 419 | local ok, err = remove.remove_other_versions(name, version, flags["force"]) |
| 406 | if not ok then util.printerr(err) end | 420 | if not ok then util.printerr(err) end |
diff --git a/src/luarocks/fetch/git_https.lua b/src/luarocks/fetch/git_https.lua new file mode 100644 index 00000000..67f8ad6c --- /dev/null +++ b/src/luarocks/fetch/git_https.lua | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | --- Fetch back-end for retrieving sources from Git repositories | ||
| 2 | -- that use https:// transport. For example, for fetching a repository | ||
| 3 | -- that requires the following command line: | ||
| 4 | -- `git clone https://example.com/foo.git` | ||
| 5 | -- you can use this in the rockspec: | ||
| 6 | -- source = { url = "git+https://example.com/foo.git" } | ||
| 7 | return require "luarocks.fetch.git_http" | ||
diff --git a/src/luarocks/install.lua b/src/luarocks/install.lua index 7678c0cc..6d457fc2 100644 --- a/src/luarocks/install.lua +++ b/src/luarocks/install.lua | |||
| @@ -26,6 +26,8 @@ or a filename of a locally available rock. | |||
| 26 | rock after installing a new one. This behavior can | 26 | rock after installing a new one. This behavior can |
| 27 | be made permanent by setting keep_other_versions=true | 27 | be made permanent by setting keep_other_versions=true |
| 28 | in the configuration file. | 28 | in the configuration file. |
| 29 | |||
| 30 | --only-deps Installs only the dependencies of the rock. | ||
| 29 | ]]..util.deps_mode_help() | 31 | ]]..util.deps_mode_help() |
| 30 | 32 | ||
| 31 | 33 | ||
| @@ -109,6 +111,43 @@ function install.install_binary_rock(rock_file, deps_mode) | |||
| 109 | return name, version | 111 | return name, version |
| 110 | end | 112 | end |
| 111 | 113 | ||
| 114 | --- Installs the dependencies of a binary rock. | ||
| 115 | -- @param rock_file string: local or remote filename of a rock. | ||
| 116 | -- @param deps_mode: string: Which trees to check dependencies for: | ||
| 117 | -- "one" for the current default tree, "all" for all trees, | ||
| 118 | -- "order" for all trees with priority >= the current default, "none" for no trees. | ||
| 119 | -- @return (string, string) or (nil, string, [string]): Name and version of | ||
| 120 | -- the rock whose dependencies were installed if succeeded or nil and an error message | ||
| 121 | -- followed by an error code. | ||
| 122 | function install.install_binary_rock_deps(rock_file, deps_mode) | ||
| 123 | assert(type(rock_file) == "string") | ||
| 124 | |||
| 125 | local name, version, arch = path.parse_name(rock_file) | ||
| 126 | if not name then | ||
| 127 | return nil, "Filename "..rock_file.." does not match format 'name-version-revision.arch.rock'." | ||
| 128 | end | ||
| 129 | |||
| 130 | if arch ~= "all" and arch ~= cfg.arch then | ||
| 131 | return nil, "Incompatible architecture "..arch, "arch" | ||
| 132 | end | ||
| 133 | |||
| 134 | local ok, err, errcode = fetch.fetch_and_unpack_rock(rock_file, path.install_dir(name, version)) | ||
| 135 | if not ok then return nil, err, errcode end | ||
| 136 | |||
| 137 | local rockspec, err, errcode = fetch.load_rockspec(path.rockspec_file(name, version)) | ||
| 138 | if err then | ||
| 139 | return nil, "Failed loading rockspec for installed package: "..err, errcode | ||
| 140 | end | ||
| 141 | |||
| 142 | ok, err, errcode = deps.fulfill_dependencies(rockspec, deps_mode) | ||
| 143 | if err then return nil, err, errcode end | ||
| 144 | |||
| 145 | util.printout() | ||
| 146 | util.printout("Succesfully installed dependencies for " ..name.." "..version) | ||
| 147 | |||
| 148 | return name, version | ||
| 149 | end | ||
| 150 | |||
| 112 | --- Driver function for the "install" command. | 151 | --- Driver function for the "install" command. |
| 113 | -- @param name string: name of a binary rock. If an URL or pathname | 152 | -- @param name string: name of a binary rock. If an URL or pathname |
| 114 | -- to a binary rock is given, fetches and installs it. If a rockspec or a | 153 | -- to a binary rock is given, fetches and installs it. If a rockspec or a |
| @@ -131,12 +170,16 @@ function install.run(...) | |||
| 131 | if name:match("%.rockspec$") or name:match("%.src%.rock$") then | 170 | if name:match("%.rockspec$") or name:match("%.src%.rock$") then |
| 132 | util.printout("Using "..name.."... switching to 'build' mode") | 171 | util.printout("Using "..name.."... switching to 'build' mode") |
| 133 | local build = require("luarocks.build") | 172 | local build = require("luarocks.build") |
| 134 | return build.run(name, util.forward_flags(flags, "local", "keep", "deps-mode")) | 173 | return build.run(name, util.forward_flags(flags, "local", "keep", "deps-mode", "only-deps")) |
| 135 | elseif name:match("%.rock$") then | 174 | elseif name:match("%.rock$") then |
| 136 | ok, err = install.install_binary_rock(name, deps.get_deps_mode(flags)) | 175 | if flags["only-deps"] then |
| 176 | ok, err = install.install_binary_rock_deps(name, deps.get_deps_mode(flags)) | ||
| 177 | else | ||
| 178 | ok, err = install.install_binary_rock(name, deps.get_deps_mode(flags)) | ||
| 179 | end | ||
| 137 | if not ok then return nil, err end | 180 | if not ok then return nil, err end |
| 138 | local name, version = ok, err | 181 | local name, version = ok, err |
| 139 | if (not flags["keep"]) and not cfg.keep_other_versions then | 182 | if (not flags["only-deps"]) and (not flags["keep"]) and not cfg.keep_other_versions then |
| 140 | local ok, err = remove.remove_other_versions(name, version, flags["force"]) | 183 | local ok, err = remove.remove_other_versions(name, version, flags["force"]) |
| 141 | if not ok then util.printerr(err) end | 184 | if not ok then util.printerr(err) end |
| 142 | end | 185 | end |
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index 366a7ace..682c99e9 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
| @@ -102,6 +102,7 @@ local supported_flags = { | |||
| 102 | ["no-refresh"] = true, | 102 | ["no-refresh"] = true, |
| 103 | ["nodeps"] = true, | 103 | ["nodeps"] = true, |
| 104 | ["old-versions"] = true, | 104 | ["old-versions"] = true, |
| 105 | ["only-deps"] = true, | ||
| 105 | ["only-from"] = "<server>", | 106 | ["only-from"] = "<server>", |
| 106 | ["only-server"] = "<server>", | 107 | ["only-server"] = "<server>", |
| 107 | ["only-sources"] = "<url>", | 108 | ["only-sources"] = "<url>", |
diff --git a/test/testing.lua b/test/testing.lua index 376d6e9a..86f3ab34 100644 --- a/test/testing.lua +++ b/test/testing.lua | |||
| @@ -140,6 +140,18 @@ local tests = { | |||
| 140 | and rm "./validate-args-${verrev_validate_args}.rockspec" | 140 | and rm "./validate-args-${verrev_validate_args}.rockspec" |
| 141 | end, | 141 | end, |
| 142 | test_build_supported_platforms = function() return run "$luarocks build lpty" end, | 142 | test_build_supported_platforms = function() return run "$luarocks build lpty" end, |
| 143 | test_build_only_deps_rockspec = function() | ||
| 144 | return run "$luarocks download --rockspec lxsh ${verrev_lxsh}" | ||
| 145 | and run "$luarocks build ./lxsh-${verrev_lxsh}.rockspec --only-deps" | ||
| 146 | and (not run "$luarocks show lxsh") | ||
| 147 | end, | ||
| 148 | test_build_only_deps_src_rock = function() | ||
| 149 | return run "$luarocks download --source lxsh ${verrev_lxsh}" | ||
| 150 | and run "$luarocks build ./lxsh-${verrev_lxsh}.src.rock --only-deps" | ||
| 151 | and (not run "$luarocks show lxsh") | ||
| 152 | end, | ||
| 153 | test_build_only_deps = function() return run "$luarocks build luasec --only-deps" and (not run "$luarocks show luasec") end, | ||
| 154 | test_install_only_deps = function() return run "$luarocks install lxsh ${verrev_lxsh} --only-deps" and (not run "$luarocks show lxsh") end, | ||
| 143 | fail_build_missing_external = function() return run '$luarocks build "$testing_dir/testfiles/missing_external-0.1-1.rockspec" INEXISTENT_INCDIR="/invalid/dir"' end, | 155 | fail_build_missing_external = function() return run '$luarocks build "$testing_dir/testfiles/missing_external-0.1-1.rockspec" INEXISTENT_INCDIR="/invalid/dir"' end, |
| 144 | fail_build_invalidpatch = function() | 156 | fail_build_invalidpatch = function() |
| 145 | need_luasocket() | 157 | need_luasocket() |
diff --git a/test/testing.sh b/test/testing.sh index b75b51d7..0fa6fe92 100755 --- a/test/testing.sh +++ b/test/testing.sh | |||
| @@ -249,6 +249,7 @@ mkdir -p "$testing_server" | |||
| 249 | get "$luarocks_repo/cprint-${verrev_cprint}.rockspec" | 249 | get "$luarocks_repo/cprint-${verrev_cprint}.rockspec" |
| 250 | get "$luarocks_repo/wsapi-1.6-1.src.rock" | 250 | get "$luarocks_repo/wsapi-1.6-1.src.rock" |
| 251 | get "$luarocks_repo/lxsh-${verrev_lxsh}.src.rock" | 251 | get "$luarocks_repo/lxsh-${verrev_lxsh}.src.rock" |
| 252 | get "$luarocks_repo/lxsh-${verrev_lxsh}.rockspec" | ||
| 252 | get "$luarocks_repo/abelhas-${verrev_abelhas}.rockspec" | 253 | get "$luarocks_repo/abelhas-${verrev_abelhas}.rockspec" |
| 253 | get "$luarocks_repo/lzlib-0.4.1.53-1.src.rock" | 254 | get "$luarocks_repo/lzlib-0.4.1.53-1.src.rock" |
| 254 | get "$luarocks_repo/lpeg-0.12-1.src.rock" | 255 | get "$luarocks_repo/lpeg-0.12-1.src.rock" |
| @@ -385,6 +386,10 @@ test_build_install_bin() { $luarocks build luarepl; } | |||
| 385 | test_build_nohttps() { need_luasocket; $luarocks download --rockspec validate-args ${verrev_validate_args} && $luarocks build ./validate-args-${version_validate_args}-1.rockspec && rm ./validate-args-${version_validate_args}-1.rockspec; } | 386 | test_build_nohttps() { need_luasocket; $luarocks download --rockspec validate-args ${verrev_validate_args} && $luarocks build ./validate-args-${version_validate_args}-1.rockspec && rm ./validate-args-${version_validate_args}-1.rockspec; } |
| 386 | test_build_https() { need_luasocket; $luarocks download --rockspec validate-args ${verrev_validate_args} && $luarocks install $luasec && $luarocks build ./validate-args-${verrev_validate_args}.rockspec && rm ./validate-args-${verrev_validate_args}.rockspec; } | 387 | test_build_https() { need_luasocket; $luarocks download --rockspec validate-args ${verrev_validate_args} && $luarocks install $luasec && $luarocks build ./validate-args-${verrev_validate_args}.rockspec && rm ./validate-args-${verrev_validate_args}.rockspec; } |
| 387 | test_build_supported_platforms() { $luarocks build lpty; } | 388 | test_build_supported_platforms() { $luarocks build lpty; } |
| 389 | test_build_only_deps_rockspec() { $luarocks download --rockspec lxsh ${verrev_lxsh} && $luarocks build ./lxsh-${verrev_lxsh}.rockspec --only-deps && { $luarocks show lxsh; [ $? -ne 0 ]; }; } | ||
| 390 | test_build_only_deps_src_rock() { $luarocks download --source lxsh ${verrev_lxsh} && $luarocks build ./lxsh-${verrev_lxsh}.src.rock --only-deps && { $luarocks show lxsh; [ $? -ne 0 ]; }; } | ||
| 391 | test_build_only_deps() { $luarocks build luasec --only-deps && { $luarocks show luasec; [ $? -ne 0 ]; }; } | ||
| 392 | test_install_only_deps() { $luarocks install lxsh ${verrev_lxsh} --only-deps && { $luarocks show lxsh; [ $? -ne 0 ]; }; } | ||
| 388 | fail_build_missing_external() { $luarocks build "$testing_dir/testfiles/missing_external-0.1-1.rockspec" INEXISTENT_INCDIR="/invalid/dir"; } | 393 | fail_build_missing_external() { $luarocks build "$testing_dir/testfiles/missing_external-0.1-1.rockspec" INEXISTENT_INCDIR="/invalid/dir"; } |
| 389 | fail_build_invalidpatch() { need_luasocket; $luarocks build "$testing_dir/testfiles/invalid_patch-0.1-1.rockspec"; } | 394 | fail_build_invalidpatch() { need_luasocket; $luarocks build "$testing_dir/testfiles/invalid_patch-0.1-1.rockspec"; } |
| 390 | 395 | ||
diff --git a/win32/pe-parser.lua b/win32/pe-parser.lua index 30bb8390..6b3a48c8 100644 --- a/win32/pe-parser.lua +++ b/win32/pe-parser.lua | |||
| @@ -1,7 +1,11 @@ | |||
| 1 | --------------------------------------------------------------------------------------- | 1 | --------------------------------------------------------------------------------------- |
| 2 | -- Lua module to parse a Portable Executable (.exe , .dll, etc.) file and extract metadata. | 2 | -- Lua module to parse a Portable Executable (.exe , .dll, etc.) file and extract metadata. |
| 3 | -- | 3 | -- |
| 4 | -- Version 0.1, [copyright (c) 2013 - Thijs Schreijer](http://www.thijsschreijer.nl) | 4 | -- NOTE: numerical information is extracted as strings (hex) to prevent numerical overflows in |
| 5 | -- case of 64 bit fields (bit/flag fields). Pointer arithmetic is still done numerically, so for | ||
| 6 | -- very large files this could lead to undefined results. Use with care! | ||
| 7 | -- | ||
| 8 | -- Version 0.3, [copyright (c) 2013-2015 Thijs Schreijer](http://www.thijsschreijer.nl) | ||
| 5 | -- @name pe-parser | 9 | -- @name pe-parser |
| 6 | -- @class module | 10 | -- @class module |
| 7 | 11 | ||
| @@ -238,7 +242,7 @@ local function readstring(f) | |||
| 238 | end | 242 | end |
| 239 | 243 | ||
| 240 | --- Parses a file and extracts the information. | 244 | --- Parses a file and extracts the information. |
| 241 | -- All numbers are delivered as "string" types containing hex values, see `toHex` and `toDec` conversion functions. | 245 | -- All numbers are delivered as "string" types containing hex values (to prevent numerical overflows in case of 64bit sizes or bit-fields), see `toHex` and `toDec` conversion functions. |
| 242 | -- @return table with data, or nil + error | 246 | -- @return table with data, or nil + error |
| 243 | -- @usage local pe = require("pe-parser") | 247 | -- @usage local pe = require("pe-parser") |
| 244 | -- local obj = pe.parse("c:\lua\lua.exe") | 248 | -- local obj = pe.parse("c:\lua\lua.exe") |
| @@ -524,9 +528,9 @@ function M.msvcrt(infile) | |||
| 524 | 528 | ||
| 525 | for i, dll in ipairs(obj.DataDirectory.ImportTable) do | 529 | for i, dll in ipairs(obj.DataDirectory.ImportTable) do |
| 526 | dll = dll.Name:upper() | 530 | dll = dll.Name:upper() |
| 527 | local result = dll:match('(MSVCR%d*)%.DLL') | 531 | local result = dll:match('(MSVCR%d*D?)%.DLL') |
| 528 | if not result then | 532 | if not result then |
| 529 | result = dll:match('(MSVCRT)%.DLL') | 533 | result = dll:match('(MSVCRTD?)%.DLL') |
| 530 | end | 534 | end |
| 531 | -- success, found it return name + binary where it was found | 535 | -- success, found it return name + binary where it was found |
| 532 | if result then return result, infile end | 536 | if result then return result, infile end |
