freebsd / poudriere

Port/Package build and test system
https://github.com/freebsd/poudriere/wiki
BSD 2-Clause "Simplified" License
379 stars 161 forks source link

common.sh: Add hosts entry for jail (ref or builder) #1076

Closed jurajlutter closed 8 months ago

jurajlutter commented 9 months ago

To allow some java programs to build, add a stub hosts entry with the jail name pointing to 127.0.0.1.

This fixes problem building archivers/snappy-java (at least for me).

bapt commented 9 months ago

hum can you explicit what issue you are exactly facing with those java programs? note that at quick glance the code cannot ne merged as is, as it will not fit with setup without ipv4

igalic commented 9 months ago

are you saying we need an ::1 entry as well, or… something else?

jurajlutter commented 9 months ago

Yes, also ::1 is needed. I did not realize it.

The problem was that when building some packages using sbt, it tries to resolve the local host's hostname and if it can not, the build fails.

jurajlutter commented 9 months ago
sbt -Dsbt.ivy.home=/wrkdirs/usr/ports/archivers/snappy-java/work/repository -Dsbt.offline=true -Dsbt.boot.directory=/wrkdirs/usr/ports/archivers/snapp>
copying runtime jar...
2023-08-18 20:16:45,179 main ERROR Could not determine local host name java.net.UnknownHostException: 132rx64-default-powen-job-01: 132rx64-default-po>
        at java.base/java.net.InetAddress.getLocalHost(InetAddress.java:1670)
        at org.apache.logging.log4j.core.util.NetUtils.getLocalHostname(NetUtils.java:53)
        at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:541)
        at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263)
        at org.apache.logging.log4j.core.async.AsyncLoggerContext.start(AsyncLoggerContext.java:87)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:207)
        at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:220)
        at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:197)
        at sbt.util.LogExchange.init(LogExchange.scala:142)
        at sbt.util.LogExchange.context$lzycompute(LogExchange.scala:18)
        at sbt.util.LogExchange.context(LogExchange.scala:18)
jurajlutter commented 9 months ago

And this only occurs with OpenJDK17 and newer, not with OpenJDK11 and older.

bapt commented 9 months ago

ok, can you update accordingly and squash this PR?