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

Upgrade to 4.1 #3

Open
wants to merge 17 commits into
base: trunk
Choose a base branch
from

Conversation

lapo-luchini
Copy link
Contributor

I have some work-in-progress patches for that.
It includes changes from mvn-pre-fetch branch.

polo-language and others added 10 commits August 8, 2022 21:21
As stated in [Reproducible builds in FreeBSD](https://www.bsdcan.org/2016/schedule/attachments/375_2016-06-11-BSDCan-2016-Reproducible-Builds.pdf) `bsdtar` doesn't allow changing mtime, so I frist added a line to do this:

```
cd ${REPO_DIR} && ${FIND} . -print0 | xargs -0 touch -d 2022-08-08T20:40:04Z
```

This is not enough as file traversal order changes from time to time; to solve this I used `find -s` to produce a sorted file list:

```
cd ${WRKDIR} && \
${FIND} -s repository/ -print >list.txt && \
${TAR} czf ${DISTDIR}/apache-${PORTNAME}-${DISTVERSION}-repo.tar.gz -nT list.txt
```

Still not enough, as `gzip` header includes a timestamp; this can be solved by using [`gzip -n`](https://www.freebsd.org/cgi/man.cgi?query=gzip&sektion=1) but instead I tried two approaches and it seems to work fine with both:
1. using `7zz` (always sorts traversal order, so `list.txt` is not needed)
    `7zz a -mx9 ${DISTDIR}/apache-${PORTNAME}-${DISTVERSION}-repo.7z repository/`
2. using `xz`
    `${TAR} cJf ${DISTDIR}/apache-${PORTNAME}-${DISTVERSION}-repo.tar.xz -nT list.txt`

I decided for the latter as it is included in the base system.
@lapo-luchini
Copy link
Contributor Author

Most differences solved, still need to massage plist file.

===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: %%ETCDIR%%/credentials.sample
Error: Orphaned: %%DATADIR%%/lib/asm-9.1.jar
Error: Orphaned: %%DATADIR%%/lib/caffeine-2.9.2.jar
Error: Orphaned: %%DATADIR%%/lib/checker-qual-3.10.0.jar
Error: Orphaned: %%DATADIR%%/lib/error_prone_annotations-2.5.1.jar
Error: Orphaned: %%DATADIR%%/lib/ipaddress-5.3.3.jar
Error: Orphaned: %%DATADIR%%/lib/jackson-datatype-jsr310-2.13.2.jar
Error: Orphaned: %%DATADIR%%/lib/jna-5.9.0.jar
Error: Orphaned: %%DATADIR%%/lib/jsr305-2.0.2.jar
Error: Orphaned: %%DATADIR%%/lib/pure_sasl-0.6.2-py2-none-any.zip
Error: Orphaned: %%DATADIR%%/pylib/cqlshlib/authproviderhandling.py
Error: Orphaned: %%DATADIR%%/tools/bin/hash_password
===> Checking for items in pkg-plist which are not in STAGEDIR
Error: Missing: %%DATADIR%%/lib/asm-7.1.jar
Error: Missing: %%DATADIR%%/lib/caffeine-2.5.6.jar
Error: Missing: %%DATADIR%%/lib/jna-5.6.0.jar
Error: Missing: %%DATADIR%%/pylib/cqlshlib/setup.cfg
Error: Missing: %%DATADIR%%/tools/bin/cassandra-stressd
===> Error: Plist issues found.

@lapo-luchini
Copy link
Contributor Author

@polo-language current approach is working only if executed before poudriere is launched, for some reason the pre-fetch inside poudriere seems to work, but then the just-created file isn't found anymore.

BUILD SUCCESSFUL
Total time: 10 seconds
cd /wrkdirs/usr/ports/databases/cassandra4/work/repository && /usr/bin/find . -type f -name "*.repositorie
s" -a -exec /usr/bin/sed -i '' -e '2s,.*,Mon Aug 08 20:40:04 CEST 2022,' {} +
cd /wrkdirs/usr/ports/databases/cassandra4/work/repository && /usr/bin/find . -print0 | xargs -0 touch -d
2022-08-08T20:40:04Z
cd /wrkdirs/usr/ports/databases/cassandra4/work && /usr/bin/find -s repository/ -print >list.txt &&  /usr/
bin/tar cJf /portdistfiles/apache-cassandra-4.1.0-repo.tar.xz -nT list.txt
/bin/rm -f -r /wrkdirs/usr/ports/databases/cassandra4/work
=> apache-cassandra-4.1.0-repo.tar.xz doesn't seem to exist in /portdistfiles/.

@lapo-luchini
Copy link
Contributor Author

Currently fails with:

BUILD FAILED
/wrkdirs/usr/ports/databases/cassandra4/work/apache-cassandra-4.1.0-src/.build/build-resolver.xml:172: The following error occurred while executing this line:
/wrkdirs/usr/ports/databases/cassandra4/work/apache-cassandra-4.1.0-src/.build/build-resolver.xml:74: Task [resolver:resolve] failed after [3] attempts; giving up.
Error messages:
Could not collect dependencies: Failed to collect dependencies at org.xerial.snappy:snappy-java:jar:1.1.8.4

@lapo-luchini
Copy link
Contributor Author

OK, now fails with:

[resolver:resolve] Resolving artifacts                                                                                  
    [mkdir] Created dir: /wrkdirs/usr/ports/databases/cassandra4/work/apache-cassandra-4.1.0-src/lib/sigar-bin          
                                                                                                                        
BUILD FAILED                                                                                                            
/wrkdirs/usr/ports/databases/cassandra4/work/apache-cassandra-4.1.0-src/.build/build-resolver.xml:204: java.net.UnknownHostException: files.pythonhosted.org

@lapo-luchini
Copy link
Contributor Author

I've noticed you're working on this in a5b269c, yay! 🎉
Holler up if you need a hand.

@polo-language
Copy link
Owner

FYI: Trying to get a resolution to the problem of always downloading the maven dependencies:
https://forums.freebsd.org/threads/if-exists-never-sees-file.89637/

@polo-language
Copy link
Owner

polo-language commented Jul 10, 2023

Regarding the "reproducible repo", in my 4.1.2 branch I've fixed the problem of make never thinking the maven cache file exists! But... the regular ant build run by either of the do-build-DOCS-* targets performs the download every time nonetheless. Can you take a look into this?

=> SHA256 Checksum OK for cassandra/apache-cassandra-4.1.2-repo.tar.xz.

[...]

===> Building for cassandra4-4.1.2
cd /usr/ports/databases/cassandra4/work/apache-cassandra-4.1.2-src && /usr/local/bin/ant -Dmaven.repo.local=/usr/ports/databases/cassandra4/work/repository -Dlocal.repository=/usr/ports/databases/cassandra4/work/repository -Duse.jdk11=true -Drat.skip=true freebsd-stage
Buildfile: /usr/ports/databases/cassandra4/work/apache-cassandra-4.1.2-src/build.xml

[...]

maven-ant-tasks-init:

maven-declare-dependencies:

_write-poms:

resolver-retrieve-build:
[resolver:resolve] Downloading https://repo1.maven.org/maven2/org/xerial/snappy/snappy-java/1.1.8.4/snappy-java-1.1.8.4.pom
[resolver:resolve] Downloaded https://repo1.maven.org/maven2/org/xerial/snappy/snappy-java/1.1.8.4/snappy-java-1.1.8.4.pom (4 KB at 2.3 KB/sec)
[resolver:resolve] Downloading https://repo1.maven.org/maven2/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.13.2/jackson-datatype-jsr310-2.13.2.pom
[resolver:resolve] Downloaded https://repo1.maven.org/maven2/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.13.2/jackson-datatype-jsr310-2.13.2.pom (5 KB at 31.7 KB/sec)
[... and so on]

@lapo-luchini
Copy link
Contributor Author

Regarding the "reproducible repo", in my 4.1.2 branch I've fixed the problem of make never thinking the maven cache file exists!

Ohhh! what was it?
Is it simply moving it after .include <bsd.port.pre.mk> (as I've seen in the diff)?

the regular ant build run by either of the do-build-DOCS-* targets performs the download every time nonetheless. Can you take a look into this?

Okay, will do!

@polo-language
Copy link
Owner

Is it simply moving it after .include <bsd.port.pre.mk> (as I've seen in the diff)?

Yes, that was it. The problem had to do with the timing of when build variables are set. If the DISTDIR variable isn't set yet, the directory it will eventually point to appears not to exist.

Have you had any luck with preventing the maven retrieval when the repo file is already present in distfiles?

@lapo-luchini
Copy link
Contributor Author

Unfortunately, not yet. :(
Still intend to do that, as soon as I have some time.

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