3 # Copyright (C) 2012 The Android Open Source Project
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
18 Prints to stdout the package names that have overlay changes between
19 current_overlays.txt and previous_overlays.txt.
21 Usage: diff_package_overlays.py <current_packages.txt> <current_overlays.txt> <previous_overlays.txt>
22 current_packages.txt contains all package names separated by space in the current build.
23 This script modfies current_packages.txt if necessary: if there is a package in
24 previous_overlays.txt but absent from current_packages.txt, we copy that line
25 from previous_overlays.txt over to current_packages.txt. Usually that means we
26 just don't care that package in the current build (for example we are switching
27 from a full build to a partial build with mm/mmm), and we should carry on the
28 previous overlay config so current_overlays.txt always reflects the current
29 status of the entire tree.
31 Format of current_overlays.txt and previous_overlays.txt:
32 <package_name> <resource_overlay> [resource_overlay ...]
33 <package_name> <resource_overlay> [resource_overlay ...]
41 print >> sys.stderr, __doc__
45 all_packages = set(f.read().split())
48 def load_overlay_config(filename):
53 if not line or line.startswith("#"):
56 result[words[0]] = " ".join(words[1:])
60 current_overlays = load_overlay_config(argv[2])
61 previous_overlays = load_overlay_config(argv[3])
65 for p in current_overlays:
66 if p not in previous_overlays:
68 elif current_overlays[p] != previous_overlays[p]:
70 for p in previous_overlays:
71 if p not in current_overlays:
76 # we don't build p in the current build.
79 # Add carryon to the current overlay config file.
81 f = open(argv[2], "a")
83 f.write(p + " " + previous_overlays[p] + "\n")
86 # Print out the package names that have overlay change.
90 if __name__ == "__main__":