Custom gradle task for rpmbuild - gradle

We're currently in the process of moving away from scons to gradle to build the java portions of our software. One thing we need is to build rpm from the spec file. So we tried to write custom task to execute rpmbuild to build rpm from spec file. The code boils down to this:
def rpmPath = 'sample-master-5.0-128000-final.x86_64.rpm'
def rpmArgs = ['--quiet', '-bb', 'SPECS/sample-rpm-spec.spec', ' --define "rpmdir artifacts"', ' --define "sourcedir ."', ' --define "version 5.0"', ' --define "targetdir build"', ' --define "name sample"', ' --define "pathname sample"', ' --define "arch x86_64"', ' --define "revision 128000"', ' --define "branchName master"']
project.exec {
workingDir '.'
commandLine 'rpmbuild'
args rpmArgs
}
and here is the spec file:
# --define 'rpmdir dir' to specify the rpm destination directory
# --define 'version x.y.z' to define a build version
# --define 'sourcedir dir' to specify the location of the source directory
%define _builddir .
%define _rpmdir %{?rpmdir}%{!?rpmdir:RPMS}
%define _rpmfilename %{pathname}-%%{VERSION}-%%{RELEASE}%{?final}%{!?final:%{nil}}.%%{ARCH}.rpm
%define xyzapp /opt/xyzapp
Summary: Sample Spec File
Name: %{name}
Version: %{version}
Release: %{revision}
License: Commercial
Group: Applications/Imaging
Vendor: Sample Company Inc.
BuildRoot: %{_tmppath}/%{pathname}-buildroot
BuildArchitectures: %{arch}
Requires: first-rpm%{?branchName:-%{branchName}}%{!?branchName:} >= 2.10.0
Requires: second-rpm%{?branchName:-%{branchName}}%{!?branchName:} >= 2.10.0
%description
Sample Spec description
%build
echo building with rpmdir=%{_rpmdir} version=%{version} sourcedir=%{sourcedir}
# ensure the build root is clean
if [ %{buildroot} != "/" ]; then
rm -rf %{buildroot}
fi
mkdir -p %{_rpmdir}
mkdir -p %{buildroot}/tmp/classes
mkdir -p %{buildroot}%{xyzapp}
mkdir -p %{buildroot}%{xyzapp}/webapp/WEB-INF/lib/
if [ -f %{targetdir}/distributions/SampleZipArtifact.zip ]; then
unzip %{targetdir}/distributions/SampleZipArtifact.zip -d %{buildroot}%{xyzapp}/
fi
# remove the server classes that should not be included with this plugin
rm -rf %{buildroot}/tmp
find %{buildroot} -name .svn -o -name .classpath -o -name .project | xargs rm -rf
%clean
if [ %{buildroot} != "/" ]; then
rm -rf %{buildroot}
fi
%pre
%post
%preun
%postun
%files
%defattr(-,xyzapp,users,-)
%doc
%{xyzapp}/webapp
Essentially, by executing gradle buildSampleRpm
We got the error:
[ERROR] [system.err] error: No compatible architectures found for build
Here's is the full debug logs to give you more details:
14:23:16.462 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':buildSampleRpm'.
14:23:16.490 [INFO] [org.gradle.process.internal.DefaultExecHandle] Starting process 'command 'rpmbuild''. Working directory: /mnt/hgfs/CSI/GradleRpmSample Command: rpmbuild --quiet -bb SPECS/sample-rpm-spec.spec --define "rpmdir artifacts" --define "sourcedir ." --define "version 5.0" --define "targetdir ." --define "name sample" --define "pathname sample" --define "arch x86_64" --define "revision 128000" --define "branchName master"
14:23:16.490 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Environment for process 'command 'rpmbuild'': {TERM=xterm, JAVA_HOME=/usr/lib/jvm/java, FLEX_SDK=4.11, SESSION_MANAGER=local/unix:#/tmp/.ICE-unix/2695,unix/unix:/tmp/.ICE-unix/2695, GNOME_DESKTOP_SESSION_ID=this-is-deprecated, MAIL=/var/spool/mail/trungvo, GDMSESSION=gnome, XDG_SESSION_COOKIE=51806fc4a6f192828593c2df00000009-1428348402.461525-264542834, PWD=/mnt/hgfs/CSI/GradleRpmSample, HOSTNAME=tonycsicentos6, CVS_RSH=ssh, GIO_LAUNCHED_DESKTOP_FILE_PID=16285, G_BROKEN_FILENAMES=1, NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat, GNOME_KEYRING_SOCKET=/tmp/keyring-LiVncy/socket, CSI_DATA=/mnt/hgfs/CSI/Data/trunk, GDM_KEYBOARD_LAYOUT=us, HISTSIZE=1000, EDITOR=vi, PATH=/mnt/hgfs/CSI/Library/rhel5-64/ant/bin:/mnt/hgfs/CSI/Library/rhel5-64/Tools/flex_sdk_4.11/bin:/home/trungvo/gradle-2.3/bin:/mnt/hgfs/CSI/Library/rhel5-64/ant/bin:/mnt/hgfs/CSI/Library/rhel5-64/Tools/flex_sdk_4.11/bin:/home/trungvo/gradle-2.3/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/apache-ant-1.8.1/bin:/home/trungvo/bin:/opt/apache-ant-1.8.1/bin, GRADLE_HOME=/home/trungvo/gradle-2.3, QTLIB=/usr/lib64/qt-3.3/lib, GDCM_DATA_ROOT=/mnt/hgfs/CSI/Data/trunk/CSI/Rendering/gdcmData, GDM_LANG=en_US.utf8, XAUTHORITY=/var/run/gdm/auth-for-trungvo-dyz7I2/database, WINDOWPATH=1, FLEX_HOME=/mnt/hgfs/CSI/Library/rhel5-64/Tools/flex_sdk_4.11, USERNAME=trungvo, SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass, SHLVL=2, XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt, COLORTERM=gnome-terminal, CSI_LIB64=/mnt/hgfs/CSI/Library/rhel5-64, GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/gnome-terminal.desktop, WINDOWID=44040195, LOGNAME=trungvo, QTDIR=/usr/lib64/qt-3.3, SSH_AUTH_SOCK=/tmp/keyring-LiVncy/socket.ssh, OLDPWD=/home/trungvo/gradle-2.3, LIBGL_DRIVERS_PATH=/usr/local/lib/gallium, DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-9FkHHSyF0Z,guid=7c6139ab66bf88999c60bf4d0000013e, SHELL=/bin/bash, GNOME_KEYRING_PID=2685, GTK_RC_FILES=/etc/gtk/gtkrc:/home/trungvo/.gtkrc-1.2-gnome2, DESKTOP_SESSION=gnome, FLEX_HOME_4=/mnt/hgfs/CSI/Library/rhel5-64/Tools/flex_sdk_4.11, QTINC=/usr/lib64/qt-3.3/include, DISPLAY=:0.0, USER=trungvo, ANT_HOME=/mnt/hgfs/CSI/Library/rhel5-64/ant, GRADLE_OPTS=-Dorg.gradle.native=false, MESA_GLSL=opt,nopvert,nopfrag, HOME=/home/trungvo, HISTCONTROL=ignoredups, LESSOPEN=|/usr/bin/lesspipe.sh %s, MALLOC_TRIM_THRESHOLD_=128*1024, LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.tbz=01;31:*.tbz2=01;31:*.bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:, ORBIT_SOCKETDIR=/tmp/orbit-trungvo, LANG=en_US.utf8}
14:23:16.499 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING
14:23:16.506 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: command 'rpmbuild'.
14:23:16.516 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTED
14:23:16.517 [DEBUG] [org.gradle.process.internal.ExecHandleRunner] waiting until streams are handled...
14:23:16.517 [INFO] [org.gradle.process.internal.DefaultExecHandle] Successfully started process 'command 'rpmbuild''
14:23:16.545 [ERROR] [system.err] error: No compatible architectures found for build
14:23:16.569 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED
14:23:16.569 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'command 'rpmbuild'' finished with exit value 1 (state: FAILED)
14:23:16.570 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':buildSampleRpm'
14:23:16.571 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :buildSampleRpm FAILED
Did we miss to pass in the architecture in the command?
Please note that we do pass in --define 'arch x86_64'
We did try to pass in the option --buildarch x86_64, but apparently, it's the unknown option for our version of rpmbuild
If we execute the rpmbuild command directly from the terminal, it works just fine, however, as soon as we execute the rpmbuild in the gradle shell, things starting to break. That makes me to think that it's properly we missed to passed in some configuration into the Gradle.project.exec
You can download the full sample source code from here:
https://dl.dropboxusercontent.com/u/59660821/GradleRpmSample.zip
I'm running gradle on Centos 6.4
I did think about using nebula.os-package however, according to their API they use Gradle DSL to construct rpm packages. It doesn't offer a way for us to construct rpm package from spec files. We have a huge amount of spec files, converting spec files logic to Gradle DSL is not an option for us at the moment.
I looked around and apparently scons/python is a preferred choice for building rpm packages from spec files, so I'm trying to use gradle to drive scons to build rpm from spec files with rpmbuild command
Little bit history, we're mainly C/C++ shops so we're currently using scons to build our system. However, we run into many problems with specifying dynamically generated dependency in scons for Java side. So we're thinking of using Gradle as orchestration tool where it would drive scons to build C++ side, build Java side and dependency management.
It would be very nice if we could use gradle to build rpm packages from spec files through rpmbuild command line as our company have huge amount of spec files. Furthermore, it would also drive more Gradle adoption as I think most people use spec files to build rpm packages.
Let me know if there's anything else I can provide. Thank you very much guys

in spec file, have you tried to replace BuildArchitectures with BuildArch, maybe a typo?
ref.
https://fedoraproject.org/wiki/How_to_create_an_RPM_package#SPEC_file_overview
rpmbuild -vv gives debug.
kind regards

Thanks Joern, I got it working by split the arguments '--define blah' into separate arguments and remove any white spaces and it seems to work just fine.

You can try the SetupBuilder plugin. It build also an rpm installer.

Related

docker build fails inside gitlab-runner but works locally : spring boot native compilation with GraalVm

I made a Dockerfile to build my spring boot project with GraalVm natively; everything went correctly.
Here is the Dockerfile
FROM ghcr.io/graalvm/graalvm-ce:22.3.1 AS buildnative
WORKDIR /app
COPY mvnw pom.xml ./
COPY .mvn/ .mvn
COPY src ./src
RUN ./mvnw clean package -Pnative
FROM ubuntu:23.04
EXPOSE 8080
COPY --from=buildnative /app/target/spring-boot-project /build/app
CMD ["/build/app"]
This runs perfectly locally, but in the GitLab runner, I always have the same error.
JAVA_HOME is not defined correctly.
We cannot execute /opt/graalvm-ce-java17-22.3.1/bin/java
The command '/bin/sh -c ./mvnw clean package -Pnative' returned a non-zero code: 1
So I decided to add some logs within the maven wrapper, and here is what I have :
Step 7/11 : RUN ./mvnw clean package -Pnative ---> Running in 81e0558130f3 ------------> /opt/graalvm-ce-java17-22.3.1/bin/java ------------> JAVA_HOME is /opt/graalvm-ce-java17-22.3.1 Error: JAVA_HOME is not defined correctly. We cannot execute /opt/graalvm-ce-java17-22.3.1/bin/java The command '/bin/sh -c ./mvnw clean package -Pnative' returned a non-zero code: 1 Cleaning up project directory and file based variables
Step 7/11 : RUN ./mvnw clean package -Pnative
---> Running in 81e0558130f3
------------> /opt/graalvm-ce-java17-22.3.1/bin/java
------------> JAVA_HOME is /opt/graalvm-ce-java17-22.3.1
Error: JAVA_HOME is not defined correctly.
We cannot execute /opt/graalvm-ce-java17-22.3.1/bin/java
The command '/bin/sh -c ./mvnw clean package -Pnative' returned a non-zero code: 1
Cleaning up project directory and file based variables
In the log I have added, we can see JAVA_HOME is defined and is adequately defined. It is the same as locally, where everything works perfectly.
I tried to add this line: RUN chmod +x mvnw before running it, but it did not change anything.
I need more ideas. Is there anyone have an idea of what is happening?
Edit:
I decided to dive deeper into the issue. I have added logs to know why it does not work. I modified the mvnw script to know what was happening.
I have added this to mvnw
if [ -e "$JAVACMD" ] ; then
echo "------------> THE FILE EXIST" >&2
else
echo "------------> THE FILE DOES NOT EXIST" >&2
fi
if [ -x "$JAVACMD" ] ; then
echo "------------> THE FILE IS EXECUTABLE" >&2
else
echo "------------> THE FILE IS NOT EXECUTABLE" >&2
fi
Results:
Here is in local:
------------> JAVACMD /opt/graalvm-ce-java17-22.3.1/bin/java
------------> THE FILE EXIST
------------> THE FILE IS EXECUTABLE
Here is in the gitlab-runner:
------------> JAVACMD /opt/graalvm-ce-java17-22.3.1/bin/java
------------> THE FILE EXIST
------------> THE FILE IS NOT EXECUTABLE
Makes no sense to me
Is your GitLab runner configured to use a non-root user when executing the Dockerfile?
As #jilliss pointed out, it seems that it's the Java binary that needs execute permission, but maybe only root has the permission (which is why it works locally as by default you will be running it as root).
If the Ops team have tried to run the Dockerfile as another user, then it could explain why /opt/graalvm-ce-java17-22.3.1/bin/java is no longer executable.
Try adding a whoami log and see which user is running when it runs in GL.
Correct compile command is
mvn -Pnative native:compile
You can see more details and full doc here. After that you will see graalvm build result in the logs. So you need to change your docker file like below
FROM ghcr.io/graalvm/graalvm-ce:22.3.1 AS buildnative
WORKDIR /app
COPY mvnw pom.xml ./
COPY .mvn/ .mvn
COPY src ./src
RUN ./mvnw native:compile -Pnative
FROM ubuntu:23.04
EXPOSE 8080
COPY --from=buildnative /app/target/spring-boot-project /build/app
CMD ["/build/app"]
example build log from my local build
[INFO] --- native-maven-plugin:0.9.19:compile (default-cli) # demo ---
Downloading: Component catalog from www.graalvm.org
Processing Component: Native Image
Downloading: Component native-image: Native Image from github.com
Installing new component: Native Image (org.graalvm.native-image, version 22.3.1)
[INFO] Found GraalVM installation from JAVA_HOME variable.
[INFO] [graalvm reachability metadata repository for ch.qos.logback:logback-classic:1.4.5]: Configuration directory not found. Trying latest version.
[INFO] [graalvm reachability metadata repository for ch.qos.logback:logback-classic:1.4.5]: Configuration directory is ch.qos.logback/logback-classic/1.4.1
[INFO] Executing: /opt/graalvm-ce-java17-22.3.1/bin/native-image -cp /app/target/classes:/root/.m2/repository/org/springframework/spring-aop/6.0.4/spring-aop-6.0.4.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-logging/3.0.2/spring-boot-starter-logging-3.0.2.jar:/root/.m2/repository/org/springframework/spring-context/6.0.4/spring-context-6.0.4.jar:/root/.m2/repository/org/springframework/spring-core/6.0.4/spring-core-6.0.4.jar:/root/.m2/repository/org/apache/logging/log4j/log4j-api/2.19.0/log4j-api-2.19.0.jar:/root/.m2/repository/org/springframework/spring-expression/6.0.4/spring-expression-6.0.4.jar:/root/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.19.0/log4j-to-slf4j-2.19.0.jar:/root/.m2/repository/ch/qos/logback/logback-core/1.4.5/logback-core-1.4.5.jar:/root/.m2/repository/jakarta/annotation/jakarta.annotation-api/2.1.1/jakarta.annotation-api-2.1.1.jar:/root/.m2/repository/org/springframework/spring-beans/6.0.4/spring-beans-6.0.4.jar:/root/.m2/repository/ch/qos/logback/logback-classic/1.4.5/logback-classic-1.4.5.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter/3.0.2/spring-boot-starter-3.0.2.jar:/root/.m2/repository/org/springframework/spring-jcl/6.0.4/spring-jcl-6.0.4.jar:/root/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/3.0.2/spring-boot-autoconfigure-3.0.2.jar:/root/.m2/repository/org/slf4j/jul-to-slf4j/2.0.6/jul-to-slf4j-2.0.6.jar:/root/.m2/repository/org/yaml/snakeyaml/1.33/snakeyaml-1.33.jar:/root/.m2/repository/org/springframework/boot/spring-boot/3.0.2/spring-boot-3.0.2.jar:/root/.m2/repository/org/slf4j/slf4j-api/2.0.6/slf4j-api-2.0.6.jar --no-fallback -H:Path=/app/target -H:Name=demo -H:ConfigurationFileDirectories=/app/target/graalvm-reachability-metadata/160481799c4b6c37cde925c9aebf513c32245dcf/ch.qos.logback/logback-classic/1.4.1
========================================================================================================================
GraalVM Native Image: Generating 'demo' (executable)...
========================================================================================================================
[1/7] Initializing... (6.6s # 0.23GB)
Version info: 'GraalVM 22.3.1 Java 17 CE'
Java version info: '17.0.6+10-jvmci-22.3-b13'
C compiler: gcc (redhat, x86_64, 11.3.1)
Garbage collector: Serial GC
1 user-specific feature(s)
- org.springframework.aot.nativex.feature.PreComputeFieldFeature
Field org.apache.commons.logging.LogAdapter#log4jSpiPresent set to true at build time
Field org.apache.commons.logging.LogAdapter#log4jSlf4jProviderPresent set to true at build time
Field org.apache.commons.logging.LogAdapter#slf4jSpiPresent set to true at build time
Field org.apache.commons.logging.LogAdapter#slf4jApiPresent set to true at build time
Field org.springframework.core.NativeDetector#imageCode set to true at build time
Field org.springframework.format.support.DefaultFormattingConversionService#jsr354Present set to false at build time
Field org.springframework.core.KotlinDetector#kotlinPresent set to false at build time
Field org.springframework.core.KotlinDetector#kotlinReflectPresent set to false at build time
Field org.springframework.cglib.core.AbstractClassGenerator#imageCode set to true at build time
Field org.springframework.boot.logging.log4j2.Log4J2LoggingSystem$Factory#PRESENT set to false at build time
Field org.springframework.boot.logging.java.JavaLoggingSystem$Factory#PRESENT set to true at build time
Field org.springframework.boot.logging.logback.LogbackLoggingSystem$Factory#PRESENT set to true at build time
Field org.springframework.boot.logging.logback.LogbackLoggingSystemProperties#JBOSS_LOGGING_PRESENT set to false at build time
Field org.springframework.context.event.ApplicationListenerMethodAdapter#reactiveStreamsPresent set to false at build time
[2/7] Performing analysis... [*******] (60.8s # 2.15GB)
8,903 (88.31%) of 10,082 classes reachable
13,147 (64.27%) of 20,456 fields reachable
40,485 (56.88%) of 71,181 methods reachable
365 classes, 115 fields, and 1,191 methods registered for reflection
64 classes, 70 fields, and 55 methods registered for JNI access
4 native libraries: dl, pthread, rt, z
[3/7] Building universe... (8.9s # 2.03GB)
[4/7] Parsing methods... [***] (9.6s # 0.82GB)
[5/7] Inlining methods... [***] (3.7s # 2.16GB)
[6/7] Compiling methods... [*******] (48.2s # 1.97GB)
[7/7] Creating image... (5.6s # 1.60GB)
17.53MB (49.48%) for code area: 25,460 compilation units
17.60MB (49.66%) for image heap: 215,829 objects and 25 resources
312.40KB ( 0.86%) for other data
35.44MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 packages in code area: Top 10 object types in image heap:
936.87KB java.util 3.72MB byte[] for code metadata
594.27KB java.lang.invoke 2.07MB java.lang.String
469.21KB c.s.org.apache.xerces.internal.impl.xs.traversers 2.06MB java.lang.Class
455.78KB java.lang 1.68MB byte[] for general heap data
423.05KB com.sun.org.apache.xerces.internal.impl 1.60MB byte[] for java.lang.String
407.79KB com.sun.crypto.provider 765.10KB com.oracle.svm.core.hub.DynamicHubCompanion
375.00KB org.springframework.beans.factory.support 576.38KB java.util.HashMap$Node
371.71KB java.io 513.09KB int[][]
354.25KB java.util.concurrent 394.88KB java.lang.String[]
328.57KB java.text 394.65KB byte[] for reflection metadata
12.74MB for 405 more packages 3.23MB for 1771 more object types
------------------------------------------------------------------------------------------------------------------------
12.0s (8.0% of total time) in 35 GCs | Peak RSS: 3.04GB | CPU load: 5.08
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
/app/target/demo (executable)
/app/target/demo.build_artifacts.txt (txt)
========================================================================================================================
Finished generating 'demo' in 2m 29s.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:11 min
[INFO] Finished at: 2023-01-27T18:05:23Z
[INFO] ------------------------------------------------------------------------
Never tried gitlab runner myself, but have you tried to force the JAVA_HOME env path before maven command?
ENV JAVA_HOME=/opt/graalvm-ce-java17-22.3.1
RUN ./mvnw clean package -Pnative
hope it helps

How to install Dirac (a Chrome DevTools fork for ClojureScript) on macOS Monterey 12.5 if error: "Could not locate clojure/data/ files" appears?

I am trying to install Dirac on a Macbook Air M1 running Monterey 12.5.
I am following the documentation which indicates:
curl -s https://raw.githubusercontent.com/binaryage/dirac/master/install > /tmp/dirac.install && sudo bash /tmp/dirac.install
The installation seems to have worked out since it exists on binaries:
Pedros-MacBook-Air:bin pedro$ pwd
/usr/local/bin
Pedros-MacBook-Air:bin pedro$ ls -1
dirac
lein
Unfortunately, when I go to the 2nd step on manual which is running dirac, the error below is retrieved:
Pedros-MacBook-Air:bin pedro$ dirac
WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/update-vals
WARNING: update-keys already refers to: #'clojure.core/update-keys in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/update-keys
WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/update-vals
WARNING: update-keys already refers to: #'clojure.core/update-keys in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/update-keys
WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer.passes, being replaced by: #'clojure.tools.analyzer.utils/update-vals
WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer.passes.uniquify, being replaced by: #'clojure.tools.analyzer.utils/update-vals
Execution error (FileNotFoundException) at dirac.nrepl.compilation.direct/eval15283$loading (direct.clj:1).
Could not locate clojure/data/json__init.class, clojure/data/json.clj or clojure/data/json.cljc on classpath.
Full report at:
/var/folders/fh/7d_1drwd2ps3zw03j9ftkqs80000gn/T/clojure-1010884132545121253.edn
Initially, I tried running it at home folder. I thought it would work out fine.
Then, I decided to run it inside a project folder that had the file clojure/data/json.clj
included in the the project.clj file. Unfortunately, even this approach did not work out.
Below you see a simplified version of the project.clj file:
(defproject abcd ; Should be copied from shadow-cljs.edn
:description "xxxx"
:url "xxxx"
:dependencies [[org.clojure/clojure "1.9.0"]
[org.clojure/clojurescript "1.10.339"]
[org.clojure/tools.nrepl "RELEASE"]
[binaryage/devtools ~devtools-version]
[binaryage/dirac ~dirac-version]
[org.clojure/data.json "2.4.0"]
[figwheel ~figwheel-version]
;; Selmer for templating of .json config files
[selmer "1.12.50"]]
... (omitted content because it seems irrelevant) ...
:profiles {:repl
{:repl-options {:port 8230
:nrepl-middleware [dirac.nrepl/middleware]
:init (do
(require 'dirac.agent)
(dirac.agent/boot!))
}}})
1 - I thought Dirac would work out even outside of the project folder. Is it necessary to be in the project folder?
2 - Why is Dirac complaining about the Json library even though it is listed as a dependency?
Is there any difference between clojure/data/json.clj (error message retrieved) and org.clojure/data.json (my dependency)?
You've received a workaround on dirac/issues/98: adding {:deps {org.clojure/data.json {:mvn/version "2.4.0"}}} to ~/.clojure/deps.edn.
The local launcher script has a dependency on the release version of ClojureScript, that no longer includes clojure/data.json. A better workaround is changing the /usr/local/bin/dirac file line 119 by adding clojure.data.json there as well (or pinning to a ClojureScript version before 1.11.51):
DEPS="{:deps {\
$DIRAC_CLI_DEPS_COORDINATE \
org.clojure/clojurescript {:mvn/version \"RELEASE\"} \
org.clojure/data.json {:mvn/version \"2.4.0\"} \
clj-logging-config/clj-logging-config {:mvn/version \"1.9.12\"} \
}}"
Explanation
The dependency org.clojure/data.json was removed from ClojureScript in version 1.11.51 of May 13th 2022. See release notes:
Vendorization of tools.reader, data.json, and transit-clj (...) After conferring with the Clojure Team, we decided to vendorize all these dependencies. This way we can AOT everything and be confident that we won’t create a conflict that can’t easily be fixed via normal dependency management. (...) The dependance on data.json has been removed.

Buildkite Windows agent cannot find git executable

I'm having trouble getting the Windows build agent to run a build. The agent is unable to checkout my source code. (Im using Windows 10) See GitHub issue
I am seeing the following error when running a build:
Buildkite Error: There was an error running `git clone -v -- git#github.com:myorg/myrepo.git .` (exec: "git": executable file not found in %PATH%)
I have installed git using chocolatey and git is accessible in CMD and Powershell on the agent's host and I can see it in my path if I run gci env:Path in Powershell. git's directory is at the end here:
C:\Program Files\Docker\Docker\Resources\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cm...
From a build's logs in BK's web UI, I see the following environment variables printed out:
BUILDKITE=true
BUILDKITE_AGENT_ACCESS_TOKEN=xxx
BUILDKITE_AGENT_DEBUG=true
BUILDKITE_AGENT_ENDPOINT=https://agent.buildkite.com/v3
BUILDKITE_AGENT_ID=xxx
BUILDKITE_AGENT_NAME=DESKTOP-1
BUILDKITE_AGENT_PID=5180
BUILDKITE_ARTIFACT_PATHS=
BUILDKITE_BIN_PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27
BUILDKITE_BRANCH=fix/build
BUILDKITE_BUILD_CHECKOUT_PATH=builds\DESKTOP-1\myorg\myrepo
BUILDKITE_BUILD_CREATOR=Jason
BUILDKITE_BUILD_CREATOR_EMAIL=myemail#gmail.com
BUILDKITE_BUILD_ID=xxx
BUILDKITE_BUILD_NUMBER=18
BUILDKITE_BUILD_PATH=builds
BUILDKITE_BUILD_URL=https://buildkite.com/myorg/myrepo/builds/18
BUILDKITE_COMMAND=msbuild
BUILDKITE_COMMAND_EVAL=true
BUILDKITE_COMMIT=HEAD
BUILDKITE_GIT_CLEAN_FLAGS=-fxdq
BUILDKITE_GIT_CLONE_FLAGS=-v
BUILDKITE_HOOKS_PATH=hooks
BUILDKITE_JOB_ID=xxx
BUILDKITE_MESSAGE=First build
BUILDKITE_ORGANIZATION_SLUG=myorg
BUILDKITE_PIPELINE_DEFAULT_BRANCH=master
BUILDKITE_PIPELINE_PROVIDER=github
BUILDKITE_PIPELINE_SLUG=myrepo
BUILDKITE_PLUGINS_PATH=plugins
BUILDKITE_PROJECT_PROVIDER=github
BUILDKITE_PROJECT_SLUG=myorg/myrepo
BUILDKITE_PULL_REQUEST=false
BUILDKITE_PULL_REQUEST_REPO=
BUILDKITE_REPO=git#github.com:myorg/myrepo.git
BUILDKITE_REPO_SSH_HOST=github.com
BUILDKITE_RETRY_COUNT=0
BUILDKITE_SCRIPT_PATH=msbuild
BUILDKITE_SOURCE=ui
BUILDKITE_SSH_FINGERPRINT_VERIFICATION=true
BUILDKITE_TAG=
BUILDKITE_TIMEOUT=false
CI=true
PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
Note that PATH in that output is not the same as my PATH from the Powershell and does not include the path to gits binary.
Full build output:
Build environment variables 0s
BUILDKITE=true
BUILDKITE_AGENT_ACCESS_TOKEN=xxx
BUILDKITE_AGENT_DEBUG=true
BUILDKITE_AGENT_ENDPOINT=https://agent.buildkite.com/v3
BUILDKITE_AGENT_ID=xxx
BUILDKITE_AGENT_NAME=DESKTOP-1
BUILDKITE_AGENT_PID=5180
BUILDKITE_ARTIFACT_PATHS=
BUILDKITE_BIN_PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27
BUILDKITE_BRANCH=fix/build
BUILDKITE_BUILD_CHECKOUT_PATH=builds\DESKTOP-1\myorg\myrepo
BUILDKITE_BUILD_CREATOR=Jason
BUILDKITE_BUILD_CREATOR_EMAIL= myemail#gmail.com
BUILDKITE_BUILD_ID=xxx
BUILDKITE_BUILD_NUMBER=18
BUILDKITE_BUILD_PATH=builds
BUILDKITE_BUILD_URL=https://buildkite.com/myorg/myrepo/builds/18
BUILDKITE_COMMAND=msbuild
BUILDKITE_COMMAND_EVAL=true
BUILDKITE_COMMIT=HEAD
BUILDKITE_GIT_CLEAN_FLAGS=-fxdq
BUILDKITE_GIT_CLONE_FLAGS=-v
BUILDKITE_HOOKS_PATH=hooks
BUILDKITE_JOB_ID=xxx
BUILDKITE_MESSAGE=First build
BUILDKITE_ORGANIZATION_SLUG=myorg
BUILDKITE_PIPELINE_DEFAULT_BRANCH=master
BUILDKITE_PIPELINE_PROVIDER=github
BUILDKITE_PIPELINE_SLUG=myrepo
BUILDKITE_PLUGINS_PATH=plugins
BUILDKITE_PROJECT_PROVIDER=github
BUILDKITE_PROJECT_SLUG=myorg/myrepo
BUILDKITE_PULL_REQUEST=false
BUILDKITE_PULL_REQUEST_REPO=
BUILDKITE_REPO=git#github.com:myorg/myrepo.git
BUILDKITE_REPO_SSH_HOST=github.com
BUILDKITE_RETRY_COUNT=0
BUILDKITE_SCRIPT_PATH=msbuild
BUILDKITE_SOURCE=ui
BUILDKITE_SSH_FINGERPRINT_VERIFICATION=true
BUILDKITE_TAG=
BUILDKITE_TIMEOUT=false
CI=true
PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
Running global environment hook 0s
# Skipping, no hook script found at "hooks\environment.bat"
Running global pre-checkout hook 0s
# Skipping, no hook script found at "hooks\pre-checkout.bat"
Preparing build directory 0s
# Changing working directory to "builds\DESKTOP-1\myorg\myrepo"
⚠ Buildkite Warning: Could not performn `ssh-keygen` (exec: "ssh-keygen": executable file not found in %PATH%)
> git clone -v -- git#github.com:myorg/myrepo.git .
🚨 Buildkite Error: There was an error running `git clone -v -- git#github.com:myorg/myrepo.git .` (exec: "git": executable file not found in %PATH%)
Your build output doesn't seem to have those chocolatey paths:
PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27;
You might need to add an agent environment hook which adds the right directories to the path. Or try updating to the latest beta which might fix the issue.

Pulseaudio build issue in yocto

I am using Raspberry Pi 3 model B. I am facing build issue while building bitbake pulseaudio. Please find my configuration details:
Yocto : Jethro branch
pulseaudio.inc RDEPENDS_pulseaudio-server +=
"alsa-plugins-pulseaudio-conf"
we are using alsa-plugins_1.0.29.bb
bitbake pulseaudio
ERROR: Nothing RPROVIDES 'alsa-plugins-pulseaudio-conf' (but /home/guest/openembedded-core/meta/recipes-multimedia/pulseaudio/pulseaudio_6.0.bb RDEPENDS on or otherwise requires it)
NOTE: Runtime target 'alsa-plugins-pulseaudio-conf' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['alsa-plugins-pulseaudio-conf']
ERROR: Required build target 'pulseaudio' has no buildable providers.
Missing or unbuildable dependency chain was: ['pulseaudio', 'alsa-plugins-pulseaudio-conf']
Based on the recipe the package alsa-plugins-pulseaudio-conf is generated if "pulseaudio" is in the alsa-plugins PACKAGECONFIG. By default that happens if your DISTRO_FEATURES includes "pulseaudio".
So check your DISTRO_FEATURES, ensure "pulseaudio" is in there (and make sure you don't modify the alsa-plugins PACKAGECONFIG in a bad way).
To see what your DISTRO_FEATURES contains:
bitbake -e pulseaudio |grep "^DISTRO_FEATURES="
To add pulseaudio if it's not there right now (you can do this in local or distro config):
DISTRO_FEATURES_append = " pulseaudio "
The whitespace preceding the feature name is required.
To check what PACKAGECONFIG is getting used for alsa-plugins (this should contain "pulseaudio"):
bitbake -e alsa-plugins|grep "^PACKAGECONFIG="

I'm not signing my RPMs, but they have signatures anyway. "Header V4 RSA/SHA1 signature: BAD"

I am building an RPM using sbt-native-packager on my Mac which can't be installed on RHEL 5 machines because it has a V4 signature. The result of rpm -v --checksig on my Mac:
Header V4 RSA/SHA1 signature: OK, key ID f769fd38
Header SHA1 digest: OK (2ee9b411052b2aeadcb0efa5401f246af8ca6e68)
MD5 digest: OK (b78e1256caba2959428b1e5544d562a6)
And the result of rpm -v --checksig on the RHEL 5 machine:
Header V4 RSA/SHA1 signature: BAD, key ID f769fd38
Header SHA1 digest: OK (2ee9b411052b2aeadcb0efa5401f246af8ca6e68)
MD5 digest: OK (b78e1256caba2959428b1e5544d562a6)
I saw this answer which implied that it had to do with GPG signatures, but that doesn't add up.
The sbt-native-packager RPM plugin doesn't do signing according to its developers, as can be evidenced by the rpmbuild command it emits:
rpmbuild -bb --target noarch-PayPal-Linux --buildroot /Users/2rs2ts/src/my-app/my-app/target/rpm/buildroot --define _topdir /Users/2rs2ts/src/my-app/my-app/target/rpm --define _tmppath /var/folders/gp/l9gt6r791p1bdcgtf2b2dppw392tbp/T/sbt_8f0f0597 myapp.spec
Plus, I don't have gpg installed on my Mac, so the fix in the linked answer doesn't really seem to apply to me. I realize that rpm usually comes with an installation of gpg so maybe it's using that to make the signatures, but I have no idea what key it's using or how to make it force a V3 signature or stop signing entirely. I'm not sure if that last statement was even sensible, as I have very limited experience working with rpm.
Nonetheless I did try to at least modify ~/.rpmmacros as that guide suggested but it was to no avail. I have no leads. Why do my RPMs have signatures if I didn't sign them, and how can I prevent those signatures from being V4?
Edit per request, here is the output from sbt (I believe the "error" lines are just an implementation quirk and not actual errors):
[debug] Executing rpmbuild with: rpmbuild -bb --target noarch-PayPal-Linux --buildroot /Users/2rs2ts/src/my-app/my-app/target/rpm/buildroot --define _topdir /Users/2rs2ts/src/my-app/my-app/target/rpm --define _tmppath /var/folders/gp/l9gt6r791p1bdcgtf2b2dppw392tbp/T/sbt_8f0f0597 myapp.spec
[info] Building target platforms: noarch-PayPal-Linux
[info] Executing(%install): /bin/sh -e /var/folders/gp/l9gt6r791p1bdcgtf2b2dppw392tbp/T/sbt_8f0f0597/rpm-tmp.67386
[error] + umask 022
[error] + cd /Users/2rs2ts/src/my-app/my-app/target/rpm/BUILD
[error] + /bin/rm -rf /Users/2rs2ts/src/my-app/my-app/target/rpm/buildroot
[error] + /bin/mkdir -p /Users/2rs2ts/src/my-app/my-app/target/rpm/buildroot
[error] + '[' -e /Users/2rs2ts/src/my-app/my-app/target/rpm/buildroot ']'
[error] + mv /Users/2rs2ts/src/my-app/my-app/target/rpm/tmp-buildroot/etc /Users/2rs2ts/src/my-app/my-app/target/rpm/tmp-buildroot/var /Users/2rs2ts/src/my-app/my-app/target/rpm/tmp-buildroot/x /Users/2rs2ts/src/my-app/my-app/target/rpm/buildroot
[error] + exit 0
[info] Processing files: myapp-VersionNotSet-ReleaseNotSet.noarch
[info] Provides: config(myapp) = 0:VersionNotSet-ReleaseNotSet
[info] Requires(interp): /bin/sh /bin/sh /bin/sh /bin/sh
[info] Requires(pre): /bin/sh
[info] Requires(post): /bin/sh
[info] Requires(preun): /bin/sh
[info] Requires(postun): /bin/sh
[info] Checking for unpackaged file(s): /usr/local/Cellar/rpm/5.4.15/lib/rpm/check-files /Users/2rs2ts/src/my-app/my-app/target/rpm/buildroot
[info] Wrote: /Users/2rs2ts/src/my-app/my-app/target/rpm/RPMS/noarch/myapp-VersionNotSet-ReleaseNotSet.noarch.rpm
I can hazard a guess: the issue is RSA being broken in several ways in RHEL5 rpm. The easiest fix is to try signing with DSA rather than RSA.
Does DSA "work" on both MAC and RHEL5?

Resources