luarocks / luarocks-site

LuaRocks website and module host
http://luarocks.org
176 stars 36 forks source link

cannot upload a rock #172

Open Tieske opened 3 years ago

Tieske commented 3 years ago

Using the GUI I can only upload a rockspec, the rock upload fails.

If I add a rockspec and a rock to the GUI, only the rockspec is uploaded and added. If I only add a rock I get "Errors: missing file".

I tried with both .src.rock and .all.rock.

(what's the difference between the two formats? I managed to upload a .all.rock using curl, but then a luarocks install would not find it.)

Tieske commented 3 years ago

@hishamhm any ideas on that last part? why it doesn't find the .all.rock?

hishamhm commented 3 years ago

what's the difference between the two formats? I managed to upload a .all.rock using curl, but then a luarocks install would not find it

.all.rock is a suffix for binary rocks that have no C-library component (.so/.dll) to it, only .lua modules (i.e. they are (theoretically at least) portable "binary" rocks). It's strange that luarocks install couldn't find it.

I'll do some experiments here to figure out what's going on!

BTW, what is the file size of the .src.rock you were trying to upload?

Tieske commented 3 years ago

I hacked around it and uploaded it, zipping my own file, and then using curl to upload

current .src.rock is 4945172 bytes

leafo commented 3 years ago

Do you mind uploading the two files you were trying to upload somewhere so I can grab them and do a test run locally? Should be an easy fix once I reproduce it

Tieske commented 3 years ago

@leafo just any rock will do. It never worked for me. Only rockspec files I can upload via the site. Rocks won't work. But the LuaRocks command line allowed to work around that, so it never was a big issue.

It's just that with my current project the rock cannot be uploaded via LuaRocks cli, and hence I'm out of luck here, and came up with the hacks in my previous post.

hishamhm commented 3 years ago

@leafo I reproduced the issue at the site upload by attempting to upload Thijs's two files that appear here through the website.

It's just that with my current project the rock cannot be uploaded via LuaRocks cli

@Tieske I took a look at your repo — that's because the rockspec is playing a trick there with the update_api_files.sh to build the list of files, right? So technically the rockspec does not really contain the correct sequence of steps to download and install the files. One way around this would be to use type="make" and have the Makefile produce the list of generated files and install them (see docs here). That way the rockspec itself doesn't need to list the files, and luarocks upload would work correctly.

Tieske commented 3 years ago

I'm aware I'm pulling some tricks here to not have to include the AWS repo files in this repo to keep it lean and mean. It just makes some existing issues more visible (as confirmed by @hishamhm ):

@hishamhm yes, using make also crossed my mind, but sacrifices compatibility (Windows, though not an immediate need)

wrt the rock format, while crafting my own ones I noticed that the .all.rock and .src.rock have completely different formats. Could that be the reason it cannot find it? I assume that after an upload the manifest/index is rebuild, so maybe that step doesn't properly pick up the .all.rock contents?

hishamhm commented 3 years ago

LuaRocks not finding the .all.rock that was uploaded

The repository does have some .all.rock files added, and it seems to work. If you do for example luarocks search cqueues-pgsql it does list it under "Binary and pure-Lua rocks", and you can see that it gets used if you run luarocks install cqueues-pgsql --verbose (note that luarocks make and luarocks build prefer source rocks, but luarocks install prefers binary and pure-Lua rocks whenever available).

wrt the rock format, while crafting my own ones I noticed that the .all.rock and .src.rock have completely different formats.

They do, because .all.rock is a "binary rock" format, akin to a .linux-x86_64.rock format; .src.rock is a "source rock" format (containing typically a tarball or a git checkout).

sburke-ce commented 3 years ago

I am having the same issue. From luarocks.org/upload, i can upload the rockspec, but the browser does not recognize any .src.rock file as a candidate for upload. I confirmed this using both Chrome and Safari. It is just a guess, but i suspect that the input tag's accept parameter is causing this problem:

input accept=".src.rock"

I am guessing that the browser will interpret values with a single leading dot as an filename extension, but because ".src.rock" has two dots, it is treated as a literal file name. That would explain while the accept=".rockspec" works, but ".src.rock" does not. I would try changing this to:

input accept=".rock"

or perhaps

input accept="*.src.rock"

using an explicit wildcard.

hishamhm commented 3 years ago

@sburke-ce are you able to upload using the luarocks upload CLI?

sburke-ce commented 3 years ago

@sburke-ce are you able to upload using the luarocks upload CLI?

Yes, @hishamhm, the luarockt upload command works for me.