Skip to contentSkip to conversation

java-library.bbclass: compatibility with per-recipe sysroots

PATCH In review S. Lockwood-Childs 2 participants 2 messages Jul 12, 2017 – Jul 21, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 java-library.bbclass: compatibility with per-recipe sysroots

The removebinaries task was intended to remove pre-built .jar and .class files from the unpacked source, but when per-recipe sysroots were implemented and ended up under WORKDIR, .jar or .class in those sysroots inadvertently started getting killed as well.

For instance, ${WORKDIR}/recipe-sysroot-native/usr/share/java/ecj-bootstrap.jar was deleted when attempting to build jlex-native... which made javac in that sysroot rather unhappy.

Solve by excluding both recipe-sysroot and recipe-sysroot-native dirs from the search-and-destroy operation.

---
 classes/java-library.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
classes/java-library.bbclass +4 -2
index 58d5a40..ce1cd28 100644
@@ -50,8 +50,10 @@ ALTJARFILENAMES = "${BPN}.jar"
 # Java "source" distributions often contain precompiled things
 # we want to delete first.
 do_removebinaries() {
-  find ${WORKDIR} -name "*.jar" -exec rm {} \;
-  find ${WORKDIR} -name "*.class" -exec rm {} \;
+  find ${WORKDIR} ! -path "${RECIPE_SYSROOT}/*" ! -path "${RECIPE_SYSROOT_NATIVE}/*" \
+                  -name "*.jar" -exec rm {} \;
+  find ${WORKDIR} ! -path "${RECIPE_SYSROOT}/*" ! -path "${RECIPE_SYSROOT_NATIVE}/*" \
+                  -name "*.class" -exec rm {} \;
 }
 
 addtask removebinaries after do_unpack before do_patch
Signature · 1 line
1.9.4
#1 lore raw

Hi,

Quoted 37 lines · S. Lockwood-Childs

The removebinaries task was intended to remove pre-built .jar and .class files from the unpacked source, but when per-recipe sysroots were implemented and ended up under WORKDIR, .jar or .class in those sysroots inadvertently started getting killed as well.

For instance, ${WORKDIR}/recipe-sysroot-native/usr/share/java/ecj-bootstrap.jar was deleted when attempting to build jlex-native... which made javac in that sysroot rather unhappy.

Solve by excluding both recipe-sysroot and recipe-sysroot-native dirs from the search-and-destroy operation.

---
 classes/java-library.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
classes/java-library.bbclass +4 -2
index 58d5a40..ce1cd28 100644
@@ -50,8 +50,10 @@ ALTJARFILENAMES = "${BPN}.jar"
 # Java "source" distributions often contain precompiled things
 # we want to delete first.
 do_removebinaries() {
-  find ${WORKDIR} -name "*.jar" -exec rm {} \;
-  find ${WORKDIR} -name "*.class" -exec rm {} \;
+  find ${WORKDIR} ! -path "${RECIPE_SYSROOT}/*" ! -path "${RECIPE_SYSROOT_NATIVE}/*" \
+                  -name "*.jar" -exec rm {} \;
+  find ${WORKDIR} ! -path "${RECIPE_SYSROOT}/*" ! -path "${RECIPE_SYSROOT_NATIVE}/*" \
+                  -name "*.class" -exec rm {} \;
 }
 
 addtask removebinaries after do_unpack before do_patch
Signature · 1 line
1.9.4

Thanks, Pushed to master.

Best Regards,
Maxin