OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [libjava/] [scripts/] [jar.in] - Diff between revs 762 and 783

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 762 Rev 783
#! @SHELL@
#! @SHELL@
# Copyright (C) 2006  Free Software Foundation
# Copyright (C) 2006  Free Software Foundation
# Written by Paolo Bonzini.
# Written by Paolo Bonzini.
#
#
# This program is free software; you can redistribute it and/or modify
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 2 of the License,
# by the Free Software Foundation; either version 2 of the License,
# or (at your option) any later version.
# or (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful, but
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
# for more details.
#
#
# You should have received a copy of the GNU General Public License along
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
# POSIX and NLS nuisances, taken from autoconf.
# POSIX and NLS nuisances, taken from autoconf.
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  emulate sh
  emulate sh
  NULLCMD=:
  NULLCMD=:
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  # is contrary to our usage.  Disable this feature.
  # is contrary to our usage.  Disable this feature.
  alias -g '${1+"$@"}'='"$@"'
  alias -g '${1+"$@"}'='"$@"'
  setopt NO_GLOB_SUBST
  setopt NO_GLOB_SUBST
else
else
  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
fi
BIN_SH=xpg4; export BIN_SH # for Tru64
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
DUALCASE=1; export DUALCASE # for MKS sh
if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
# Also make sure CDPATH is empty, and IFS is space, tab, \n in that order.
# Also make sure CDPATH is empty, and IFS is space, tab, \n in that order.
# Be careful to avoid that editors munge IFS
# Be careful to avoid that editors munge IFS
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
IFS=" ""        ""
IFS=" ""        ""
"
"
: ${TMPDIR=/tmp}
: ${TMPDIR=/tmp}
: ${ZIP="@ZIP@"}
: ${ZIP="@ZIP@"}
: ${UNZIP="@UNZIP@"}
: ${UNZIP="@UNZIP@"}
progname="$0"
progname="$0"
# Emit a usage message and exit with error status 1
# Emit a usage message and exit with error status 1
usage () {
usage () {
  cat >&2 <
  cat >&2 <
Usage: $0 {ctxu}[vfm0Mi@] [jar-file] [manifest-file] {[-C dir] files} ...
Usage: $0 {ctxu}[vfm0Mi@] [jar-file] [manifest-file] {[-C dir] files} ...
Options:
Options:
    -c  create new archive
    -c  create new archive
    -t  list table of contents for archive
    -t  list table of contents for archive
    -x  extract named (or all) files from archive
    -x  extract named (or all) files from archive
    -u  update existing archive
    -u  update existing archive
    -v  generate verbose output on standard output
    -v  generate verbose output on standard output
    -f  specify archive file name
    -f  specify archive file name
    -m  include manifest information from specified manifest file
    -m  include manifest information from specified manifest file
    -0  store only; use no ZIP compression
    -0  store only; use no ZIP compression
    -M  do not create a manifest file for the entries
    -M  do not create a manifest file for the entries
    -i  generate index information for the specified jar files
    -i  generate index information for the specified jar files
    -@  instead of {[-C dir] files} ... accept one or more response files,
    -@  instead of {[-C dir] files} ... accept one or more response files,
        each containing one command-line argument
        each containing one command-line argument
    -C  change to the specified directory and include the following file
    -C  change to the specified directory and include the following file
If any file is a directory then it is processed recursively.
If any file is a directory then it is processed recursively.
The manifest file name and the archive file name needs to be specified
The manifest file name and the archive file name needs to be specified
in the same order the 'm' and 'f' flags are specified.
in the same order the 'm' and 'f' flags are specified.
Example 1: to archive two class files into an archive called classes.jar:
Example 1: to archive two class files into an archive called classes.jar:
       jar cvf classes.jar Foo.class Bar.class
       jar cvf classes.jar Foo.class Bar.class
Example 2: use an existing manifest file 'mymanifest' and archive all the
Example 2: use an existing manifest file 'mymanifest' and archive all the
           files in the foo/ directory into 'classes.jar':
           files in the foo/ directory into 'classes.jar':
       jar cvfm classes.jar mymanifest -C foo/ .
       jar cvfm classes.jar mymanifest -C foo/ .
EOF
EOF
  (exit 1); exit 1
  (exit 1); exit 1
}
}
# Emit an error message and exit with error status 1
# Emit an error message and exit with error status 1
error () {
error () {
  echo "$progname: $*" >&2
  echo "$progname: $*" >&2
  (exit 1); exit 1
  (exit 1); exit 1
}
}
# Usage: copy SRC DEST
# Usage: copy SRC DEST
# Copy file SRC to directory DEST, which is the staging area of the jar file.
# Copy file SRC to directory DEST, which is the staging area of the jar file.
# Fail if it is already present or if it is not a regular file.
# Fail if it is already present or if it is not a regular file.
copy () {
copy () {
  if test -f "$1"; then
  if test -f "$1"; then
    # A simple optimization.  Optimistically assuming that ln will work
    # A simple optimization.  Optimistically assuming that ln will work
    # cuts 60% of the run-time!
    # cuts 60% of the run-time!
    if ln "$1" "$2"/"$1" > /dev/null 2>&1; then
    if ln "$1" "$2"/"$1" > /dev/null 2>&1; then
      return 0
      return 0
    fi
    fi
    if test -f "$2"/"$1"; then
    if test -f "$2"/"$1"; then
      error "$1": Duplicate entry.
      error "$1": Duplicate entry.
    fi
    fi
    dir=`dirname "$1"`
    dir=`dirname "$1"`
    $mkdir_p "$2"/"$dir"
    $mkdir_p "$2"/"$dir"
    ln "$1" "$2"/"$1" > /dev/null 2>&1 || cp "$1" "$2"/"$1"
    ln "$1" "$2"/"$1" > /dev/null 2>&1 || cp "$1" "$2"/"$1"
  elif test -e "$1"; then
  elif test -e "$1"; then
    error "$1": Invalid file type.
    error "$1": Invalid file type.
  else
  else
    error "$1": File not found.
    error "$1": File not found.
  fi
  fi
}
}
# Make a temporary directory and store its name in the JARTMP variable.
# Make a temporary directory and store its name in the JARTMP variable.
make_tmp () {
make_tmp () {
  test -n "$JARTMP" && return
  test -n "$JARTMP" && return
  {
  {
    JARTMP=`(umask 077 && mktemp -d "$TMPDIR/jarXXXXXX") 2>/dev/null` &&
    JARTMP=`(umask 077 && mktemp -d "$TMPDIR/jarXXXXXX") 2>/dev/null` &&
      test -n "$JARTMP" && test -d "$JARTMP"
      test -n "$JARTMP" && test -d "$JARTMP"
  } || {
  } || {
    JARTMP=$TMPDIR/jar$$-$RANDOM
    JARTMP=$TMPDIR/jar$$-$RANDOM
    (umask 077 && mkdir "$JARTMP")
    (umask 077 && mkdir "$JARTMP")
  } || exit $?
  } || exit $?
  trap 'exit_status=$?
  trap 'exit_status=$?
        if test -n "$JARTMP"; then rm -rf "$JARTMP"; fi
        if test -n "$JARTMP"; then rm -rf "$JARTMP"; fi
        exit $exit_status' 0
        exit $exit_status' 0
}
}
# Usage: make_manifest destfile kind [source-manifest]
# Usage: make_manifest destfile kind [source-manifest]
# Create a manifest file and store it in destfile.  KIND can be "default",
# Create a manifest file and store it in destfile.  KIND can be "default",
# or "user", in which case SOURCE-MANIFEST must be specified as well.
# or "user", in which case SOURCE-MANIFEST must be specified as well.
make_manifest () {
make_manifest () {
  dir=`dirname "$1"`
  dir=`dirname "$1"`
  $mkdir_p "$dir"
  $mkdir_p "$dir"
  case $2 in
  case $2 in
    default)
    default)
      cat > "$1" <<\EOF
      cat > "$1" <<\EOF
Manifest-Version: 1.0
Manifest-Version: 1.0
Created-By: @VERSION@
Created-By: @VERSION@
EOF
EOF
      ;;
      ;;
    user)
    user)
      cp "$3" "$1"
      cp "$3" "$1"
      ;;
      ;;
  esac
  esac
}
}
# Usage: set_var var [value]
# Usage: set_var var [value]
# Exit with an error if set_var was already called for the same VAR.  Else
# Exit with an error if set_var was already called for the same VAR.  Else
# set the variable VAR to the value VALUE (or the empty value if no parameter
# set the variable VAR to the value VALUE (or the empty value if no parameter
# is given).
# is given).
set_var () {
set_var () {
  if eval test x\$set_$1 = xset; then
  if eval test x\$set_$1 = xset; then
    error Incompatible or repeated options.
    error Incompatible or repeated options.
  else
  else
    eval $1=\$2
    eval $1=\$2
    eval set_$1=set
    eval set_$1=set
  fi
  fi
}
}
# Process the arguments, including -C options, and copy the whole tree
# Process the arguments, including -C options, and copy the whole tree
# to $JARTMP/files so that zip can be invoked later from there.
# to $JARTMP/files so that zip can be invoked later from there.
make_files () {
make_files () {
  change=false
  change=false
  if $process_response_files; then
  if $process_response_files; then
    if test $# = 0; then
    if test $# = 0; then
      while read arg; do
      while read arg; do
        make_files_1 "$arg"
        make_files_1 "$arg"
      done
      done
    else
    else
      for infile
      for infile
      do
      do
        exec 5<&0
        exec 5<&0
        exec 0< $infile
        exec 0< $infile
        while read arg; do
        while read arg; do
          make_files_1 "$arg"
          make_files_1 "$arg"
        done
        done
        exec 0<&5
        exec 0<&5
        exec 5<&-
        exec 5<&-
      done
      done
    fi
    fi
  else
  else
    for arg
    for arg
    do
    do
      make_files_1 "$arg"
      make_files_1 "$arg"
    done
    done
  fi
  fi
  cd "$old_dir"
  cd "$old_dir"
}
}
# Usage: make_files_1 ARG
# Usage: make_files_1 ARG
# Process one argument, ARG.
# Process one argument, ARG.
make_files_1 () {
make_files_1 () {
  if $change; then
  if $change; then
    change=false
    change=false
    if cd "$1"; then
    if cd "$1"; then
      return
      return
    else
    else
      (exit 1); exit 1
      (exit 1); exit 1
    fi
    fi
  fi
  fi
  case "$1" in
  case "$1" in
    -C)
    -C)
      change=:
      change=:
      ;;
      ;;
    -C*)
    -C*)
      cd `expr "$1" : '-C\(.*\)' `
      cd `expr "$1" : '-C\(.*\)' `
      return
      return
      ;;
      ;;
    *)
    *)
      if test -d "$1"; then
      if test -d "$1"; then
        $mkdir_p "$JARTMP"/files/"$1"
        $mkdir_p "$JARTMP"/files/"$1"
        find "$1" | while read file; do
        find "$1" | while read file; do
          if test -d "$file"; then
          if test -d "$file"; then
            $mkdir_p "$JARTMP"/files/"$file"
            $mkdir_p "$JARTMP"/files/"$file"
          else
          else
            copy "$file" "$JARTMP"/files
            copy "$file" "$JARTMP"/files
          fi
          fi
        done
        done
      else
      else
        copy "$1" "$JARTMP"/files
        copy "$1" "$JARTMP"/files
      fi
      fi
      ;;
      ;;
  esac
  esac
  cd "$old_dir"
  cd "$old_dir"
}
}
# Same as "jar tf $1".
# Same as "jar tf $1".
jar_list () {
jar_list () {
  $UNZIP -l "$1" | \
  $UNZIP -l "$1" | \
    sed '1,/^ ----/d;/^ ----/,$d;s/^ *[0-9]*  ..-..-.. ..:..   //'
    sed '1,/^ ----/d;/^ ----/,$d;s/^ *[0-9]*  ..-..-.. ..:..   //'
}
}
# Same as "jar tvf $1".
# Same as "jar tvf $1".
jar_list_verbose () {
jar_list_verbose () {
  $UNZIP -l "$1" | \
  $UNZIP -l "$1" | \
    @AWK@ 'BEGIN { yes = 0 }
    @AWK@ 'BEGIN { yes = 0 }
         /^ ----/ { yes = !yes; next }
         /^ ----/ { yes = !yes; next }
         yes {
         yes {
           size=$1
           size=$1
           split ($2, d, "-")
           split ($2, d, "-")
           split ($3, t, ":")
           split ($3, t, ":")
           d[3] += (d[3] < 80) ? 2000 : 1900
           d[3] += (d[3] < 80) ? 2000 : 1900
           timestamp=d[3] " " d[1] " " d[2] " " t[1] " " t[2] " 00"
           timestamp=d[3] " " d[1] " " d[2] " " t[1] " " t[2] " 00"
           gsub (/^ *[0-9]*  ..-..-.. ..:..   /, "")
           gsub (/^ *[0-9]*  ..-..-.. ..:..   /, "")
           printf "%6d %s %s\n", size, strftime ("%a %b %d %H:%M:%S %Z %Y", mktime (timestamp)), $0
           printf "%6d %s %s\n", size, strftime ("%a %b %d %H:%M:%S %Z %Y", mktime (timestamp)), $0
         }'
         }'
}
}
# mkdir -p emulation based on the mkinstalldirs script.
# mkdir -p emulation based on the mkinstalldirs script.
func_mkdir_p () {
func_mkdir_p () {
  for file
  for file
  do
  do
    case $file in
    case $file in
      /*) pathcomp=/ ;;
      /*) pathcomp=/ ;;
      *)  pathcomp= ;;
      *)  pathcomp= ;;
    esac
    esac
    oIFS=$IFS
    oIFS=$IFS
    IFS=/
    IFS=/
    set fnord $file
    set fnord $file
    shift
    shift
    IFS=$oIFS
    IFS=$oIFS
    errstatus=0
    errstatus=0
    for d
    for d
    do
    do
      test "x$d" = x && continue
      test "x$d" = x && continue
      pathcomp=$pathcomp$d
      pathcomp=$pathcomp$d
      case $pathcomp in
      case $pathcomp in
        -*) pathcomp=./$pathcomp ;;
        -*) pathcomp=./$pathcomp ;;
      esac
      esac
      if test ! -d "$pathcomp"; then
      if test ! -d "$pathcomp"; then
        mkdir "$pathcomp" || lasterr=$?
        mkdir "$pathcomp" || lasterr=$?
        test -d "$pathcomp" || errstatus=$lasterr
        test -d "$pathcomp" || errstatus=$lasterr
      fi
      fi
      pathcomp=$pathcomp/
      pathcomp=$pathcomp/
    done
    done
  done
  done
  return "$errstatus"
  return "$errstatus"
}
}
# Detect mkdir -p
# Detect mkdir -p
# On NextStep and OpenStep, the `mkdir' command does not
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option.  It will interpret all options as
# recognize any option.  It will interpret all options as
# directories to create, and then abort because `.' already
# directories to create, and then abort because `.' already
# exists.
# exists.
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
  mkdir_p='mkdir -p'
  mkdir_p='mkdir -p'
else
else
  mkdir_p='func_mkdir_p'
  mkdir_p='func_mkdir_p'
  test -d ./-p && rmdir ./-p
  test -d ./-p && rmdir ./-p
  test -d ./--version && rmdir ./--version
  test -d ./--version && rmdir ./--version
fi
fi
# Process the first command line option.
# Process the first command line option.
case "$1" in
case "$1" in
  -*) commands=`echo X"$1" | sed 's/^X-//' ` ;;
  -*) commands=`echo X"$1" | sed 's/^X-//' ` ;;
  *) commands="$1"
  *) commands="$1"
esac
esac
shift
shift
# Operation to perform on the JAR file
# Operation to perform on the JAR file
mode=unknown
mode=unknown
# First -C option on the command line
# First -C option on the command line
cur_dir=.
cur_dir=.
# Base directory for -C options
# Base directory for -C options
old_dir=`pwd`
old_dir=`pwd`
# JAR file to operate on
# JAR file to operate on
jarfile=
jarfile=
# default for no {m,M} option, user for "m" option, none for "M" option
# default for no {m,M} option, user for "m" option, none for "M" option
manifest_kind=default
manifest_kind=default
# "-0" if the "0" option was given
# "-0" if the "0" option was given
store=
store=
# true if the "v" option was given
# true if the "v" option was given
verbose=false
verbose=false
# true if the non-standard "@" option was given
# true if the non-standard "@" option was given
process_response_files=false
process_response_files=false
# An exec command if we need to redirect the zip/unzip commands' output
# An exec command if we need to redirect the zip/unzip commands' output
out_redirect=:
out_redirect=:
while test -n "$commands"; do
while test -n "$commands"; do
  # Process a letter at a time
  # Process a letter at a time
  command=`expr "$commands" : '\(.\)'`
  command=`expr "$commands" : '\(.\)'`
  commands=`expr "$commands" : '.\(.*\)'`
  commands=`expr "$commands" : '.\(.*\)'`
  case "$command" in
  case "$command" in
    c)
    c)
      set_var mode create
      set_var mode create
      ;;
      ;;
    t)
    t)
      set_var mode list
      set_var mode list
      ;;
      ;;
    x)
    x)
      set_var mode extract
      set_var mode extract
      ;;
      ;;
    u)
    u)
      set_var mode update
      set_var mode update
      ;;
      ;;
    f)
    f)
      test $# = 0 && usage
      test $# = 0 && usage
      # Multiple "f" options are accepted by Sun's JAR tool.
      # Multiple "f" options are accepted by Sun's JAR tool.
      jarfile="$1"
      jarfile="$1"
      test -z "$jarfile" && usage
      test -z "$jarfile" && usage
      shift
      shift
      ;;
      ;;
    m)
    m)
      test $# = 0 && usage
      test $# = 0 && usage
      # Multiple "m" options are accepted by Sun's JAR tool, but
      # Multiple "m" options are accepted by Sun's JAR tool, but
      # M always overrides m.
      # M always overrides m.
      test "$manifest_kind" = default && manifest_kind=user
      test "$manifest_kind" = default && manifest_kind=user
      manifest_file="$1"
      manifest_file="$1"
      test -z "$manifest_file" && usage
      test -z "$manifest_file" && usage
      shift
      shift
      ;;
      ;;
    0)
    0)
      store=-0
      store=-0
      ;;
      ;;
    v)
    v)
      verbose=:
      verbose=:
      ;;
      ;;
    i)
    i)
      # Not yet implemented, and probably never will.
      # Not yet implemented, and probably never will.
      ;;
      ;;
    M)
    M)
      manifest_kind=none
      manifest_kind=none
      ;;
      ;;
    C)
    C)
      test $# = 0 && usage
      test $# = 0 && usage
      cur_dir="$1"
      cur_dir="$1"
      shift
      shift
      ;;
      ;;
    @)
    @)
      process_response_files=: ;;
      process_response_files=: ;;
    *)
    *)
      usage ;;
      usage ;;
  esac
  esac
done
done
set -e
set -e
case "X$jarfile" in
case "X$jarfile" in
  X)
  X)
    # Work on stdin/stdout.  Messages go to stderr, and if we need an input
    # Work on stdin/stdout.  Messages go to stderr, and if we need an input
    # JAR file we save it temporarily in the temporary directory.
    # JAR file we save it temporarily in the temporary directory.
    make_tmp
    make_tmp
    $mkdir_p "$JARTMP"/out
    $mkdir_p "$JARTMP"/out
    jarfile="$JARTMP"/out/tmp-stdin.jar
    jarfile="$JARTMP"/out/tmp-stdin.jar
    out_redirect='exec >&2'
    out_redirect='exec >&2'
    case $mode in
    case $mode in
      update|extract|list)
      update|extract|list)
        if $process_response_files && test $# = 0; then
        if $process_response_files && test $# = 0; then
          error Cannot use stdin for response file.
          error Cannot use stdin for response file.
        fi
        fi
        cat > "$JARTMP"/out/tmp-stdin.jar
        cat > "$JARTMP"/out/tmp-stdin.jar
        ;;
        ;;
    esac
    esac
    ;;
    ;;
  X*/*)
  X*/*)
    # Make an absolute path.
    # Make an absolute path.
    dir=`dirname "$jarfile"`
    dir=`dirname "$jarfile"`
    jarfile=`cd $dir && pwd`/`basename "$jarfile"`
    jarfile=`cd $dir && pwd`/`basename "$jarfile"`
    ;;
    ;;
  X*)
  X*)
    # Make an absolute path from a filename in the current directory.
    # Make an absolute path from a filename in the current directory.
    jarfile=`pwd`/`basename "$jarfile"`
    jarfile=`pwd`/`basename "$jarfile"`
    ;;
    ;;
esac
esac
# Perform a -C option if given right away.
# Perform a -C option if given right away.
cd "$cur_dir"
cd "$cur_dir"
case $mode in
case $mode in
  unknown)
  unknown)
    usage
    usage
    ;;
    ;;
  extract)
  extract)
    make_tmp
    make_tmp
    # Extract the list of files in the JAR file
    # Extract the list of files in the JAR file
    jar_list "$jarfile" > "$JARTMP"/list
    jar_list "$jarfile" > "$JARTMP"/list
    # If there are files on the command line, expand directories and skip -C
    # If there are files on the command line, expand directories and skip -C
    # command line arguments
    # command line arguments
    for arg
    for arg
    do
    do
      if $skip; then
      if $skip; then
        skip=false
        skip=false
        continue
        continue
      fi
      fi
      case "$arg" in
      case "$arg" in
        -C) skip=: ;;
        -C) skip=: ;;
        -C*) ;;
        -C*) ;;
        *)
        *)
          escaped=`echo "X$arg" | sed 's/^X//; s/[].[^$\\*]/\\\\&/g' `
          escaped=`echo "X$arg" | sed 's/^X//; s/[].[^$\\*]/\\\\&/g' `
          grep "^$escaped/" "$JARTMP"/list >> "$JARTMP"/chosen || :
          grep "^$escaped/" "$JARTMP"/list >> "$JARTMP"/chosen || :
          grep "^$escaped\$" "$JARTMP"/list >> "$JARTMP"/chosen || :
          grep "^$escaped\$" "$JARTMP"/list >> "$JARTMP"/chosen || :
      esac
      esac
    done
    done
    test -f "$JARTMP"/chosen || cp "$JARTMP"/list "$JARTMP"/chosen
    test -f "$JARTMP"/chosen || cp "$JARTMP"/list "$JARTMP"/chosen
    # Really execute unzip
    # Really execute unzip
    if $verbose; then
    if $verbose; then
      sort < "$JARTMP"/chosen | uniq | xargs $UNZIP -o "$jarfile" | \
      sort < "$JARTMP"/chosen | uniq | xargs $UNZIP -o "$jarfile" | \
        sed -ne 's/^   creating/  created/p' -e 's/^  inflating/extracted/p'
        sed -ne 's/^   creating/  created/p' -e 's/^  inflating/extracted/p'
    else
    else
      sort < "$JARTMP"/chosen | uniq | xargs $UNZIP -o "$jarfile" > /dev/null
      sort < "$JARTMP"/chosen | uniq | xargs $UNZIP -o "$jarfile" > /dev/null
    fi
    fi
    ;;
    ;;
  create)
  create)
    make_tmp
    make_tmp
    $mkdir_p "$JARTMP"/out
    $mkdir_p "$JARTMP"/out
    $mkdir_p "$JARTMP"/files
    $mkdir_p "$JARTMP"/files
    # Do not overwrite the JAR file if something goes wrong
    # Do not overwrite the JAR file if something goes wrong
    tmp_jarfile="$JARTMP"/out/`basename "$jarfile"`
    tmp_jarfile="$JARTMP"/out/`basename "$jarfile"`
    # Prepare the files in the temporary directory.  This is necessary to
    # Prepare the files in the temporary directory.  This is necessary to
    # support -C and still save relative paths in the JAR file.
    # support -C and still save relative paths in the JAR file.
    make_files ${1+"$@"}
    make_files ${1+"$@"}
    if test $manifest_kind != none; then
    if test $manifest_kind != none; then
      make_manifest "$JARTMP"/files/META-INF/MANIFEST.MF $manifest_kind "$manifest_file"
      make_manifest "$JARTMP"/files/META-INF/MANIFEST.MF $manifest_kind "$manifest_file"
    fi
    fi
    # Really execute zip
    # Really execute zip
    if $verbose; then
    if $verbose; then
      (eval $out_redirect; cd "$JARTMP"/files && $ZIP -rv "$tmp_jarfile" $store .)
      (eval $out_redirect; cd "$JARTMP"/files && $ZIP -rv "$tmp_jarfile" $store .)
    else
    else
      (cd "$JARTMP/files" && $ZIP -r "$tmp_jarfile" $store . > /dev/null)
      (cd "$JARTMP/files" && $ZIP -r "$tmp_jarfile" $store . > /dev/null)
    fi
    fi
    test "$jarfile" = "$tmp_jarfile" || mv "$tmp_jarfile" "$jarfile"
    test "$jarfile" = "$tmp_jarfile" || mv "$tmp_jarfile" "$jarfile"
    ;;
    ;;
  update)
  update)
    make_tmp
    make_tmp
    $mkdir_p "$JARTMP"/files
    $mkdir_p "$JARTMP"/files
    make_files ${1+"$@"}
    make_files ${1+"$@"}
    # Same as above, but zip takes care of not overwriting the file
    # Same as above, but zip takes care of not overwriting the file
    case $manifest_kind in
    case $manifest_kind in
      none)
      none)
        $verbose && (eval $out_redirect; echo removing manifest)
        $verbose && (eval $out_redirect; echo removing manifest)
        $ZIP -d "$jarfile" META-INF/MANIFEST.MF > /dev/null 2>&1 || :
        $ZIP -d "$jarfile" META-INF/MANIFEST.MF > /dev/null 2>&1 || :
        ;;
        ;;
      *)
      *)
        make_manifest "$JARTMP"/files/META-INF/MANIFEST.MF $manifest_kind "$manifest_file"
        make_manifest "$JARTMP"/files/META-INF/MANIFEST.MF $manifest_kind "$manifest_file"
        ;;
        ;;
    esac
    esac
    if $verbose; then
    if $verbose; then
      (eval $out_redirect; cd "$JARTMP"/files && $ZIP -ruv "$jarfile" $store .)
      (eval $out_redirect; cd "$JARTMP"/files && $ZIP -ruv "$jarfile" $store .)
    else
    else
      (cd "$JARTMP"/files && $ZIP -ru "$jarfile" $store . > /dev/null)
      (cd "$JARTMP"/files && $ZIP -ru "$jarfile" $store . > /dev/null)
    fi
    fi
    ;;
    ;;
  list)
  list)
    # Everything's done in the functions
    # Everything's done in the functions
    if $verbose; then
    if $verbose; then
      jar_list_verbose "$jarfile"
      jar_list_verbose "$jarfile"
    else
    else
      jar_list "$jarfile"
      jar_list "$jarfile"
    fi ;;
    fi ;;
esac
esac
if test "$out_redirect" != :; then
if test "$out_redirect" != :; then
  # Cat back to stdout if necessary
  # Cat back to stdout if necessary
  case $mode in
  case $mode in
    create|update) cat "$JARTMP"/out/tmp-stdin.jar ;;
    create|update) cat "$JARTMP"/out/tmp-stdin.jar ;;
  esac
  esac
fi
fi
exit 0
exit 0
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.