Browse Source

* improved `sde pkg up` to support "--location <url>" to be used

as the download location of the given update.
	* improved `sde pkg up --md5` to support "--no-location" so the
	  download locations are not overwritten by the url of the given
	  MD5 file


git-svn-id: svn://svn.opensde.net/opensde/opensde/trunk@20693 10447126-35f2-4685-b0cf-6dd780d3921f
misl/sde-wrapper
Alejandro Mery 19 years ago
parent
commit
31826b5b43
2 changed files with 32 additions and 6 deletions
  1. +7
    -2
      lib/sde-package.in
  2. +25
    -4
      lib/sde-package/update.in

+ 7
- 2
lib/sde-package.in

@ -18,11 +18,16 @@
package_usage() {
cat <<EOT
Usage: sde package <action> <arguments> (Alias: pkg)
update [<package>] [<version>] (Alias: up)
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.
update --md5 <url> (Alias: up)
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

+ 25
- 4
lib/sde-package/update.in

@ -41,7 +41,7 @@ package_do_update() {
elif [ -z "$ver" ]; then
echo_info "Updating checksum for $pkg."
else
package_patch_update "$descfile" "$ver" "${location:+${location%/*}/}"
package_patch_update "$descfile" "$ver" "$location"
fi
cd "$SDEROOT"
@ -50,7 +50,15 @@ package_do_update() {
package_update_md5() {
local md5="$1" baseurl=
local nolocation= location=
shift
echo_info "Loading MD5 file from '$md5'"
if [ "$1" == "--no-location" ]; then
nolocation=yes; shift
echo_info "(Using individual download locations)"
fi
baseurl="${md5%/*}"
curl "$md5" | while read md5sum file; do
pkg=$( echo "$file" | sed -e 's,-[0-9].*,,' | tr [A-Z] [a-z] )
@ -79,15 +87,28 @@ package_update_md5() {
continue
fi
package_do_update "$pkg" "$ver" "$baseurl/$file"
if [ -z "$nolocation" ]; then
location="$baseurl/$file";
package_do_update "$pkg" "$ver" "${location%/*}/"
else
package_do_update "$pkg" "$ver"
fi
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"
package_update_md5 "$2" ${nolocation:+--no-location}
return $?
elif [ $# -eq 2 ]; then
# package and version
@ -111,7 +132,7 @@ package_update() {
fi
if [ -n "$pkg" ]; then
package_do_update "$pkg" "$ver"
package_do_update "$pkg" "$ver" "${location}"
else
echo_error "I could't guess which package you want to update."
package_usage

Loading…
Cancel
Save