mirror of the now-defunct rocklinux.org
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.

75 lines
2.2 KiB

  1. #!/bin/bash
  2. #
  3. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  4. #
  5. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  6. # Please add additional copyright information _after_ the line containing
  7. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  8. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  9. #
  10. # ROCK Linux: rock-src/scripts/Create-PkgUpdPatch
  11. # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
  12. #
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version. A copy of the GNU General Public
  17. # License can be found at Documentation/COPYING.
  18. #
  19. # Many people helped and are helping developing ROCK Linux. Please
  20. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  21. # file for details.
  22. #
  23. # --- ROCK-COPYRIGHT-NOTE-END ---
  24. if [ "$1" != "${1#-}" ] ; then
  25. cat << EOT >&2
  26. $0:
  27. Automatically create package-update patches.
  28. Input format (e.g.): automake-1.5, bind-9.2.0rc3, binutils-2.11.90.0.31,
  29. gettext-0.10.40, gnome-applets-1.4.0.4
  30. Output format: unified diff for the .desc files
  31. Type ./scripts/Help Create-PkgUpdPatch for details."
  32. EOT
  33. exit 1
  34. fi
  35. if [ "$*" ] ; then
  36. echo "$*" | exec $0
  37. exit $?
  38. fi
  39. tr ', \t' '\n\n\n' |
  40. tr -s '\n' |
  41. while read x ; do
  42. pkg="" ; pkgdir=""
  43. [ -z "$x" ] && continue
  44. echo "[ $x ]" >&2
  45. for y in package/*/* ; do
  46. z=${y##*/}
  47. if [[ "$x" == "$z"[-_]* ]] ; then
  48. pkg="$z" ; pkgdir="$y"
  49. fi
  50. done
  51. if [ "$pkg" ] ; then
  52. oldver="`egrep "^\[(V|VER|VERSION)\] " $pkgdir/$pkg.desc |
  53. tr '\t' ' ' | tr -s ' ' | cut -f2 -d' '`"
  54. newver=${x/$pkg?/} ; tmpfile=`mktemp` ; tmpfile2=`mktemp`
  55. echo "Upgrade Patch for $pkg ($pkgdir): $oldver -> $newver"
  56. sed "s/${oldver//./\\.}/$newver/g" < $pkgdir/$pkg.desc | \
  57. sed "s/^\[\(D\|DOWN\|DOWNLOAD\)\] [0-9]\+/[\1] 0/" > $tmpfile
  58. diff -u ./$pkgdir/$pkg.desc $tmpfile | tee $tmpfile2
  59. [ -s $tmpfile2 ] || echo "Patch for '$x' is empty!" >&2
  60. rm -f $tmpfile $tmpfile2
  61. else
  62. echo "Can't find package for '$x'!" >&2
  63. echo "Can't find package for '$x'!"
  64. fi
  65. echo
  66. done