parsepkgbuild.sh 1.4 KB

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