* [gentoo-dev] [PATCH] java-pkg-simple.eclass: improve MANIFEST.MF manipulation
@ 2022-10-04 19:19 Volkmar W. Pogatzki
2022-10-05 9:20 ` Florian Schmaus
0 siblings, 1 reply; 2+ messages in thread
From: Volkmar W. Pogatzki @ 2022-10-04 19:19 UTC (permalink / raw
To: gentoo-dev
For adding Main-class and/or Automatic-module-name to MANIFEST.MF it
seems better to use "jar" functionality at the end of compilation.
This does the necessary checks and issues warnings in case of duplicate
entries.
Closes: https://bugs.gentoo.org/874924
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
---
eclass/java-pkg-simple.eclass | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass
index 7a9582393dd..5f691571e53 100644
--- a/eclass/java-pkg-simple.eclass
+++ b/eclass/java-pkg-simple.eclass
@@ -415,15 +415,6 @@ java-pkg-simple_src_compile() {
fi
# package
- [[ ! -d ${classes}/META-INF ]] && mkdir ${classes}/META-INF
- if [[ -v JAVA_AUTOMATIC_MODULE_NAME ]]; then
- echo "Automatic-Module-Name: ${JAVA_AUTOMATIC_MODULE_NAME}" \
- >> ${classes}/META-INF/MANIFEST.MF || die "adding module name failed"
- fi
- if [[ -v JAVA_MAIN_CLASS ]]; then
- echo "Main-Class: ${JAVA_MAIN_CLASS}" \
- >> ${classes}/META-INF/MANIFEST.MF || die "adding main class failed"
- fi
local jar_args
if [[ -e ${classes}/META-INF/MANIFEST.MF ]]; then
jar_args="cfm ${JAVA_JAR_FILENAME} ${classes}/META-INF/MANIFEST.MF"
@@ -431,6 +422,18 @@ java-pkg-simple_src_compile() {
jar_args="cf ${JAVA_JAR_FILENAME}"
fi
jar ${jar_args} -C ${classes} . || die "jar failed"
+ if [[ -v JAVA_AUTOMATIC_MODULE_NAME ]]; then
+ echo "Automatic-Module-Name: ${JAVA_AUTOMATIC_MODULE_NAME}" \
+ >> "${T}/add-to-MANIFEST.MF" || die "adding module name failed"
+ fi
+ if [[ -v JAVA_MAIN_CLASS ]]; then
+ echo "Main-Class: ${JAVA_MAIN_CLASS}" \
+ >> "${T}/add-to-MANIFEST.MF" || die "adding main class failed"
+ fi
+ if [[ -e ${T}/add-to-MANIFEST.MF ]]; then
+ jar ufmv ${JAVA_JAR_FILENAME} "${T}/add-to-MANIFEST.MF" \
+ || die "updating MANIFEST.MF failed"
+ fi
}
# @FUNCTION: java-pkg-simple_src_install
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [gentoo-dev] [PATCH] java-pkg-simple.eclass: improve MANIFEST.MF manipulation
2022-10-04 19:19 [gentoo-dev] [PATCH] java-pkg-simple.eclass: improve MANIFEST.MF manipulation Volkmar W. Pogatzki
@ 2022-10-05 9:20 ` Florian Schmaus
0 siblings, 0 replies; 2+ messages in thread
From: Florian Schmaus @ 2022-10-05 9:20 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1.1.1: Type: text/plain, Size: 2225 bytes --]
On 04/10/2022 21.19, Volkmar W. Pogatzki wrote:
> For adding Main-class and/or Automatic-module-name to MANIFEST.MF it
> seems better to use "jar" functionality at the end of compilation.
> This does the necessary checks and issues warnings in case of duplicate
> entries.
>
> Closes: https://bugs.gentoo.org/874924
> Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
> ---
> eclass/java-pkg-simple.eclass | 21 ++++++++++++---------
> 1 file changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass
> index 7a9582393dd..5f691571e53 100644
> --- a/eclass/java-pkg-simple.eclass
> +++ b/eclass/java-pkg-simple.eclass
> @@ -415,15 +415,6 @@ java-pkg-simple_src_compile() {
> fi
>
> # package
> - [[ ! -d ${classes}/META-INF ]] && mkdir ${classes}/META-INF
> - if [[ -v JAVA_AUTOMATIC_MODULE_NAME ]]; then
> - echo "Automatic-Module-Name: ${JAVA_AUTOMATIC_MODULE_NAME}" \
> - >> ${classes}/META-INF/MANIFEST.MF || die "adding module name failed"
> - fi
> - if [[ -v JAVA_MAIN_CLASS ]]; then
> - echo "Main-Class: ${JAVA_MAIN_CLASS}" \
> - >> ${classes}/META-INF/MANIFEST.MF || die "adding main class failed"
> - fi
> local jar_args
> if [[ -e ${classes}/META-INF/MANIFEST.MF ]]; then
> jar_args="cfm ${JAVA_JAR_FILENAME} ${classes}/META-INF/MANIFEST.MF"
> @@ -431,6 +422,18 @@ java-pkg-simple_src_compile() {
> jar_args="cf ${JAVA_JAR_FILENAME}"
> fi
> jar ${jar_args} -C ${classes} . || die "jar failed"
> + if [[ -v JAVA_AUTOMATIC_MODULE_NAME ]]; then
> + echo "Automatic-Module-Name: ${JAVA_AUTOMATIC_MODULE_NAME}" \
> + >> "${T}/add-to-MANIFEST.MF" || die "adding module name failed"
> + fi
> + if [[ -v JAVA_MAIN_CLASS ]]; then
> + echo "Main-Class: ${JAVA_MAIN_CLASS}" \
> + >> "${T}/add-to-MANIFEST.MF" || die "adding main class failed"
> + fi
> + if [[ -e ${T}/add-to-MANIFEST.MF ]]; then
Quote T and use -f
if [[ -f "${T}"/add-to-MANIFEST.MF ]]; then
> + jar ufmv ${JAVA_JAR_FILENAME} "${T}/add-to-MANIFEST.MF" \
> + || die "updating MANIFEST.MF failed"
> + fi
> }
>
> # @FUNCTION: java-pkg-simple_src_install
- Flow
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 21081 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-05 9:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-04 19:19 [gentoo-dev] [PATCH] java-pkg-simple.eclass: improve MANIFEST.MF manipulation Volkmar W. Pogatzki
2022-10-05 9:20 ` Florian Schmaus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox