Browse Source

Moved (finally) `sde pkg up` to `sde up pkg`

karasz/new-early
Alejandro Mery 18 years ago
parent
commit
26ae0362b4
2 changed files with 74 additions and 34 deletions
  1. +1
    -14
      bin/sde-package
  2. +73
    -20
      bin/sde-update-package

+ 1
- 14
bin/sde-package

@ -3,7 +3,7 @@
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: bin/sde-package
# Copyright (C) 2006 - 2007 The OpenSDE Project
# Copyright (C) 2006 - 2008 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
@ -28,17 +28,6 @@ package_usage() {
cat <<EOT
Usage: sde package <action> <arguments> (Alias: pkg)
update [--location <url>] [<package>] [<version>] (Alias: up)
Updates a package (which is autodetected if you are on it) to a
given version, or simply download and regenerate checksums.
Using --location you are able to specify which will be the new
download location for this update.
update [--no-location] --md5 <url> (Alias: up)
Updates a set of packages based on a remote .md5 file
Using --no-location you tell the tool to not assume the download
location of the md5 file for the updates but keep their individual
download locations.
new [<repository>/]<package> <download> [...]
Creates a new package based on a template and the given download
locations.
@ -60,8 +49,6 @@ fi
case "$action" in
help|--help) package_usage ;;
up|update) . $SDEROOT/lib/sde-package/update.in
package_update "$@" ;;
new) . $SDEROOT/lib/sde-package/new.in
package_new "$@" ;;
*) echo_warning "'$COLOR_MESSAGE$action$COLOR_NORMAL' not understood by the" \

lib/sde-package/update.in → bin/sde-update-package

@ -1,8 +1,9 @@
#!/bin/sh
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: lib/sde-package/update.in
# Copyright (C) 2006 - 2007 The OpenSDE Project
# Filename: bin/sde-update-package
# Copyright (C) 2006 - 2008 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
@ -12,6 +13,69 @@
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
#Description: Updates a package to a new upstream version
#Alias: pkg
[ -n "$SDEROOT" ] ||
export SDEROOT=$( cd "${0%/*}/.."; pwd -P )
. "$SDEROOT/lib/libsde.in"
. "$SDEROOT/lib/sde-package.in"
update_usage() {
local progname=${0##*/}
cat <<EOT
Usage: ${progname//-/ } [--location <url>] [<package>] [<version>]
Updates a package (which is autodetected if you are on it) to a
given version, or simply download and regenerate checksums.
Using --location you are able to specify which will be the new
download location for this update.
${progname//-/ } [--no-location] --md5 <url> (Alias: up)
Updates a set of packages based on a remote .md5 file
Using --no-location you tell the tool to not assume the download
location of the md5 file for the updates but keep their individual
download locations.
EOT
}
shortopts=''
longopts='help,location:,no-location,md5:'
options=$( getopt -o "$shortopts" -l "$longopts" -- "$@" )
if [ $? -ne 0 ]; then
update_usage
exit -1
fi
# load new arguments list
eval set -- "$options"
location=
nolocation=
md5file=
while [ $# -gt 0 ]; do
case "$1" in
--help)
update_usage
exit 0 ;;
--location)
location=$2; shift
;;
--no-location)
nolocation=yes
;;
--md5)
md5file=$2; shift
;;
--) shift; break ;;
*) echo_abort 1 "Unknown argument '$1', aborting."
esac
shift
done
package_patch_update() {
local descfile="$1" ver="$2" location="$3"
local oldver= sedopt=
@ -70,26 +134,16 @@ package_update_md5() {
done
}
package_update() {
local pkg= ver=
local nolocation=
local location=
if [ "$1" == "--no-location" ]; then
nolocation=yes; shift
elif [ "$1" == "--location" ]; then
location="$2"; shift 2
fi
if [ "$1" == "--md5" ]; then
package_update_md5 "$2" ${nolocation:+--no-location}
if [ -n "$md5file" ]; then
package_update_md5 "$md5file" ${nolocation:+--no-location}
return $?
elif [ $# -eq 2 ]; then
# package and version
pkg="$( echo "$1" | tr A-Z a-z)"
ver="$2"
elif [ $# -eq 1 ]; then
# package or verion?
# package or version?
pkg="$( echo "$1" | tr A-Z a-z)"
if [ ! -d "$( echo "$SDEROOT/package/"*"/$pkg/" )" ]; then
pkg="$( package_autodetect )"
@ -100,15 +154,14 @@ package_update() {
pkg=$( package_autodetect )
else
echo_error "Invalid Syntax."
package_usage
return 1
update_usage
exit 1
fi
if [ -n "$pkg" ]; then
package_do_update "$pkg" "$ver" "${location}"
else
echo_error "I could't guess which package you want to update."
package_usage
return 2
update_usage
exit 2
fi
}

Loading…
Cancel
Save