Debian.zsh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # Debian stuff
  2. # specific aliases
  3. alias lintian="lintian --color=auto -IEm"
  4. # building environements
  5. cow-dist () {
  6. [ $# -lt 2 ] \
  7. && echo "Error args." \
  8. && return
  9. dist=$1
  10. shift
  11. command=$1
  12. shift
  13. cowbuilder $command --configfile ~/.cowbuilder/$dist $@
  14. return $?
  15. }
  16. alias cow-stable="cow-dist stable"
  17. alias cow-sid="cow-dist sid"
  18. # tools
  19. apt-rbdepends () {
  20. grep-dctrl -F Build-Depends "$1" -s Package /var/lib/apt/lists/*_Sources
  21. }
  22. pdebdiff() {
  23. if [ ! -r debian/changelog ]; then
  24. echo "ERR: can't read debian/changelog"
  25. exit
  26. fi
  27. egrep -v "^([[:space:]]+|$)" debian/changelog | \
  28. sed 's/[^ ]* (\([^)]*\)).*/\1/' | \
  29. head -n2|tr '\n' $IFS | \
  30. read v1 v2
  31. if [ -z "$v1" -o -z "$v2" ]; then
  32. echo "ERR: can't find version \$n and \$n-1 of the package";
  33. exit
  34. fi
  35. if [ ! -r debian/control ]; then
  36. echo "ERR: can't read debian/control"
  37. exit
  38. fi
  39. egrep '^(Package|Architecture): ' debian/control | \
  40. while read line ; do
  41. pkg=$(echo $line|sed 's/Package: //')
  42. read line
  43. arch=$(echo $line|sed 's/Architecture: //')
  44. if [ $arch = 'any' ]; then
  45. arch=$(dpkg-architecture -qDEB_HOST_ARCH)
  46. fi
  47. (
  48. echo "*** DIFF ${pkg}_${v2} -> ${pkg}_${v1} ***"
  49. echo
  50. debdiff ../${pkg}_${v2}_${arch}.deb ../${pkg}_${v1}_${arch}.deb
  51. )|$PAGER
  52. done
  53. }
  54. pdeblint() {
  55. if [ ! -r debian/changelog ]; then
  56. echo "ERR: can't read debian/changelog"
  57. exit
  58. fi
  59. v=$(egrep -v "^([[:space:]]+|$)" debian/changelog | \
  60. sed 's/[^ ]* (\([^)]*\)).*/\1/' | \
  61. head -n1)
  62. if [ ! -r debian/control ]; then
  63. echo "ERR: can't read debian/control"
  64. exit
  65. fi
  66. pkg=$(grep '^Source: ' debian/control | sed 's/Source: //')
  67. arch=$(dpkg-architecture -qDEB_HOST_ARCH)
  68. changes="../${pkg}_${v}_${arch}.changes"
  69. if [ ! -r "$changes" ]; then
  70. echo "ERR: can't read changes file : ${changes}"
  71. exit
  72. fi
  73. lintian --color=auto -IEm --pedantic $changes $@
  74. }