Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: recursively unpack nested archives #386

Merged
merged 1 commit into from
Feb 4, 2025
Merged

Conversation

mrcjkb
Copy link
Member

@mrcjkb mrcjkb commented Feb 2, 2025

Scenario:

An older rockspec that does not specify a source.dir and for which the source.url no longer exists:

source = {
    url = "http://www.kyne.com.au/~mark/software/download/lua-cjson-2.1.0.zip",
}

The luarocks src.rock looks like this:

  • lua-cjson-2.1.0-1.src.rock
    • lua-cjson-2.1.0-1.rockspec
    • lua-cjson-2.1.0.zip -> contains the directory: lua-cjson-2.1.0 (not specified in the source.dir).

To account for this, we need to recursively unpack the nested source archive and infer the source directory.

@vhyrro
Copy link
Contributor

vhyrro commented Feb 3, 2025

Code looks great, but this definitely needs a rigorous test harness. I remember implementing this functionality at one point and breaking half the other luarocks packages which didn't want recursive unpacking (I think it was either kong or some openresty package that didn't like this) :/

How hard would it be for us to make a harness that tests rocks compatibility against a large sample of luarocks.org rockspecs? Preferably without bombarding them with get requests every day 😅

@mrcjkb mrcjkb force-pushed the mj/push-ztvxllqynzux branch from b712a17 to d33853d Compare February 3, 2025 17:13
@mrcjkb
Copy link
Member Author

mrcjkb commented Feb 3, 2025

I remember implementing this functionality at one point and breaking half the other luarocks packages which didn't want recursive unpacking (I think it was either kong or some openresty package that didn't like this) :/

I just realised your check was already in place, for tar.gz archives only though.
I have modified my PR to use the same flag prevent the recursive unpack call if source.file is set.
Note that the flag is always false when unpacking a .src.rock.

@mrcjkb mrcjkb force-pushed the mj/push-ztvxllqynzux branch 2 times, most recently from b61a969 to 66ccafd Compare February 3, 2025 17:37
@mrcjkb mrcjkb force-pushed the mj/push-ztvxllqynzux branch from 66ccafd to 0f03bfd Compare February 3, 2025 19:54
@mrcjkb mrcjkb merged commit 2439d99 into master Feb 4, 2025
13 checks passed
@mrcjkb mrcjkb deleted the mj/push-ztvxllqynzux branch February 4, 2025 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants