diff --git a/src/code_stripping.jl b/src/code_stripping.jl index fa1e91e..42b42b6 100644 --- a/src/code_stripping.jl +++ b/src/code_stripping.jl @@ -51,6 +51,7 @@ function _generate_stripped_bundle(; run(`$gitcmd init`) run(`$gitcmd config user.name "PackageBundler"`) run(`$gitcmd config user.email ""`) + run(`$gitcmd config core.autocrlf false`) end # Ensure that the versions are sorted first before committing, @@ -69,7 +70,21 @@ function _generate_stripped_bundle(; run(Cmd([gitcmd, "commit", "-m", msg])) run(Cmd([gitcmd, "tag", "-a", "v$version", "-m", msg])) - pkg_info["git-tree-sha1"] = bytes2hex(Pkg.GitTools.tree_hash(temp_dir)) + # Interestingly, using `tree_hash` failed on Windows with a + # `git object could not be found` error when attempting to + # clone the stripped packages. It would appear that the tree hash + # doesn't match what it should be on that platform, whereas it works + # correctly on macOS and Linux, both locally and on GitHub runners. + # + # ``` + # sha = bytes2hex(Pkg.GitTools.tree_hash(temp_dir)) + # ``` + # + # To get around this we use the `rev-parse` and `^{tree}` to get the + # "real" tree hash. + rev = readchomp(`$gitcmd rev-parse HEAD`) + sha = readchomp(Cmd([gitcmd, "rev-parse", "$rev^{tree}"])) + pkg_info["git-tree-sha1"] = sha end run(`$gitcmd log`) end diff --git a/src/openssl.jl b/src/openssl.jl index bad1084..244b1d2 100644 --- a/src/openssl.jl +++ b/src/openssl.jl @@ -17,7 +17,7 @@ function keypair(dir::AbstractString = pwd()) @info "Generating key pair for signing stripped packages." dir dir = abspath(dir) - openssl = OpenSSL_jll.openssl + openssl = OpenSSL_jll.openssl() cmd = Cmd(["genrsa", "-out", private, "4096"]) run(`$openssl $cmd`) cmd = Cmd(["rsa", "-in", private, "-pubout"]) @@ -27,7 +27,7 @@ function keypair(dir::AbstractString = pwd()) end function _sign_file(file, private_key) - openssl = OpenSSL_jll.openssl + openssl = OpenSSL_jll.openssl() cmd = Cmd([ "dgst", "-sign", @@ -44,7 +44,7 @@ function _sign_file(file, private_key) end function _verify_file(file, public_key) - openssl = OpenSSL_jll.openssl + openssl = OpenSSL_jll.openssl() cmd = Cmd([ "dgst", "-verify",