parsepkgbuild.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/bash
  2. if [ "x$1" = "x" ]; then
  3. exit
  4. fi
  5. /usr/bin/makepkg --nobuild --noextract --nodeps &> /dev/null;
  6. export PATH=''
  7. exec /bin/bash --noprofile --norc -r << EOF
  8. source $1
  9. print_var()
  10. {
  11. if [ ! "x\$2" = "x" ]; then
  12. echo -e "\$1 = '\${2//\'/\\\\\'}'"
  13. else
  14. echo "\$1 = None"
  15. fi
  16. }
  17. print_int()
  18. {
  19. if [ ! "x\$2" = "x" ]; then
  20. echo -e "\$1 = \$2"
  21. else
  22. echo "\$1 = None"
  23. fi
  24. }
  25. print_array()
  26. {
  27. key=\$1; shift
  28. if [ ! "x\$1" = "x" ]; then
  29. array=( "\$@" )
  30. echo -n "\$key = ["
  31. for i in \${array[@]}; do echo -n "'\$i',"; done
  32. echo "]"
  33. else
  34. echo "\$key = []"
  35. fi
  36. }
  37. print_var name "\$pkgname"
  38. print_var version "\$pkgver"
  39. print_int release "\$pkgrel"
  40. print_var description "\$pkgdesc"
  41. print_var url "\$url"
  42. print_array licenses "\${license[@]}"
  43. print_array groups "\${groups[@]}"
  44. print_array arch "\${arch[@]}"
  45. print_array depends "\${depends[@]}"
  46. print_array makedepends "\${makedepends[@]}"
  47. print_array provides "\${provides[@]}"
  48. print_array conflicts "\${conflicts[@]}"
  49. print_array replaces "\${replaces[@]}"
  50. print_array install "\${install[@]}"
  51. print_array source "\${source[@]}"
  52. print_array md5sums "\${md5sums[@]}"
  53. print_array sha1sums "\${sha1sums[@]}"
  54. print_array sha256sums "\${sha256sums[@]}"
  55. print_array sha384sums "\${sha384sums[@]}"
  56. print_array sha512sums "\${sha512sums[@]}"
  57. EOF