OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.2 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: bin/sde-parse-md5
  6. # Copyright (C) 2007 The OpenSDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. [ -n "$SDEROOT" ] ||
  16. export SDEROOT=$( cd "${0%/*}/.."; pwd -P )
  17. . $SDEROOT/lib/libsde.in
  18. parse_usage() {
  19. local progname=${0##*/}
  20. cat <<EOT
  21. Usage: $progname [--location <location>] <url>
  22. EOT
  23. }
  24. shortopts='L:'
  25. longopts='location:'
  26. options=$( getopt -o "$shortopts" -l "$longopts" -- "$@" )
  27. if [ $? -ne 0 ]; then
  28. parse_usage
  29. exit -1
  30. fi
  31. # load new arguments list
  32. eval set -- "$options"
  33. forced_location=
  34. while [ $# -gt 0 ]; do
  35. case "$1" in
  36. -L|--location)
  37. forced_location="$2"; shift ;;
  38. --) shift; break ;;
  39. *) echo_abort 1 "Unknown argument '$1', aborting."
  40. esac
  41. shift
  42. done
  43. # process the urls
  44. #
  45. for md5; do
  46. # where are these files?
  47. if [ -n "$forced_location" ]; then
  48. location="$forced_location"
  49. else
  50. location="${md5%/*}"
  51. fi
  52. curl "$md5" | while read md5sum file; do
  53. pkg=$( echo "$file" | sed -e 's,-[0-9].*,,' | tr [A-Z] [a-z] )
  54. if [ -z "$pkg" ]; then
  55. echo_error "Failed to detect package name for '$file'."
  56. continue
  57. fi
  58. case "$pkg" in
  59. exo)
  60. pkg=lib${pkg} ;;
  61. gtk-xfce-engine)
  62. pkg=${pkg}2 ;;
  63. libxml2)
  64. pkg=${pkg%2} ;;
  65. libart_lgpl)
  66. pkg=${pkg}23 ;;
  67. gtk-doc)
  68. pkg=gtkdoc ;;
  69. terminal)
  70. pkg=xfce4-terminal ;;
  71. mono/gtk-sharp)
  72. pkg=gtk-sharp2 ;;
  73. kde-i18n/*|c++/*|java/*|python/*)
  74. pkg=${pkg#*/}
  75. esac
  76. confdir=$( ls -1d $SDEROOT/package/*/$pkg 2> /dev/null || true )
  77. if [ -z "$confdir" -o ! -f "$confdir/$pkg.desc" ]; then
  78. echo_error "Failed to detect package name for '$file' ($pkg)."
  79. continue
  80. fi
  81. ver=$( echo "$file" | sed -n -e 's,.*-\([0-9].*\)\.tar\.bz2,\1,p' )
  82. if [ -z "$ver" ]; then
  83. echo_error "Failed to detect new version for $pkg ($file)."
  84. continue
  85. fi
  86. echo "$pkg $ver $location/$file"
  87. done
  88. done