Open ebourg opened 1 month ago
Hi @ebourg and thanks for the report.
I managed to reproduce the issue and I'll be looking into it. I'll keep you posted here.
But apart from the problem you found, I'm happy to hear about the integration into debian. I would be happy to discuss with you about the best way to integrate findjava in the distribution. The idea is to give maximum control to maintainers about which JVMs are available for software packaged by the distribution itself.
@ebourg , I created PR https://github.com/loicrouchon/findjava/pull/2 which should fix the issue if my assumptions are correct.
What I assumed, is that you built the software from the instructions in the README.md instead of relying on my very basic and probably broken in many ways ubuntu/debian packaging located in packaging/debian
.
So let me know if the PR fixes your issue and if yes, I'll merge it.
I may have messed with the paths actually. The binary is in /usr/bin/
and the class file in /usr/share/findjava/metadata-extractor/
.
Here is the layout of the binary package:
$ dpkg -c /var/cache/pbuilder/result/findjava_0.3.2-1_amd64.deb
drwxr-xr-x root/root 0 2024-08-06 10:54 ./
drwxr-xr-x root/root 0 2024-08-06 10:54 ./etc/
-rw-r--r-- root/root 792 2024-08-06 10:54 ./etc/findjava
drwxr-xr-x root/root 0 2024-08-06 10:54 ./usr/
drwxr-xr-x root/root 0 2024-08-06 10:54 ./usr/bin/
-rwxr-xr-x root/root 2572888 2024-08-06 10:54 ./usr/bin/findjava
drwxr-xr-x root/root 0 2024-08-06 10:54 ./usr/share/
drwxr-xr-x root/root 0 2024-08-06 10:54 ./usr/share/doc/
drwxr-xr-x root/root 0 2024-08-06 10:54 ./usr/share/doc/findjava/
-rw-r--r-- root/root 158 2024-08-06 10:54 ./usr/share/doc/findjava/changelog.Debian.gz
-rw-r--r-- root/root 512 2024-08-06 10:54 ./usr/share/doc/findjava/copyright
drwxr-xr-x root/root 0 2024-08-06 10:54 ./usr/share/findjava/
drwxr-xr-x root/root 0 2024-08-06 10:54 ./usr/share/findjava/metadata-extractor/
-rw-r--r-- root/root 2317 2024-08-06 10:54 ./usr/share/findjava/metadata-extractor/JvmMetadataExtractor.class
I guess I just have to patch the value of platform.MetadataExtractorDir
in linux.go
?
My apologies for the late response, I somehow missed the GitHub notification of your response.
I would prefer if you do not have to patch the source code. I'll check what are the options to provide a configurable build in the form of an environment variable you could pass when calling make.
When I tried to package it myself, I defined the following debian/rules
I did put the binary in /usr/share/findjava/
so that the metadata extractor would be in the same directory
/usr/bin/findjava -> /usr/share/findjava/findjava
/usr/share/findjava/findjava
/usr/share/findjava/metadata-extractor/JvmMetadataExtractor.class
Do I assume correctly that you defined your own debian/rules file and that you called make in it? May I ask you to share it so that I have more insights on how you're trying to build.
Do I assume correctly that you defined your own debian/rules file and that you called make in it?
Yes that's correct. lintian complained about the arch dependent binary in /usr/share/
, so I've moved the binary directly under /usr/bin/
. Also I've used a dh debian/findjava.install
file instead of explicit install instructions in debian/rules
.
The debian/rules
file looks like this:
#!/usr/bin/make -f
GOCACHE=build/gocache
%:
dh $@
override_dh_auto_build:
mkdir -p "$(GOCACHE)"
GOCACHE="$(GOCACHE)" GO_TAGS="-tags linux" GO_LD_FLAGS="-buildmode=pie" make build
mkdir -p build/config
cp packaging/debian/config.conf build/config/findjava
override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
mkdir -p "$(GOCACHE)"
GOCACHE="$(GOCACHE)" GO_TAGS="-tags linux" make test
endif
and debian/findjava.install
:
build/config/findjava /etc/
build/classes/JvmMetadataExtractor.class /usr/share/findjava/metadata-extractor/
build/go/findjava /usr/bin/
I pushed some additional changes to branch bug/metadata-extractor-path
defining a new build tag: debian
which sets the expected location for the metadata extractor to /usr/share/findjava/metadata-extractor/
.
You should be able to build using GO_TAGS="-tags debian"
instead of GO_TAGS="-tags linux"
without the need for patching any file on your side.
Let me know if that works and if the solution suits you.
@ebourg I was not fully happy with the necessity to require a file for configuring variables.
So I worked a bit more on it and pushed new changes to https://github.com/loicrouchon/findjava/pull/2 so that you can also override things when building and even combine both approaches.
You now have a few build options:
Use the pre-configured debian
build tag:
GO_TAGS="-tags debian" make
Use the pre-configured standalone_linux
build tag and override remaining variables to be Debian compatible:
GO_TAGS="-tags standalone_linux" GO_LD_FLAGS="-X 'findjava/linker.MetadataExtractorDir=/usr/share/findjava/metadata-extractor'" make
Override all the variables manually:
GO_LD_FLAGS="-X 'findjava/linker.ConfigDir=/etc/findjava/' -X 'findjava/linker.CacheDir=~/.cache/findjava/' -X 'findjava/linker.MetadataExtractorDir=/usr/share/findjava/metadata-extractor'" make
You can check the resulting binary with command:
$ ./build/dist/findjava --version -log-level=debug
findjava 0.3.2
[DEBUG] platform:
program: /home/someuser/findjava/build/dist/findjava
config directory: /etc/findjava/
cache directory: /home/someuser/.cache/findjava/
metadata extractor directory: /usr/share/findjava/metadata-extractor
More details can be found in the README.md of #2
Hi,
I'm trying to package findjava for Debian, it builds fine but I'm getting errors at runtime:
without arguments:
and with arguments:
The JVM path displayed in the error message changes on each invocation and seems randomly picked from
/usr/lib/jvm/
.Here is the content of my
/usr/lib/jvm/
directory: