public inbox for gentoo-java@lists.gentoo.org
 help / color / mirror / Atom feed
From: Caster <cast3r@seznam.cz>
To: gentoo-java@lists.gentoo.org
Subject: Re: [gentoo-java] Falling to the lowest jdk available
Date: Fri, 28 Jul 2006 13:59:37 +0200	[thread overview]
Message-ID: <44C9FC29.70606@seznam.cz> (raw)
In-Reply-To: <44C9EE76.9030101@seznam.cz>

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

Caster wrote:
> and for aspectwerkz, maybe the fixer script should check if the "broken"
> jar belongs to package that actually is supposed to be (requires) 1.5...
> 

Tried to alter the fixer script to do that, by checking the package.env
for GENERATION="2" and TARGET="1.5" or "1.6" and skip such packages as
they are valid to have 1.5+ bytecode. Patch attached.

Caster

[-- Attachment #2: java-1.5-fixer.patch --]
[-- Type: text/x-patch, Size: 2181 bytes --]

--- java-1.5-fixer	2006-07-18 12:43:03.000000000 +0200
+++ java-1.5-fixer	2006-07-28 13:55:15.000000000 +0200
@@ -60,29 +60,68 @@
 	fi
 }
 
+# $1 - package.env file
+# $2 - name of VAR=foo variable
+get_value_from_package_env() {
+	# get the VAR line from package.env
+	local line="$(grep ${2} ${1})"
+	
+	# strip VAR=
+	local value="${line#${2}=}"
+	
+	# strip quotes
+	value="${value//\"/}"
+	
+	echo ${value}
+}
+
 get_jars_from_package_env() {
 	local package_env=${1}
 
 	# keep track of the original classpath
 	local save_classpath=${CLASSPATH}
 
-	local classpath_line=$(grep CLASSPATH ${package_env})
-	# strip CLASSPATH=
-	local package_classpath=${classpath_line#CLASSPATH=}
-	# strip quotes
-	package_classpath=${package_classpath//\"/}
-	#local package_classpath=$(source ${package_env} >/dev/null 2>&1; echo ${CLASSPATH})
+	# get classpath from package.env
+	package_classpath=$(get_value_from_package_env ${package_env} CLASSPATH)
 
 	echo ${package_classpath//:/ }
 }
 
+check_package_env_valid_gen2_target_15() {
+	local generation=$(get_value_from_package_env ${1} GENERATION)
+	
+	debug_print "${1} generation: ${generation}"
+	
+	# packages with generation 1 or without generation won't have TARGET and shouldn't be 1.5
+	if [[ "${generation}" != "2" ]]; then
+	    return 1
+	fi
+	
+	local target=$(get_value_from_package_env ${1} TARGET)
+	
+	debug_print "${1} target: $target"
+	
+	# packages with target 1.5 or 1.6 are valid to have 1.5+ bytecode, skip them
+	if [[ "${target}" = "1.5" || "${target}" = "1.6" ]]; then
+	    return 0
+	fi
+	
+	# bytecode should be under 1.5, check it
+	return 1
+}
+
 get_jars() {
 	local package_envs=$@
 	local package_env
 	local all_jars
 	# for each package.env file
 	for package_env in ${package_envs}; do
-        if [[ -f ${package_env} ]]; then
+	if [[ -f ${package_env} ]]; then
+		#check if package is valid gen2 with 1.5+ target
+		if $(check_package_env_valid_gen2_target_15 ${package_env}); then
+		    debug_print "skipping ${package_env}"
+		    continue
+		fi
     		debug_print "parsing ${package_env}"
     		# figure out what jars are in it
     		local jars=$(get_jars_from_package_env ${package_env})

  parent reply	other threads:[~2006-07-28 12:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-28  9:09 [gentoo-java] Falling to the lowest jdk available Miroslav Šulc
2006-07-28  9:24 ` Krzysiek Pawlik
2006-07-28 10:33   ` Miroslav Šulc
2006-07-28 10:43     ` Krzysiek Pawlik
2006-07-28 11:01       ` Caster
2006-07-28 11:12         ` Krzysiek Pawlik
2006-07-28 11:59         ` Caster [this message]
2006-07-28 12:27           ` Miroslav Šulc
2006-07-28 14:06             ` Caster
2006-07-28 14:50               ` Miroslav Šulc
2006-07-28 16:02               ` Krzysiek Pawlik
2006-07-28 10:44     ` Caster
2006-07-28  9:31 ` Caster
2006-07-28 10:40   ` Miroslav Šulc
2006-07-28 10:54     ` Wiktor Wandachowicz
2006-07-28 11:26       ` Miroslav Šulc

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=44C9FC29.70606@seznam.cz \
    --to=cast3r@seznam.cz \
    --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