All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH userspace] sepolicy: generate man pages in parallel
@ 2019-10-14  8:06 Ondrej Mosnacek
  2019-10-17 17:14 ` Stephen Smalley
  0 siblings, 1 reply; 6+ messages in thread
From: Ondrej Mosnacek @ 2019-10-14  8:06 UTC (permalink / raw)
  To: selinux

Generating man pages takes a lot of time. Do it in parallel to speed up
the process.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
 python/sepolicy/sepolicy.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/python/sepolicy/sepolicy.py b/python/sepolicy/sepolicy.py
index 1934cd86..02094013 100755
--- a/python/sepolicy/sepolicy.py
+++ b/python/sepolicy/sepolicy.py
@@ -25,6 +25,7 @@ import os
 import sys
 import selinux
 import sepolicy
+from concurrent.futures import ProcessPoolExecutor
 from sepolicy import get_os_version, get_conditionals, get_conditionals_format_text
 import argparse
 PROGNAME = "policycoreutils"
@@ -326,8 +327,13 @@ def gen_gui_args(parser):
     gui.set_defaults(func=gui_run)
 
 
+def manpage_work(domain, path, root, source_files, web):
+    from sepolicy.manpage import ManPage
+    m = ManPage(domain, path, root, source_files, web)
+    print(m.get_man_page_path())
+
 def manpage(args):
-    from sepolicy.manpage import ManPage, HTMLManPages, manpage_domains, manpage_roles, gen_domains
+    from sepolicy.manpage import HTMLManPages, manpage_domains, manpage_roles, gen_domains
 
     path = args.path
     if not args.policy and args.root != "/":
@@ -340,9 +346,9 @@ def manpage(args):
     else:
         test_domains = args.domain
 
-    for domain in test_domains:
-        m = ManPage(domain, path, args.root, args.source_files, args.web)
-        print(m.get_man_page_path())
+    with ProcessPoolExecutor() as e:
+        for domain in test_domains:
+            e.submit(manpage_work, domain, path, args.root, args.source_files, args.web)
 
     if args.web:
         HTMLManPages(manpage_roles, manpage_domains, path, args.os)
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-10-18  9:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14  8:06 [PATCH userspace] sepolicy: generate man pages in parallel Ondrej Mosnacek
2019-10-17 17:14 ` Stephen Smalley
2019-10-18  7:44   ` Ondrej Mosnacek
2019-10-18  9:00     ` Chris PeBenito
2019-10-18  9:01       ` Chris PeBenito
2019-10-18  9:22         ` Ondrej Mosnacek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.