bitbake-prserv-tool 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env bash
  2. help ()
  3. {
  4. base=`basename $0`
  5. echo -e "Usage: $base command"
  6. echo "Avaliable commands:"
  7. echo -e "\texport <file>: export and lock down the AUTOPR values from the PR service into a file for release."
  8. echo -e "\timport <file>: import the AUTOPR values from the exported file into the PR service."
  9. }
  10. export ()
  11. {
  12. file=$1
  13. [ "x${file}" == "x" ] && help && exit 1
  14. rm -f ${file}
  15. touch dummy.inc
  16. bitbake -R conf/prexport.conf -R dummy.inc -p
  17. s=`bitbake -R conf/prexport.conf -R dummy.inc -e | grep ^PRSERV_DUMPFILE= | cut -f2 -d\"`
  18. rm -f dummy.inc
  19. if [ "x${s}" != "x" ];
  20. then
  21. [ -e $s ] && mv -f $s $file && echo "Exporting to file $file succeeded!"
  22. return 0
  23. fi
  24. echo "Exporting to file $file failed!"
  25. return 1
  26. }
  27. import ()
  28. {
  29. file=$1
  30. [ "x${file}" == "x" ] && help && exit 1
  31. touch dummy.inc
  32. bitbake -R conf/primport.conf -R dummy.inc -R $file -p
  33. ret=$?
  34. rm -f dummy.inc
  35. [ $ret -eq 0 ] && echo "Importing from file $file succeeded!" || echo "Importing from file $file failed!"
  36. return $ret
  37. }
  38. [ $# -eq 0 ] && help && exit 1
  39. case $1 in
  40. export)
  41. export $2
  42. ;;
  43. import)
  44. import $2
  45. ;;
  46. *)
  47. help
  48. exit 1
  49. ;;
  50. esac