From 4f447b097d7d856638aebee6b408d5fedf466482 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Mon, 12 Jun 2006 16:59:21 +0000 Subject: [PATCH] Fix build system to not move type declarations out of optionals. --- refpolicy/Changelog | 1 + refpolicy/policy/support/loadable_module.spt | 16 +++------------- refpolicy/support/comment_move_decl.sed | 3 ++- refpolicy/support/get_type_attr_decl.sed | 3 ++- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/refpolicy/Changelog b/refpolicy/Changelog index d7fd3519..f10b4ec1 100644 --- a/refpolicy/Changelog +++ b/refpolicy/Changelog @@ -1,3 +1,4 @@ +- Fix build system to not move type declarations out of optionals. - Add gcc-config domain to portage. - Add packet object class and support in corenetwork. - Add a copy of genhomedircon for monolithic policy building, so that a diff --git a/refpolicy/policy/support/loadable_module.spt b/refpolicy/policy/support/loadable_module.spt index b9550f16..63488ea6 100644 --- a/refpolicy/policy/support/loadable_module.spt +++ b/refpolicy/policy/support/loadable_module.spt @@ -94,25 +94,15 @@ define(`policy_call_depth',0) define(`optional_policy',` ifelse(regexp(`$1',`\W'),`-1',` errprint(__file__:__line__`: deprecated use of module name ($1) as first parameter of optional_policy() block.' __endline__) - optional { - pushdef(`__in_optional_policy') dnl - $2 - popdef(`__in_optional_policy') dnl - ifelse(`$3',`',`',` - } else { - $3 - ') - } + optional_policy(shift($*)) ',` - optional { - pushdef(`__in_optional_policy') dnl + optional {`'pushdef(`__in_optional_policy') $1 - popdef(`__in_optional_policy') dnl ifelse(`$2',`',`',` } else { $2 ') - } + }`'popdef(`__in_optional_policy')`'ifndef(`__in_optional_policy',` # end optional') ') ') diff --git a/refpolicy/support/comment_move_decl.sed b/refpolicy/support/comment_move_decl.sed index 6ea2ceae..1d098d5b 100644 --- a/refpolicy/support/comment_move_decl.sed +++ b/refpolicy/support/comment_move_decl.sed @@ -1,8 +1,9 @@ # comment out lines that are moved by the build # process, so line numbers provided by m4 are preserved. -# lines in require blocks are not moved +# lines in require and optional blocks are not moved /require \{/,/} # end require/b nextline +/optional \{/,/} # end optional/b nextline /^[[:blank:]]*(attribute|type(alias)?) / s/^/# this line was moved by the build process: &/ /^[[:blank:]]*(port|node|netif|genfs)con /s/^/# this line was moved by the build process: &/ diff --git a/refpolicy/support/get_type_attr_decl.sed b/refpolicy/support/get_type_attr_decl.sed index 6bb5ff33..52a11abe 100644 --- a/refpolicy/support/get_type_attr_decl.sed +++ b/refpolicy/support/get_type_attr_decl.sed @@ -1,8 +1,9 @@ #n # print out type and attribute declarations that -# are not inside require blocks. +# are not inside require and optional blocks. /require \{/,/} # end require/b nextline +/optional \{/,/} # end optional/b nextline /^[[:blank:]]*(attribute|type(alias)?) /{ s/^[[:blank:]]+//