~sbeattie/apparmor/apparmor-2.9-utils_update

Viewing all changes in revision 2897.

  • Committer: Steve Beattie
  • Author(s): Christian Boltz
  • Date: 2015-04-14 01:41:59 UTC
  • Revision ID: sbeattie@ubuntu.com-20150414014159-jjsxdtkqmtu561lj
utils: extend and partially rewrite write_header()
Merge from trunk revision 2987

- add support for prof_data['header_comment'] (comment after '{')
  and prof_data['profile_keyword'] (to force the 'profile' keyword, even
  if it isn't needed) to write_header().
  (set_profile_flags() will be the only user of these two for now)

- fix a crash if depth is not an integer - for example,
      len('   ')/2   # 3 spaces = 1.5
  would cause a crash.
  Also add a test for 1.5 and 1.3 spaces.

- rewrite the handling of flags to avoid we have to maintain two
  different template lines.

- update the tests to set 'profile_keyword' and 'header_comment' to None.
  This avoids big changes in the test code. I'll send another patch that
  makes sure profile_keyword and header_comment are tested ;-)

Acked-by: Steve Beattie <steve@nxnw.org>

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: