From 3c3e133f99f38f9746df7c51ded6671ffa987504 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Wed, 4 Jan 2017 16:26:07 +0100 Subject: nwztools: small fixes Make sure scripts use bash, make nwz database generator more deterministic Change-Id: I26812b697abe0406fb3c60d6eb231cb27edc81d5 --- utils/nwztools/database/gen_db.py | 6 +++--- utils/nwztools/database/nvp/parse_all_nvp_headers.sh | 2 +- utils/nwztools/database/nvp/parse_all_nvp_nodes.sh | 2 +- utils/nwztools/database/nvp/parse_nvp_header.sh | 1 + utils/nwztools/database/nvp/parse_nvp_nodes.sh | 1 + utils/nwztools/emmctools/nvp.c | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) (limited to 'utils/nwztools') diff --git a/utils/nwztools/database/gen_db.py b/utils/nwztools/database/gen_db.py index 61c08f919a..792a1b91c2 100755 --- a/utils/nwztools/database/gen_db.py +++ b/utils/nwztools/database/gen_db.py @@ -199,9 +199,9 @@ with open("nwz_db.h", "w") as fp: # generate list of all nvp nodes for name in sorted(g_nvp_names): # create comment to explain the meaning, gather several meaning together - # if there are more than one + # if there are more than one (sorted to keep a stable order when we update) explain = "" - if name in g_nvp_desc: + if name in sorted(g_nvp_desc): explain = " | ".join(list(g_nvp_desc[name])) # overwrite desc set with a single string for later g_nvp_desc[name] = explain @@ -257,7 +257,7 @@ with open("nwz_db.c", "w") as fp: fp.write(" { %s, \"%s\" },\n" % (hex(model["mid"]), model["name"])) fp.write("};\n") # generate nvps - for hash in g_hash_nvp: + for hash in sorted(g_hash_nvp): nvp = g_hash_nvp[hash] fp.write("\nstatic int nvp_index_%s[NWZ_NVP_COUNT] =\n" % hash) fp.write("{\n") diff --git a/utils/nwztools/database/nvp/parse_all_nvp_headers.sh b/utils/nwztools/database/nvp/parse_all_nvp_headers.sh index e84eaae8f5..331016b045 100755 --- a/utils/nwztools/database/nvp/parse_all_nvp_headers.sh +++ b/utils/nwztools/database/nvp/parse_all_nvp_headers.sh @@ -1,4 +1,4 @@ -# +#!/bin/bash # usage: parse_all_nvp_headers /path/to/directory # # the expected structure is: diff --git a/utils/nwztools/database/nvp/parse_all_nvp_nodes.sh b/utils/nwztools/database/nvp/parse_all_nvp_nodes.sh index 3aae79deb0..3e67b3d354 100755 --- a/utils/nwztools/database/nvp/parse_all_nvp_nodes.sh +++ b/utils/nwztools/database/nvp/parse_all_nvp_nodes.sh @@ -1,4 +1,4 @@ -# +#!/bin/bash # usage: parse_all_nvp_nodes /path/to/directory # # the expected structure is: diff --git a/utils/nwztools/database/nvp/parse_nvp_header.sh b/utils/nwztools/database/nvp/parse_nvp_header.sh index 853df93557..8baab3c9eb 100755 --- a/utils/nwztools/database/nvp/parse_nvp_header.sh +++ b/utils/nwztools/database/nvp/parse_nvp_header.sh @@ -1,3 +1,4 @@ +#!/bin/bash # usage # parse_header.sh /path/to/icx_nvp.h # parse_header.sh /path/to/linux/source [file] diff --git a/utils/nwztools/database/nvp/parse_nvp_nodes.sh b/utils/nwztools/database/nvp/parse_nvp_nodes.sh index cf42504e32..456a707e5d 100755 --- a/utils/nwztools/database/nvp/parse_nvp_nodes.sh +++ b/utils/nwztools/database/nvp/parse_nvp_nodes.sh @@ -1,3 +1,4 @@ +#!/bin/bash # usage # parse_nodes.sh /path/to/icx_nvp_emmc.ko output_file # parse_nodes.sh /path/to/rootfs/dir output_file diff --git a/utils/nwztools/emmctools/nvp.c b/utils/nwztools/emmctools/nvp.c index c679c1098b..bbc05563b5 100644 --- a/utils/nwztools/emmctools/nvp.c +++ b/utils/nwztools/emmctools/nvp.c @@ -553,4 +553,4 @@ int nvp_info(void) } return 0; -} \ No newline at end of file +} -- cgit v1.2.3