public inbox for gentoo-java@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Petteri Räty" <betelgeuse@gentoo.org>
To: gentoo-java@lists.gentoo.org
Subject: Re: [gentoo-java] Making the --jar argument to dolauncher optional
Date: Sat, 21 Oct 2006 13:14:07 +0300	[thread overview]
Message-ID: <4539F2EF.9010208@gentoo.org> (raw)
In-Reply-To: <4539E301.2040407@gentoo.org>


[-- Attachment #1.1: Type: text/plain, Size: 753 bytes --]

Petteri Räty kirjoitti:
> Petteri Räty kirjoitti:
>> When a package only install one jar that has the Main-class attribute
>> set there should not be any need to specify the --jar argument to
>> java-pkg_dolauncher so I made the --jar argument optional.
>>
>> Regards,
>> Petteri
>>
>>
> 
> Just to note that you can't use this yet, as nothing as has been
> committed yet and will need to depend on the new java-config version in
> your ebuild any way. Let's see if I can move all the magic to the eclass
> so we would not need to depend on java-config directly.
> 
> Regards,
> Petteri
> 

Attached is a version that only needs modifications to the eclass. Will
commit this if no-one objects today evening.

Regards,
Petteri

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: java-utils-2.eclass.patch --]
[-- Type: text/x-patch; name="java-utils-2.eclass.patch", Size: 1460 bytes --]

Index: java-utils-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v
retrieving revision 1.24
diff -u -r1.24 java-utils-2.eclass
--- java-utils-2.eclass	27 Sep 2006 21:35:54 -0000	1.24
+++ java-utils-2.eclass	21 Oct 2006 10:12:55 -0000
@@ -550,7 +550,9 @@
 	while [[ -n "${1}" && -n "${2}" ]]; do
 		local var=${1} value=${2}
 		if [[ "${var:0:2}" == "--" ]]; then
-			echo "gjl_${var:2}=\"${value}\"" >> "${var_tmp}"
+			local var=${var:2}
+			echo "gjl_${var}=\"${value}\"" >> "${var_tmp}"
+			local gjl_${var}=${value}
 		elif [[ "${var}" == "-into" ]]; then
 			target_dir="${value}"
 		elif [[ "${var}" == "-pre" ]]; then
@@ -559,6 +561,20 @@
 		shift 2
 	done
 
+	# Test if no --jar and --main arguments were given and
+	# in that case check if the package only installs one jar
+	# and use that jar.
+	if [[ -z "${gjl_jar}" && -z "${gjl_main}" ]]; then
+		local cp="${JAVA_PKG_CLASSPATH}"
+		if [[ "${cp/:}" = "${cp}" && "${cp%.jar}" != "${cp}" ]]; then
+			echo "gjl_jar=\"${JAVA_PKG_CLASSPATH}\"" >> "${var_tmp}"
+		else
+			local msg="Not enough information to create a launcher given."
+			msg="${msg} Please give --jar or --main argument to ${FUNCNAME}."
+			die "${msg}"
+		fi
+	fi
+
 	# Write the actual script
 	echo "#!/bin/bash" > "${target}"
 	[[ -n "${pre}" ]] && [[ -f "${pre}" ]] && cat "${pre}" >> "${target}"

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

      reply	other threads:[~2006-10-21 10:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-21  9:02 [gentoo-java] Making the --jar argument to dolauncher optional Petteri Räty
2006-10-21  9:06 ` Petteri Räty
2006-10-21 10:14   ` Petteri Räty [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4539F2EF.9010208@gentoo.org \
    --to=betelgeuse@gentoo.org \
    --cc=gentoo-java@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox