1
0
javapackages-tools/javapackages-2.0.1-fix-bashisms.patch
2014-10-16 12:49:05 +00:00

390 lines
11 KiB
Diff

diff -Ndur javapackages-2.0.1/bin/check-binary-files javapackages-2.0.1-fix-bashisms/bin/check-binary-files
--- javapackages-2.0.1/bin/check-binary-files 2013-07-26 10:25:31.000000000 +0300
+++ javapackages-2.0.1-fix-bashisms/bin/check-binary-files 2014-10-13 02:46:47.702606713 +0300
@@ -108,8 +108,7 @@
while read line; do
- echo $line | grep ^% >& /dev/null
- if [ $? -eq 0 ] || [ "$line" = "" ]; then
+ if [ -z "$line" -o "${line#%}" != "$line" ]; then
continue
fi
@@ -145,7 +144,7 @@
if [ ! -z $_ARCHIVE_FILE ]; then
rm -rf $_ARCHIVE_EXTRACTION_DIR
mkdir -p $_ARCHIVE_EXTRACTION_DIR
- pushd $_ARCHIVE_EXTRACTION_DIR >& /dev/null
+ cd $_ARCHIVE_EXTRACTION_DIR
tar xf $_WORKING_DIR/`basename $_ARCHIVE_FILE`
fi
@@ -159,18 +158,18 @@
_compression_flag=""
- echo $_ARCHIVE_FILE | grep gz$ >& /dev/null
+ echo $_ARCHIVE_FILE | grep -q gz$
if [ $? -eq 0 ]; then
_compression_flag=z
fi
- echo $_ARCHIVE_FILE | grep bz2$ >& /dev/null
+ echo $_ARCHIVE_FILE | grep -q bz2$
if [ $? -eq 0 ]; then
_compression_flag=f
fi
tar cf$_compression_flag $_WORKING_DIR/$_arch_name-clean.$_arch_ext *
- popd >& /dev/null
+ cd - > /dev/null
rm -rf $_ARCHIVE_EXTRACTION_DIR
fi
diff -Ndur javapackages-2.0.1/bin/clean-binary-files javapackages-2.0.1-fix-bashisms/bin/clean-binary-files
--- javapackages-2.0.1/bin/clean-binary-files 2013-07-26 10:25:31.000000000 +0300
+++ javapackages-2.0.1-fix-bashisms/bin/clean-binary-files 2014-10-13 02:46:32.588605896 +0300
@@ -104,7 +104,7 @@
_old_ifs=$IFS
IFS='|'
- echo $1 | grep -E "\\.jar$" >& /dev/null
+ echo $1 | grep -q -E "\\.jar$"
if [ $? -eq 0 ]; then
# Check if the item is in the exclusion list
@@ -162,7 +162,7 @@
IFS='|'
for filename in $_KEEP_LIST; do
- grep ^$filename $_ON_DISK_FILELIST >& /dev/null
+ grep -q ^$filename $_ON_DISK_FILELIST
if [ $? -gt 0 ]; then
echo "Cannot find file $filename from exclusions list. Aborting."
@@ -174,7 +174,7 @@
done
for filename in $_REMOVE_LIST; do
- grep ^$filename $_ON_DISK_FILELIST >& /dev/null
+ grep -q ^$filename $_ON_DISK_FILELIST
if [ $? -gt 0 ]; then
echo "Cannot find file $filename from exclusions list. Aborting."
@@ -257,7 +257,7 @@
return 0;
fi
- echo $1 | grep -E "\\.jar$" >& /dev/null
+ echo $1 | grep -q -E "\\.jar$"
if [ ! $? -eq 0 ]; then
return 0
fi
@@ -342,8 +342,7 @@
while read line; do
- echo $line | grep ^% >& /dev/null
- if [ $? -eq 0 ] || [ "$line" = "" ]; then
+ if [ -z "$line" -o "${line#%}" != "$line" ]; then
continue
fi
@@ -386,7 +385,7 @@
;;
-f) # Instruction file (DELETE MODE)
- if [ $2 == "-" ]; then
+ if [ "$2" = "-" ]; then
while read command; do
@@ -407,8 +406,7 @@
while read line; do
- echo $line | grep ^% >& /dev/null
- if [ $? -eq 0 ] || [ "$line" = "" ]; then
+ if [ -z "$line" -o "${line#%}" != "$line" ]; then
continue
fi
@@ -484,7 +482,7 @@
if [ ! -z $_ARCHIVE_FILE ]; then
rm -rf $_ARCHIVE_EXTRACTION_DIR
mkdir -p $_ARCHIVE_EXTRACTION_DIR
- pushd $_ARCHIVE_EXTRACTION_DIR >& /dev/null
+ cd $_ARCHIVE_EXTRACTION_DIR
tar xf $_WORKING_DIR/`basename $_ARCHIVE_FILE`
fi
@@ -576,19 +574,19 @@
_compression_flag=""
- echo $_ARCHIVE_FILE | grep gz$ >& /dev/null
+ echo $_ARCHIVE_FILE | grep -q gz$
if [ $? -eq 0 ]; then
_compression_flag=z
fi
- echo $_ARCHIVE_FILE | grep bz2$ >& /dev/null
+ echo $_ARCHIVE_FILE | grep -q bz2$
if [ $? -eq 0 ]; then
_compression_flag=f
fi
tar cf$_compression_flag $_WORKING_DIR/$_arch_name-clean.$_arch_ext *
- popd >& /dev/null
+ cd - > /dev/null
rm -rf $_ARCHIVE_EXTRACTION_DIR
fi
diff -Ndur javapackages-2.0.1/bin/create-jar-links javapackages-2.0.1-fix-bashisms/bin/create-jar-links
--- javapackages-2.0.1/bin/create-jar-links 2013-07-26 10:25:31.000000000 +0300
+++ javapackages-2.0.1-fix-bashisms/bin/create-jar-links 2014-10-13 02:45:39.860603045 +0300
@@ -57,7 +57,7 @@
for file in $_REMOVE_LIST; do
- echo $file | grep -E "\\.jar$" >& /dev/null
+ echo $file | grep -q -E "\\.jar$"
if [ ! $? -eq 0 ]; then
continue
fi
@@ -125,8 +125,7 @@
while read line; do
- echo $line | grep ^% >& /dev/null
- if [ $? -eq 0 ] || [ "$line" = "" ]; then
+ if [ -z "$line" -o "${line#%}" != "$line" ]; then
continue
fi
@@ -176,7 +175,7 @@
if [ ! -z $_ARCHIVE_FILE ]; then
rm -rf $_ARCHIVE_EXTRACTION_DIR
mkdir -p $_ARCHIVE_EXTRACTION_DIR
- pushd $_ARCHIVE_EXTRACTION_DIR >& /dev/null
+ cd $_ARCHIVE_EXTRACTION_DIR
tar xf $_WORKING_DIR/`basename $_ARCHIVE_FILE`
fi
@@ -190,18 +189,18 @@
_compression_flag=""
- echo $_ARCHIVE_FILE | grep gz$ >& /dev/null
+ echo $_ARCHIVE_FILE | grep -q gz$
if [ $? -eq 0 ]; then
_compression_flag=z
fi
- echo $_ARCHIVE_FILE | grep bz2$ >& /dev/null
+ echo $_ARCHIVE_FILE | grep -q bz2$
if [ $? -eq 0 ]; then
_compression_flag=f
fi
tar cf$_compression_flag $_WORKING_DIR/$_arch_name-clean.$_arch_ext *
- popd >& /dev/null
+ cd - > /dev/null
rm -rf $_ARCHIVE_EXTRACTION_DIR
fi
diff -Ndur javapackages-2.0.1/bin/find-jar javapackages-2.0.1-fix-bashisms/bin/find-jar
--- javapackages-2.0.1/bin/find-jar 2013-07-26 10:25:31.000000000 +0300
+++ javapackages-2.0.1-fix-bashisms/bin/find-jar 2014-10-13 00:58:10.702254350 +0300
@@ -30,7 +30,7 @@
find_jar $1
if [ $? != 0 ]; then
- echo $"Could not find the requested jar or jar directory." >&2
- echo $"Please check the correct JAVA_HOME is set." >&2
+ echo "Could not find the requested jar or jar directory." >&2
+ echo "Please check the correct JAVA_HOME is set." >&2
exit 6
fi
diff -Ndur javapackages-2.0.1/bin/mvn-alias javapackages-2.0.1-fix-bashisms/bin/mvn-alias
--- javapackages-2.0.1/bin/mvn-alias 2013-07-26 10:25:31.000000000 +0300
+++ javapackages-2.0.1-fix-bashisms/bin/mvn-alias 2014-10-13 02:20:45.576522251 +0300
@@ -35,25 +35,29 @@
exit 1
fi
-IFS=: read -a pattern <<<"$1"
+pattern="$1"
shift
aliases=
while [ $# -gt 0 ]; do
+ g="${1%%:*}"
+ a="${1#*:}"
+ a="${a%%:*}"
+
IFS=: read -a alias <<<"$1"
shift
aliases="$aliases
<alias>
- <groupId>${alias[0]}</groupId>
- <artifactId>${alias[1]}</artifactId>
- <version>${alias[2]}</version>
+ <groupId>$(echo "$1" | cut -d: -f1)</groupId>
+ <artifactId>$(echo "$1" | cut -d: -f2)</artifactId>
+ <version>$(echo "$1" | cut -d: -f3)</version>
</alias>"
done
xml="<artifactGlob>
- <groupId>${pattern[0]}</groupId>
- <artifactId>${pattern[1]}</artifactId>
- <version>${pattern[2]}</version>
+ <groupId>$(echo "$pattern" | cut -d: -f1)</groupId>
+ <artifactId>$(echo "$pattern" | cut -d: -f2)</artifactId>
+ <version>$(echo "$pattern" | cut -d: -f3)</version>
</artifactGlob>
<aliases>$aliases
</aliases>"
diff -Ndur javapackages-2.0.1/bin/mvn-config javapackages-2.0.1-fix-bashisms/bin/mvn-config
--- javapackages-2.0.1/bin/mvn-config 2013-07-26 10:25:31.000000000 +0300
+++ javapackages-2.0.1-fix-bashisms/bin/mvn-config 2014-10-13 01:04:24.235274546 +0300
@@ -37,7 +37,7 @@
open=
close=
-for node in $(sed "s|/| |g" <<<"${1}"); do
+for node in $(echo "$1" | sed "s|/| |g"); do
open="${open}<${node}>"
close="</${node}>${close}"
done
diff -Ndur javapackages-2.0.1/bin/mvn-file javapackages-2.0.1-fix-bashisms/bin/mvn-file
--- javapackages-2.0.1/bin/mvn-file 2013-07-26 10:25:31.000000000 +0300
+++ javapackages-2.0.1-fix-bashisms/bin/mvn-file 2014-10-13 02:22:28.238527802 +0300
@@ -35,20 +35,17 @@
exit 1
fi
-IFS=: read -a pattern <<<"$1"
-shift
-
files=
while [ $# -gt 0 ]; do
files="$files
- <file>$1</file>"
+ <file>$2</file>"
shift
done
xml="<artifactGlob>
- <groupId>${pattern[0]}</groupId>
- <artifactId>${pattern[1]}</artifactId>
- <version>${pattern[2]}</version>
+ <groupId>$(echo "$1" | cut -d: -f1)</groupId>
+ <artifactId>$(echo "$1" | cut -d: -f2)</artifactId>
+ <version>$(echo "$1" | cut -d: -f3)</version>
</artifactGlob>
<files>$files
</files>"
diff -Ndur javapackages-2.0.1/bin/mvn-local javapackages-2.0.1-fix-bashisms/bin/mvn-local
--- javapackages-2.0.1/bin/mvn-local 2013-07-26 10:25:31.000000000 +0300
+++ javapackages-2.0.1-fix-bashisms/bin/mvn-local 2014-10-13 02:32:44.546561125 +0300
@@ -39,9 +39,12 @@
# resolution from effective POM repository.
XMVN_COMPAT=19-rpmbuild
for arg in "$@"; do
- if egrep -q '^-Dmaven\.local\.effective\.pom=false' <<<"$arg"; then
+ case "$arg" in
+ '-Dmaven.local.effective.pom=false'*)
XMVN_COMPAT=19-rpmbuild-raw
- fi
+ break
+ ;;
+ esac
done
export XMVN_COMPAT
diff -Ndur javapackages-2.0.1/bin/mvn-package javapackages-2.0.1-fix-bashisms/bin/mvn-package
--- javapackages-2.0.1/bin/mvn-package 2013-07-26 10:25:31.000000000 +0300
+++ javapackages-2.0.1-fix-bashisms/bin/mvn-package 2014-10-13 02:23:15.401530352 +0300
@@ -35,12 +35,10 @@
exit 1
fi
-IFS=: read -a pattern <<<"$1"
-
xml="<artifactGlob>
- <groupId>${pattern[0]}</groupId>
- <artifactId>${pattern[1]}</artifactId>
- <version>${pattern[2]}</version>
+ <groupId>$(echo "$1" | cut -d: -f1)</groupId>
+ <artifactId>$(echo "$1" | cut -d: -f2)</artifactId>
+ <version>$(echo "$1" | cut -d: -f3)</version>
</artifactGlob>
<targetPackage>$2</targetPackage>"
diff -Ndur javapackages-2.0.1/bin/mvn-rpmbuild javapackages-2.0.1-fix-bashisms/bin/mvn-rpmbuild
--- javapackages-2.0.1/bin/mvn-rpmbuild 2013-07-26 10:25:31.000000000 +0300
+++ javapackages-2.0.1-fix-bashisms/bin/mvn-rpmbuild 2014-10-13 02:35:13.131569158 +0300
@@ -38,24 +38,28 @@
# Support local depmaps
depmap=
for arg in "$@"; do
- if egrep -q '^-Dmaven\.local\.depmap\.file=' <<<"$arg"; then
- depmap=$(sed 's/[^=]*=//' <<<"$arg")
+ case "$arg" in
+ '-Dmaven.local.depmap.file='*)
+ depmap=$(echo "$arg" | sed 's/[^=]*=//')
depmap="
<!-- Use local depmap file. -->
<metadataRepositories>
<repository>$depmap</repository>
</metadataRepositories>"
- fi
+ ;;
+ esac
done
# Local repository
repo=".m2"
repo_arg="-Dmaven.repo.local=$PWD/.m2/"
for arg in "$@"; do
- if egrep -q '^-Dmaven\.repo\.local=' <<<"$arg"; then
+ case "$arg" in
+ '-Dmaven.repo.local='*)
repo_arg=
- repo=$(sed 's/[^=]*=//' <<<"$arg")
- fi
+ repo=$(echo "$arg" | sed 's/[^=]*=//')
+ ;;
+ esac
done
export MAVEN_OPTS="$MAVEN_OPTS $repo_arg"
@@ -77,9 +81,12 @@
# resolution from effective POM repository.
XMVN_COMPAT=19-rpmbuild
for arg in "$@"; do
- if egrep -q '^-Dmaven\.local\.effective\.pom=false' <<<"$arg"; then
+ case "$arg" in
+ '-Dmaven.local.effective.pom=false'*)
XMVN_COMPAT=19-rpmbuild-raw
- fi
+ break
+ ;;
+ esac
done
export XMVN_COMPAT
@@ -88,7 +95,7 @@
# used without giving groupId prefix.
for groupId in org/apache/maven/plugins org/codehaus/mojo; do
mkdir -p "$repo"/${groupId}
- ln -sf /etc/maven/metadata-${groupId////-}.xml \
+ ln -sf /etc/maven/metadata-$(echo "$groupId" | tr / -).xml \
"$repo"/${groupId}/maven-metadata-central.xml
done