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

lua@5.1 & lua: update luarocks to 2.4.4 #21282

Closed
wants to merge 2 commits into from
Closed

lua@5.1 & lua: update luarocks to 2.4.4 #21282

wants to merge 2 commits into from

Conversation

DomT4
Copy link
Member

@DomT4 DomT4 commented Dec 2, 2017

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

I should've jumped on top of this a while ago, apologies.

@DomT4
Copy link
Member Author

DomT4 commented Dec 2, 2017

Don't merge this straight away, looking into a something.

@DomT4
Copy link
Member Author

DomT4 commented Dec 3, 2017

Alright, this should be good to 🚢 whenever you're happy & CI is happy @ilovezfs. In way of explanation:

  • I knew upstream had fixed the old permissions problem but it wasn't in the current release as listed at the https://keplerproject.github.io/luarocks/releases/ URL, so I updated to what that said was the latest release, which still had the permission issues.
  • Checking the main luarocks website led me to realise the https://keplerproject.github.io/luarocks/releases/ was no longer updating with the latest releases, and that instead releases were now being hosted at https://luarocks.github.io/luarocks/releases/.
  • Testing that latest release confirmed the permissions fix had been folded in & is available, resolving issues such as the one vis upstream mentioned in this comment.

(We put the Christmas decorations up at uni since we're all only here for another couple weeks; the above list didn't take me 4 hours to get through 😄)

@DomT4
Copy link
Member Author

DomT4 commented Dec 3, 2017

Oh, new problem. How fun. Looking into it, again.

@DomT4
Copy link
Member Author

DomT4 commented Dec 3, 2017

This is "Not great" ™️ but my recommendation is that it is still better than the status quo, and resolves several issues not only around luarocks handling but with the lua@5.3 formula, and is worth pressing ahead with.

I intend to wander upstream later today and try to initiate some kind of conversation around the issues discovered trying to get it to build the old way, and indeed test whether they're already been resolved in master or not.

@ilovezfs
Copy link
Contributor

ilovezfs commented Dec 3, 2017

I think I'd prefer we not do this. Build steps in post_install are basically a formula bug.

@DomT4
Copy link
Member Author

DomT4 commented Dec 3, 2017

If necessary I’ll split this into two PRs whilst I talk to upstream, since the Lua formula here remains working as-is. It’s the versioned stuff there’s some issues around.

@DomT4
Copy link
Member Author

DomT4 commented Dec 3, 2017

Actually 3 PRs maybe, the Lua@5.3 patch & pkg-config updates probably shouldn’t wait much longer sigh.

@ilovezfs
Copy link
Contributor

ilovezfs commented Dec 3, 2017

I demand at least 4 PRs.

@DomT4
Copy link
Member Author

DomT4 commented Dec 3, 2017

I mean, I could probably manage it if you're desperate 😉.

@ilovezfs
Copy link
Contributor

ilovezfs commented Dec 3, 2017

Must … have … PR … It's like 🚰

@ilovezfs
Copy link
Contributor

ilovezfs commented Dec 3, 2017

What is this conflicted PR I see?

@DomT4
Copy link
Member Author

DomT4 commented Dec 3, 2017

Don't know to what you refer to 😉.

Copy link
Contributor

@ilovezfs ilovezfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 post_install

@DomT4 DomT4 changed the title Lua family: update Luarocks to 2.4.1 Lua@5.1/Lua@5.3: update Luarocks to 2.4.1 (WIP) Dec 3, 2017
@DomT4 DomT4 changed the title Lua@5.1/Lua@5.3: update Luarocks to 2.4.1 (WIP) Lua@5.1/Lua@5.3: update Luarocks to 2.4.3 (WIP) Dec 3, 2017
@ilovezfs
Copy link
Contributor

ilovezfs commented Dec 3, 2017

So is the issue here just about the luarocks build reporting it cannot find lua?

@DomT4
Copy link
Member Author

DomT4 commented Dec 3, 2017

Yeah. They seem to have broken detection of versioned executables, and even if you hack around that problem you hit a second problem that it thinks the header version doesn't align with the executable version because it thinks the executable version is null, for some reason 🙃.

@ilovezfs
Copy link
Contributor

ilovezfs commented Dec 3, 2017

I think it's just that

bash-3.2$ /usr/local/Cellar/lua/5.3.4/bin/lua --version
dyld: Library not loaded: /usr/local/lib/liblua.5.3.dylib
  Referenced from: /usr/local/Cellar/lua/5.3.4/bin/lua
  Reason: image not found
Trace/BPT trap: 5
bash-3.2$ exit

since the patch is using HOMEBREW_PREFIX/lib/liblua.5.3.dylib not @LUA_PREFIX@/lib/liblua.5.3.dylib

@DomT4
Copy link
Member Author

DomT4 commented Dec 3, 2017

Yeah, that was what I ran into last night poking around but ran out of time to test fixes before I had to die for the day.

@DomT4
Copy link
Member Author

DomT4 commented Dec 3, 2017

The post_install change was essentially something I knew would work and I could put together in 2 minutes, and probably wouldn't be awful until I had a moment to test things in more detail 😄.

@ilovezfs
Copy link
Contributor

ilovezfs commented Dec 3, 2017

ah ok … I'm just saying I'm not sure they actually broke anything.

@DomT4
Copy link
Member Author

DomT4 commented Dec 3, 2017

Something changed upstream, I presume, as this wasn't an issue till recently, but yeah it could just be amongst the detection tweaks they tripped a wire that had been sat there for us quietly for quite some time 🙈.

@ilovezfs
Copy link
Contributor

ilovezfs commented Dec 3, 2017

The same s.gsub! "@LUA_PREFIX@", prefix will probably work.

@DomT4
Copy link
Member Author

DomT4 commented Dec 3, 2017

I'll be back online properly in a few hours & can take a peek then, if you like.

@ilovezfs
Copy link
Contributor

ilovezfs commented Dec 3, 2017

np

@DomT4
Copy link
Member Author

DomT4 commented Dec 3, 2017

If you want to leap over me by all means don't feel obligated to wait or anything, but yeah, happy to poke around later if you're not chomping at the bit to have at it.

@stale stale bot removed the stale No recent activity label Feb 14, 2018
@stale
Copy link

stale bot commented Mar 7, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale No recent activity label Mar 7, 2018
@DomT4
Copy link
Member Author

DomT4 commented Mar 7, 2018

If you've got ideas on resolving this without leaning on postinstall to do a stupid dance Stalebot, I'm all ears.

@stale stale bot removed the stale No recent activity label Mar 7, 2018
@DomT4
Copy link
Member Author

DomT4 commented Mar 8, 2018

I guess that serves as CI confirmation that I'm not just having some weird local issue at least.

@DomT4 DomT4 changed the title Lua@5.1/Lua@5.3: update Luarocks to 2.4.3 (WIP) lua@5.1: update luarocks to 2.4.3 (WIP) Mar 8, 2018
@DomT4 DomT4 changed the title lua@5.1: update luarocks to 2.4.3 (WIP) lua@5.1 & lua: update luarocks to 2.4.4 Mar 23, 2018
@DomT4
Copy link
Member Author

DomT4 commented Mar 23, 2018

So. This PR should return green now. Finally.

@DomT4
Copy link
Member Author

DomT4 commented Mar 23, 2018

The amount of wrong directions the configure failures sent me down was borderline ridiculous on this PR. What a grim use of time.

@@ -40,14 +40,17 @@ class LuaAT51 < Formula
end
end

# Don't use the https://luarocks.org/releases/luarocks-x.y.z.tar.gz URL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment looks wrong

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, maybe they've fixed the redirect now. I'll check.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still there:

Resource: luarocks
==> Downloading https://luarocks.org/releases/luarocks-2.4.4.tar.gz
==> Downloading from http://luarocks.github.io/luarocks/releases/luarocks-2.4.4.tar.gz
/usr/bin/curl --show-error --user-agent Homebrew/1.5.12-9-g49927ed (Macintosh; Intel Mac OS X 10.13.4) curl/7.54.0 --fail --location --remote-time --continue-at - --output /usr/local/var/homebrewcache/lua--luarocks-2.4.4.tar.gz.incomplete http://luarocks.github.io/luarocks/releases/luarocks-2.4.4.tar.gz

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you reported it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ilovezfs
Copy link
Contributor

What was the problem?

@DomT4
Copy link
Member Author

DomT4 commented Mar 23, 2018

What was the problem?

A variation of:

The same s.gsub! "@LUA_PREFIX@", prefix will probably work.`

was indeed required as you suggested months ago, but there was also an issue where upstream apparently tweaked the header detection logic in a way that doesn't work with Homebrew's directory structure here, and that header silliness lead me down a ridiculous rabbit hole. In combination they work fine.

@DomT4
Copy link
Member Author

DomT4 commented Mar 23, 2018

It became obvious enough when I dropped into the debug shell for extended periods and just ran build after build after build with slight tweaks each time, but outside the debug shell a lot of the helpful messages are hidden by brew and you just get that simple failure message. Shouldn't have taken me this long to fix it really, but time away leads to fresh thinking or some garbage like that.

end

def install
# Use our CC/CFLAGS to compile.
inreplace "src/Makefile" do |s|
s.gsub! HOMEBREW_PREFIX, prefix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually work for a non-standard prefix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should do, theoretically. It is just a slight variation of what we've been doing in the lua formula for ages, without anyone complaining about it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does the replacement not fail if the prefix isn't in the file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wouldn't the prefix be in the file? We're the ones adding that line in the inline patch. Maybe I'm misunderstanding you? I've slept for about 4 hours over the last day 🙃.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, OK. That's what I get for looking at this on my iPhone.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+	$(CC) -dynamiclib -install_name HOMEBREW_PREFIX/lib/liblua.5.1.dylib \
+		-compatibility_version 5.1 -current_version 5.1.5 \
+		-o liblua.5.1.5.dylib $^

compared to:

+	$(CC) -dynamiclib -install_name @LUA_PREFIX@/lib/liblua.5.3.dylib \
+		-compatibility_version 5.3 -current_version 5.3.4 \
+		-o liblua.5.3.4.dylib $^

in the lua formula. Same principle, just a slight divergence at some point for some reason. Possibly my fault given how much I've touched these formulae over the years.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not look right. If I am not mistaking, this should be

s.gsub! "HOMEBREW_PREFIX", prefix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think so? brew unpack --patch lua@5.1 shows the blob as I expected it to be:

$(LUA_A): $(CORE_O) $(LIB_O)
	$(CC) -dynamiclib -install_name /usr/local/lib/liblua.5.1.dylib \
		-compatibility_version 5.1 -current_version 5.1.5 \
		-o liblua.5.1.5.dylib $^

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get this for non-standard homebrew prefix.

brew upgrade lua@5.1
==> Upgrading 1 outdated package, with result:
lua@5.1 5.1.5_6
==> Upgrading lua@5.1 
==> Downloading https://www.lua.org/ftp/lua-5.1.5.tar.gz
######################################################################## 100.0%
Error: inreplace failed
src/Makefile:
  expected replacement of #<Pathname:/home/comp/chengxu/usr> with #<Pathname:/home/comp/chengxu/usr/Cellar/lua@5.1/5.1.5_6>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure I tried a string replacement in the default prefix and hit issues with it, which is why I didn't go down that route. Maybe we should just save ourselves some hassle & change it to @LUA_PREFIX@ to match the lua formula.

@DomT4
Copy link
Member Author

DomT4 commented Mar 23, 2018

Would ya look at that. A green CI build. Thought I'd never see the day here at times 🤦‍♂️.

Formula/lua.rb Outdated
s.gsub! lib.to_s, "#{HOMEBREW_PREFIX}/lib"
s.gsub! bin.to_s, "#{HOMEBREW_PREFIX}/bin"
s.gsub! libexec, opt_libexec
s.gsub! include, "#{HOMEBREW_PREFIX}/include"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe HOMEBREW_PREFIX/"include"

@DomT4
Copy link
Member Author

DomT4 commented Mar 23, 2018

Upstream merged the PR so the redirect is HTTPS to HTTPS now, which is fine, so I'll push new commits to use the official URL and after that I think we're alright here if you're happy.

Resource: luarocks
==> Downloading https://luarocks.org/releases/luarocks-2.4.4.tar.gz
==> Downloading from https://luarocks.github.io/luarocks/releases/luarocks-2.4.4.tar.gz
/usr/bin/curl --show-error --user-agent Homebrew/1.5.12-9-g49927ed (Macintosh; Intel Mac OS X 10.13.4) curl/7.54.0 --fail --location --remote-time --continue-at - --output /usr/local/var/homebrewcache/lua--luarocks-2.4.4.tar.gz.incomplete https://luarocks.github.io/luarocks/releases/luarocks-2.4.4.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  137k  100  137k    0     0  79313      0  0:00:01  0:00:01 --:--:-- 79306
Downloaded to: /usr/local/var/homebrewcache/lua--luarocks-2.4.4.tar.gz
SHA256: 3938df33de33752ff2c526e604410af3dceb4b7ff06a770bc4a240de80a1f934

@ilovezfs
Copy link
Contributor

Shipped! Thanks @DomT4

@ilovezfs ilovezfs closed this in cec8a2b Mar 23, 2018
@DomT4 DomT4 deleted the luarocks_sigh branch March 23, 2018 16:40
@DomT4
Copy link
Member Author

DomT4 commented Mar 23, 2018

Thanks Joe. Nice to be able to finally delete this branch, heh.

@ilovezfs
Copy link
Contributor

Or just hoard branches as I do!

@DomT4
Copy link
Member Author

DomT4 commented Mar 23, 2018

That would be the death of what’s left of my sanity.

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lua Lua use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants