From: Ondrej Mosnacek <omosnace@redhat.com>
To: Petr Lautrbach <plautrba@redhat.com>
Cc: selinux@vger.kernel.org, Petr Lautrbach <lautrbach@redhat.com>
Subject: Re: [PATCH v2 1/3] python/sepolicy: Fix sepolicy manpage -w ...
Date: Fri, 18 Nov 2022 09:34:08 +0100 [thread overview]
Message-ID: <CAFqZXNtb3n5Fiy777KBTFnjgSGkKvvJt=JhNnteO_915esyHdQ@mail.gmail.com> (raw)
In-Reply-To: <20221115194552.338640-1-plautrba@redhat.com>
On Tue, Nov 15, 2022 at 8:49 PM Petr Lautrbach <plautrba@redhat.com> wrote:
>
> From: Petr Lautrbach <lautrbach@redhat.com>
>
> Commit 7494bb1298b3 ("sepolicy: generate man pages in parallel")
> improved sepolicy performance but broke `sepolicy manpage -w ...` as it
> didn't collect data about domains and roles from ManPage() and so
> HTMLManPages() generated only empty page. This is fixed now, domains
> and roles are being collected and used for HTML pages.
>
> Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
> ---
> python/sepolicy/sepolicy.py | 13 +++++++++++--
> python/sepolicy/sepolicy/manpage.py | 12 +++++-------
> 2 files changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/python/sepolicy/sepolicy.py b/python/sepolicy/sepolicy.py
> index 733d40484709..2ca02ee9a0cf 100755
> --- a/python/sepolicy/sepolicy.py
> +++ b/python/sepolicy/sepolicy.py
[...]
> @@ -347,9 +348,17 @@ def manpage(args):
> else:
> test_domains = args.domain
>
> + manpage_domains = set()
> + manpage_roles = set()
> p = Pool()
> + async_results = []
> for domain in test_domains:
> - p.apply_async(manpage_work, [domain, path, args.root, args.source_files, args.web])
> + async_results.append(p.apply_async(manpage_work, [domain, path, args.root, args.source_files, args.web]))
> + results = map(lambda x: x.get(), async_results)
> + for result in results:
> + manpage_domains.update(set(result[0]))
> + manpage_roles.update(set(result[1]))
The above four lines can be written a bit more nicely as follows:
for result in async_results:
domains, roles = result.get()
manpage_domains.update(domains)
manpage_roles.update(roles)
Note that set.update() accepts any iterable, it doesn't need to be a set.
> +
> p.close()
> p.join()
>
[...]
--
Ondrej Mosnacek
Senior Software Engineer, Linux Security - SELinux kernel
Red Hat, Inc.
prev parent reply other threads:[~2022-11-18 8:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 19:45 [PATCH v2 1/3] python/sepolicy: Fix sepolicy manpage -w Petr Lautrbach
2022-11-15 19:45 ` [PATCH v2 2/3] python/sepolicy: Use distro module to get os version Petr Lautrbach
2022-11-15 19:45 ` [PATCH v2 3/3] python/sepolicy: Simplify generation of man pages Petr Lautrbach
2022-11-17 12:46 ` Petr Lautrbach
2022-11-16 21:50 ` [PATCH v2 1/3] python/sepolicy: Fix sepolicy manpage -w James Carter
2022-11-17 12:39 ` Petr Lautrbach
2022-11-17 18:36 ` James Carter
2022-11-17 18:37 ` James Carter
2022-11-18 8:34 ` Ondrej Mosnacek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFqZXNtb3n5Fiy777KBTFnjgSGkKvvJt=JhNnteO_915esyHdQ@mail.gmail.com' \
--to=omosnace@redhat.com \
--cc=lautrbach@redhat.com \
--cc=plautrba@redhat.com \
--cc=selinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).