This is not the regression. You need to add the "!" suffix to the end of 
the command 
(see 
https://github.com/cloudius-systems/osv/commit/b4a042212dfadb9293fd627873301458927c4966).
 
So it should be -e '/usr/bin/java --version !'. I hope the commit's 
comments explain all this.

On Monday, June 14, 2021 at 4:10:15 AM UTC-4 Nadav Har'El wrote:

> Thanks. This will be useful for recent distributions which don't have Java 
> 8 any more.
>
> By the way, I noticed that
>     scripts/run.py -e '/usr/bin/java --version'
>
> hangs after showing the version. I wonder if this is a new regression 
> somewhere because I vaguely remember this used to work in the past. Maybe 
> Java is leaving behind some thread that doesn't exit, or something.
> But it's not important to fix now.
>
> --
> Nadav Har'El
> [email protected]
>
>
> On Mon, Jun 14, 2021 at 7:20 AM Waldemar Kozaczuk <[email protected]> 
> wrote:
>
>> This patch adds new module to allow building an image with
>> JDK 9 or newer from the files found on a Linux host. It does so
>> by locating javac executable found in the PATH and then navigating
>> the corresponding directory to collect all required files.
>>
>> Signed-off-by: Waldemar Kozaczuk <[email protected]>
>> ---
>>  modules/openjdk9_1x-from-host/.gitignore |  1 +
>>  modules/openjdk9_1x-from-host/Makefile   | 28 ++++++++++++++++++
>>  modules/openjdk9_1x-from-host/module.py  | 37 ++++++++++++++++++++++++
>>  3 files changed, 66 insertions(+)
>>  create mode 100644 modules/openjdk9_1x-from-host/.gitignore
>>  create mode 100644 modules/openjdk9_1x-from-host/Makefile
>>  create mode 100644 modules/openjdk9_1x-from-host/module.py
>>
>> diff --git a/modules/openjdk9_1x-from-host/.gitignore 
>> b/modules/openjdk9_1x-from-host/.gitignore
>> new file mode 100644
>> index 00000000..f9235a6b
>> --- /dev/null
>> +++ b/modules/openjdk9_1x-from-host/.gitignore
>> @@ -0,0 +1 @@
>> +usr.manifest
>> diff --git a/modules/openjdk9_1x-from-host/Makefile 
>> b/modules/openjdk9_1x-from-host/Makefile
>> new file mode 100644
>> index 00000000..6441543f
>> --- /dev/null
>> +++ b/modules/openjdk9_1x-from-host/Makefile
>> @@ -0,0 +1,28 @@
>> +.PHONY: module clean
>> +
>> +include ../common.gmk
>> +ifneq ($(arch),$(host_arch))
>> +$(error Cannot provide JDK when cross-compiling)
>> +endif
>> +
>> +SRC = $(shell readlink -f ../..)
>> +
>> +javac_exe_path = $(shell realpath $$(which javac))
>> +javac_bin_path = $(shell dirname $(javac_exe_path))
>> +java_jdk_path = $(shell dirname $(javac_bin_path))
>> +libsunec_path = $(shell find $(java_jdk_path) -name libsunec.so)
>> +
>> +javac_with_version = $(shell javac -version)
>> +
>> +module:
>> +       @case "$(javac_with_version)" in \
>> +               "javac 9"*) ;; \
>> +               "javac 1"[0-9]*) ;; \
>> +               *) echo "Requires Java 9 or later"; exit 1 ;; \
>> +       esac
>> +       $(call very-quiet, $(SRC)/scripts/manifest_from_host.sh 
>> $(libsunec_path) > usr.manifest)
>> +       $(call very-quiet, $(SRC)/scripts/manifest_from_host.sh -li 
>> libfreeblpriv3.so >> usr.manifest)
>> +       $(call very-quiet, echo 
>> "/usr/lib/jvm/java/lib/security/default.policy: 
>> $(java_jdk_path)/lib/security/default.policy" >> usr.manifest)
>> +
>> +clean:
>> +       rm -f usr.manifest
>> diff --git a/modules/openjdk9_1x-from-host/module.py 
>> b/modules/openjdk9_1x-from-host/module.py
>> new file mode 100644
>> index 00000000..4685f586
>> --- /dev/null
>> +++ b/modules/openjdk9_1x-from-host/module.py
>> @@ -0,0 +1,37 @@
>> +from osv.modules.filemap import FileMap
>> +from osv.modules import api
>> +import os, os.path
>> +import subprocess
>> +
>> +#Verify that the jdk exists by trying to locate javac (java compiler)
>> +if subprocess.call(['which', 'javac']) != 0:
>> +    print('Could not find any jdk on the host. Please install openjdk9 
>> or later!')
>> +    exit(-1)
>> +
>> +javac_path = subprocess.check_output(['which', 
>> 'javac']).decode('utf-8').split('\n')[0]
>> +javac_real_path = os.path.realpath(javac_path)
>> +java_real_path = os.path.dirname(javac_real_path) + '/java'
>> +jdk_path = os.path.dirname(os.path.dirname(javac_real_path))
>> +
>> +javac_with_version = subprocess.check_output(['javac', '-version'], 
>> stderr=subprocess.STDOUT).decode('utf-8')
>> +java_version = javac_with_version.split()[1].split('.')[0]
>> +
>> +api.require('ca-certificates')
>> +api.require('libz')
>> +provides = ['java','java%s' % java_version]
>> +
>> +usr_files = FileMap()
>> +
>> +jdk_dir = os.path.basename(jdk_path)
>> +
>> +usr_files.add(jdk_path).to('/usr/lib/jvm/java') \
>> +    .include('lib/**') \
>> +    .exclude('lib/security/cacerts') \
>> +    .exclude('man/**') \
>> +    .exclude('bin/**') \
>> +    .include('bin/java') \
>> +    .include('bin/jshell')
>> +
>> +usr_files.link('/usr/lib/jvm/' + jdk_dir).to('java')
>>
>> +usr_files.link('/usr/lib/jvm/java/lib/security/cacerts').to('/etc/pki/java/cacerts')
>> +usr_files.link('/usr/bin/java').to('/usr/lib/jvm/java/bin/java')
>> -- 
>> 2.30.2
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "OSv Development" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/osv-dev/20210614042047.13437-1-jwkozaczuk%40gmail.com
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/7a0f89ef-410a-4b5c-97a3-e7feec1d0138n%40googlegroups.com.

Reply via email to