summaryrefslogtreecommitdiffstats
path: root/classes/rmc-db.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'classes/rmc-db.bbclass')
-rw-r--r--classes/rmc-db.bbclass92
1 files changed, 0 insertions, 92 deletions
diff --git a/classes/rmc-db.bbclass b/classes/rmc-db.bbclass
deleted file mode 100644
index 72594d69..00000000
--- a/classes/rmc-db.bbclass
+++ /dev/null
@@ -1,92 +0,0 @@
1# RMC database bbclass
2# provide functions to generate RMC database file on build host (native)
3
4DEPENDS += "rmc-native"
5
6# rmc_generate_db()
7# $1: a list of directories. Each directory holds directories for a group of
8# boards.
9# $2: path_name of rmc generates database file and records
10#
11# WARNING: content of directory of database file will be removed.
12#
13# Each board directory shall contain a fingerprint file (*.fp) at least, with
14# optional file blob(s) associated to the type of board. If a board directory
15# has no file blob, no record is created for that board.
16#
17# An example of two directories each of which contains two boards for RMC:
18# (All file and directory names are for illustration purpose.)
19#
20# dir_1/
21# board_1/
22# board_1_fingerprint.fp
23# file_1.blob
24# board_2/
25# board_2.fp
26# dir_2/
27# board_3/
28# b3.fp
29# file_1.blob
30# file_2.conf
31# board_4/
32# board_foo.fp
33# mylib.config
34#
35# To generate a RMC database "rmc.db" with data of all (actually 3) of boards in
36# a directory "deploy_dir":
37#
38# rmc_generate_db "dir_1 dir_2" "deploy_dir/rmc.db"
39#
40# The board_2 will be skipped. No record or any data for it is packed in
41# generated database because it only contains a fingerprint file.
42#
43
44rmc_generate_db () {
45 RMC_BOARD_DIRS=$1
46
47 if [ "$#" -ne 2 ]; then
48 echo "rmc_generate_db(): Wrong number of arguments: $#"
49 return 1
50 fi
51
52 RMC_DB_DIR=$(dirname "$2")
53 RMC_RECORDS=""
54
55 rm -rf ${RMC_DB_DIR}
56 mkdir -p ${RMC_DB_DIR}
57
58 # generate rmc database
59 for topdir in ${RMC_BOARD_DIRS}; do
60 # For all board dirs in a topdir:
61 CUR_BOARD_DIRS=$(find ${topdir}/* -type d)
62 for board_dir in ${CUR_BOARD_DIRS}; do
63 CUR_FINGERPRINT=$(find ${board_dir}/ -name "*.fp")
64
65 # disallow a board directory without any fingerprint file in it.
66 if [ -z "${CUR_FINGERPRINT}" ]; then
67 echo "Cannot find RMC fingerprint file in ${board_dir}"
68 return 1
69 fi
70
71 CUR_FILES=$(find ${board_dir}/ -type f |grep -v '\.fp$' || true)
72
73 # allow a directory only with fingerprint file. Developer may
74 # check in fingerprint for future use.
75 if [ -z "${CUR_FILES}" ]; then
76 continue
77 fi
78
79 for fp in ${CUR_FINGERPRINT}; do
80 fullname=$(basename ${fp})
81 CUR_TAG="${fullname%.*}"
82 CUR_RECORD=${RMC_DB_DIR}/${CUR_TAG}.rec
83 rmc -R -f ${fp} -b ${CUR_FILES} -o ${CUR_RECORD}
84 RMC_RECORDS="${RMC_RECORDS} ${CUR_RECORD}"
85 done
86 done
87 done
88
89 if [ ! -z "${RMC_RECORDS}" ]; then
90 rmc -D ${RMC_RECORDS} -o "$2"
91 fi
92}