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