Agree with the diagnosis. Solution looks good to me.
On Thu, Jan 3, 2013 at 10:18 PM, William Roberts <[email protected]>wrote: > Looks the problem manifests if you specify more than 1 replace file. > Most of the build tools get their arguments specified via $^, which > removes duplicates. The mac_permissions.xml was unique in the sense > that it was a raw call to build-policy. By adding the sort in, we > remove this duplicate. This change has been pushed to Gerrit on > Android review as Cange-Id I5d5362ad0055275052b0c2ba535b599a8e26112e > > https://android-review.googlesource.com/49090 > > > - $(wildcard $(addsuffix $(expanded_type), $(dir > $(sepolicy_replace_paths)))), \ > + $(wildcard $(addsuffix $(expanded_type), $(sort $(dir > $(sepolicy_replace_paths))))), \ > > > On Thu, Jan 3, 2013 at 3:06 PM, Robert Craig <[email protected]> > wrote: > > The problem seems to relate to the original "build_policy" patch and not > the > > dae746f7 one. Do you have the mac_permissions.xml file listed multiple > times > > in your makefiles that use the same BOARD_SEPOLICY_DIRS var? We probably > > need to augment the "build_policy" or "sepolicy_replace_paths" functions > in > > external/sepolicy/Android.mk to ensure that we catch this case. Either > use a > > "sort" on the final assignment of the var or explicitly add another > > conditional to error out. > > > > > > On Thu, Jan 3, 2013 at 5:33 PM, William Roberts < > [email protected]> > > wrote: > >> > >> On Thu, Jan 3, 2013 at 2:15 PM, Robert Craig <[email protected]> > >> wrote: > >> > If you remove the '$@' (the name of the target of the rule which is > also > >> > the > >> > name of the output file for the insertkeys script) then the script > will > >> > error out before it even starts for your highlighted case. The script > >> > needs > >> > positional arguments that specify both the config_file (key > >> > substitutions) > >> > and 1 or more mac_permission.xml files. If a mac_permissions.xml file > is > >> > specified using BOARD_SEPOLICY_REPLACE then you should get your > desired > >> > result (transparently handled by the ''build_policy" makefile function > >> > in > >> > external/sepolicy/Android.mk). If you include multiple > >> > mac_permissions.xml > >> > files via the BOARD_SEPOLICY_UNION construct then a union occurs > (again, > >> > transparently handled by the same ''build_policy" makefile function). > >> > The > >> > $(ALL_MAC_PERMS_FILES) contains the result of the "build_policy" > >> > function > >> > call which is then used to put positional arguments into > insertkeys.py. > >> > But > >> > it should not be used as the desired output file like your example. > >> > > >> > > insertkeys.py -h > >> > Usage: insertkeys.py [options] CONFIG_FILE MAC_PERMISSIONS_FILE > >> > [MAC_PERMISSIONS_FILE...] > >> > This tool allows one to configure an automatic inclusion > >> > of signing keys into the mac_permision.xml file(s) from the > >> > pem files. If mulitple mac_permision.xml files are included > >> > then they are unioned to produce a final version. > >> > > >> > Options: > >> > --version show program's version number and exit > >> > -h, --help show this help message and exit > >> > -v, --verbose Print internal operations to stdout > >> > -o FILE, --output=FILE > >> > Specify an output file, default is stdout > >> > -c DIR, --cwd=DIR Specify a root (CWD) directory to run this > >> > from, > >> > itchdirs' AFTER loading the config file > >> > -t TARGET_BUILD_VARIANT, > --target-build-variant=TARGET_BUILD_VARIANT > >> > Specify the TARGET_BUILD_VARIANT, defaults to > >> > eng > >> > > >> > > >> > > >> > On Thu, Jan 3, 2013 at 4:26 PM, William Roberts > >> > <[email protected]> > >> > wrote: > >> >> > >> >> The aforementioned commit introduces: > >> >> > >> >> - $(HOST_OUT_EXECUTABLES)/insertkeys.py -t > >> >> $(TARGET_BUILD_VARIANT) > >> >> -c > >> >> $(ANDROID_BUILD_TOP) $(mac_perms_keys.tmp) -o $@ $< > >> >> + $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t > >> >> $(TARGET_BUILD_VARIANT) -c $(ANDROID_BUILD_TOP) $< -o $@ > >> >> $(ALL_MAC_PERMS_FILES) > >> >> > >> >> Shouldn't it be > >> >> + $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t > >> >> $(TARGET_BUILD_VARIANT) -c $(ANDROID_BUILD_TOP) $< -o > >> >> $(ALL_MAC_PERMS_FILES) > >> >> > >> >> I am seeing multiple errant input files to the insertkeys script, > when > >> >> I just want a replace. > >> >> > >> >> -- > >> >> Respectfully, > >> >> > >> >> William C Roberts > >> >> > >> >> -- > >> >> This message was distributed to subscribers of the seandroid-list > >> >> mailing > >> >> list. > >> >> If you no longer wish to subscribe, send mail to > >> >> [email protected] > >> >> with > >> >> the words "unsubscribe seandroid-list" without quotes as the message. > >> > > >> > > >> > >> Hmm misread the line, then the $(ALL_MAC_PERMS_FILES) is expanding to > >> multiple definitions of all the same file. > >> > >> -- > >> Respectfully, > >> > >> William C Roberts > > > > > > > > -- > Respectfully, > > William C Roberts >
