2015-05-11 23:44:09 +00:00
<!DOCTYPE html>
<!-- [if IE 8]><html class="no - js lt - ie9" lang="en" > <![endif] -->
<!-- [if gt IE 8]><! --> < html class = "no-js" lang = "en" > <!-- <![endif] -->
< head >
< meta charset = "utf-8" >
2015-07-10 18:39:39 +00:00
2015-05-11 23:44:09 +00:00
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
2019-01-09 18:23:13 +00:00
< title > pylorax — Lorax 28.14.21 documentation< / title >
2015-05-11 23:44:09 +00:00
2017-11-28 17:18:51 +00:00
2015-05-11 23:44:09 +00:00
2018-10-30 16:35:18 +00:00
< link rel = "stylesheet" href = "../_static/css/theme.css" type = "text/css" / >
2018-05-16 20:15:10 +00:00
< link rel = "stylesheet" href = "../_static/pygments.css" type = "text/css" / >
< link rel = "index" title = "Index" href = "../genindex.html" / >
< link rel = "search" title = "Search" href = "../search.html" / >
2015-05-11 23:44:09 +00:00
2016-02-13 00:06:33 +00:00
< script src = "../_static/js/modernizr.min.js" > < / script >
2015-05-11 23:44:09 +00:00
< / head >
2018-05-16 20:15:10 +00:00
< body class = "wy-body-for-nav" >
2015-05-11 23:44:09 +00:00
2017-11-28 17:18:51 +00:00
2015-05-11 23:44:09 +00:00
< div class = "wy-grid-for-nav" >
< nav data-toggle = "wy-nav-shift" class = "wy-nav-side" >
2016-02-13 00:06:33 +00:00
< div class = "wy-side-scroll" >
< div class = "wy-side-nav-search" >
2015-07-10 18:39:39 +00:00
2016-02-13 00:06:33 +00:00
< a href = "../index.html" class = "icon icon-home" > Lorax
2015-07-10 18:39:39 +00:00
2016-02-13 00:06:33 +00:00
< / a >
2015-07-10 18:39:39 +00:00
2016-02-13 00:06:33 +00:00
< div class = "version" >
2019-01-09 18:23:13 +00:00
28.14.21
2016-02-13 00:06:33 +00:00
< / div >
2015-05-11 23:44:09 +00:00
< div role = "search" >
< form id = "rtd-search-form" class = "wy-form" action = "../search.html" method = "get" >
< input type = "text" name = "q" placeholder = "Search docs" / >
< input type = "hidden" name = "check_keywords" value = "yes" / >
< input type = "hidden" name = "area" value = "default" / >
< / form >
< / div >
2015-07-10 18:39:39 +00:00
2015-05-11 23:44:09 +00:00
2016-02-13 00:06:33 +00:00
< / div >
< div class = "wy-menu wy-menu-vertical" data-spy = "affix" role = "navigation" aria-label = "main navigation" >
2015-05-11 23:44:09 +00:00
2016-02-13 00:06:33 +00:00
2017-11-28 17:18:51 +00:00
< ul >
2015-05-11 23:44:09 +00:00
< li class = "toctree-l1" > < a class = "reference internal" href = "../intro.html" > Introduction to Lorax< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../intro.html#before-lorax" > Before Lorax< / a > < / li >
2016-02-13 00:06:33 +00:00
< li class = "toctree-l1" > < a class = "reference internal" href = "../lorax.html" > Lorax< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../livemedia-creator.html" > livemedia-creator< / a > < / li >
2018-05-16 20:15:10 +00:00
< li class = "toctree-l1" > < a class = "reference internal" href = "../lorax-composer.html" > lorax-composer< / a > < / li >
2018-10-30 16:35:18 +00:00
< li class = "toctree-l1" > < a class = "reference internal" href = "../composer-cli.html" > composer-cli< / a > < / li >
2015-05-11 23:44:09 +00:00
< li class = "toctree-l1" > < a class = "reference internal" href = "../product-images.html" > Product and Updates Images< / a > < / li >
2016-02-13 00:06:33 +00:00
< li class = "toctree-l1" > < a class = "reference internal" href = "../modules.html" > pylorax< / a > < / li >
2015-05-11 23:44:09 +00:00
< / ul >
2016-02-13 00:06:33 +00:00
2015-05-11 23:44:09 +00:00
2016-02-13 00:06:33 +00:00
< / div >
2015-05-11 23:44:09 +00:00
< / div >
< / nav >
< section data-toggle = "wy-nav-shift" class = "wy-nav-content-wrap" >
2018-05-16 20:15:10 +00:00
< nav class = "wy-nav-top" aria-label = "top navigation" >
2017-11-28 17:18:51 +00:00
< i data-toggle = "wy-nav-top" class = "fa fa-bars" > < / i >
< a href = "../index.html" > Lorax< / a >
2015-05-11 23:44:09 +00:00
< / nav >
< div class = "wy-nav-content" >
2018-05-16 20:15:10 +00:00
2015-05-11 23:44:09 +00:00
< div class = "rst-content" >
2018-05-16 20:15:10 +00:00
2016-02-13 00:06:33 +00:00
2017-11-28 17:18:51 +00:00
2016-02-13 00:06:33 +00:00
< div role = "navigation" aria-label = "breadcrumbs navigation" >
2017-11-28 17:18:51 +00:00
2015-05-11 23:44:09 +00:00
< ul class = "wy-breadcrumbs" >
2017-11-28 17:18:51 +00:00
< li > < a href = "../index.html" > Docs< / a > » < / li >
2015-05-11 23:44:09 +00:00
< li > < a href = "index.html" > Module code< / a > » < / li >
2017-11-28 17:18:51 +00:00
< li > pylorax< / li >
2015-05-11 23:44:09 +00:00
< li class = "wy-breadcrumbs-aside" >
< / li >
2017-11-28 17:18:51 +00:00
2015-05-11 23:44:09 +00:00
< / ul >
2017-11-28 17:18:51 +00:00
2015-05-11 23:44:09 +00:00
< hr / >
< / div >
2016-02-13 00:06:33 +00:00
< div role = "main" class = "document" itemscope = "itemscope" itemtype = "http://schema.org/Article" >
< div itemprop = "articleBody" >
2015-05-11 23:44:09 +00:00
< h1 > Source code for pylorax< / h1 > < div class = "highlight" > < pre >
2016-05-23 23:55:51 +00:00
< span > < / span > < span class = "c1" > #< / span >
< span class = "c1" > # __init__.py< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # Copyright (C) 2010-2015 Red Hat, Inc.< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # This program is free software; you can redistribute it and/or modify< / span >
< span class = "c1" > # it under the terms of the GNU General Public License as published by< / span >
< span class = "c1" > # the Free Software Foundation; either version 2 of the License, or< / span >
< span class = "c1" > # (at your option) any later version.< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # This program is distributed in the hope that it will be useful,< / span >
< span class = "c1" > # but WITHOUT ANY WARRANTY; without even the implied warranty of< / span >
< span class = "c1" > # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the< / span >
< span class = "c1" > # GNU General Public License for more details.< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # You should have received a copy of the GNU General Public License< / span >
< span class = "c1" > # along with this program. If not, see < http://www.gnu.org/licenses/> .< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # Red Hat Author(s): Martin Gracik < mgracik@redhat.com> < / span >
< span class = "c1" > # David Cantrell < dcantrell@redhat.com> < / span >
< span class = "c1" > # Will Woods < wwoods@redhat.com> < / span >
< span class = "c1" > # set up logging< / span >
2015-05-11 23:44:09 +00:00
< span class = "kn" > import< / span > < span class = "nn" > logging< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > =< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > getLogger< / span > < span class = "p" > (< / span > < span class = "s2" > " pylorax" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > addHandler< / span > < span class = "p" > (< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > NullHandler< / span > < span class = "p" > ())< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > program_log< / span > < span class = "o" > =< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > getLogger< / span > < span class = "p" > (< / span > < span class = "s2" > " program" < / span > < span class = "p" > )< / span >
2015-07-10 18:39:39 +00:00
2015-05-11 23:44:09 +00:00
< span class = "kn" > import< / span > < span class = "nn" > sys< / span >
< span class = "kn" > import< / span > < span class = "nn" > os< / span >
< span class = "kn" > import< / span > < span class = "nn" > configparser< / span >
< span class = "kn" > import< / span > < span class = "nn" > tempfile< / span >
< span class = "kn" > import< / span > < span class = "nn" > locale< / span >
2016-11-29 17:27:44 +00:00
< span class = "kn" > from< / span > < span class = "nn" > subprocess< / span > < span class = "k" > import< / span > < span class = "n" > CalledProcessError< / span >
2015-05-11 23:44:09 +00:00
< span class = "kn" > import< / span > < span class = "nn" > selinux< / span >
2016-11-29 17:27:44 +00:00
< span class = "kn" > from< / span > < span class = "nn" > glob< / span > < span class = "k" > import< / span > < span class = "n" > glob< / span >
2015-05-11 23:44:09 +00:00
2016-11-29 17:27:44 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.base< / span > < span class = "k" > import< / span > < span class = "n" > BaseLoraxClass< / span > < span class = "p" > ,< / span > < span class = "n" > DataHolder< / span >
< span class = "kn" > import< / span > < span class = "nn" > pylorax.output< / span > < span class = "k" > as< / span > < span class = "nn" > output< / span >
2015-05-11 23:44:09 +00:00
< span class = "kn" > import< / span > < span class = "nn" > dnf< / span >
2016-11-29 17:27:44 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.sysutils< / span > < span class = "k" > import< / span > < span class = "n" > joinpaths< / span > < span class = "p" > ,< / span > < span class = "n" > remove< / span > < span class = "p" > ,< / span > < span class = "n" > linktree< / span >
2015-05-11 23:44:09 +00:00
2016-11-29 17:27:44 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.treebuilder< / span > < span class = "k" > import< / span > < span class = "n" > RuntimeBuilder< / span > < span class = "p" > ,< / span > < span class = "n" > TreeBuilder< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.buildstamp< / span > < span class = "k" > import< / span > < span class = "n" > BuildStamp< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.treeinfo< / span > < span class = "k" > import< / span > < span class = "n" > TreeInfo< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.discinfo< / span > < span class = "k" > import< / span > < span class = "n" > DiscInfo< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.executils< / span > < span class = "k" > import< / span > < span class = "n" > runcmd< / span > < span class = "p" > ,< / span > < span class = "n" > runcmd_output< / span >
2015-05-11 23:44:09 +00:00
2017-11-28 17:18:51 +00:00
< span class = "c1" > # get lorax version< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "kn" > import< / span > < span class = "nn" > pylorax.version< / span >
< span class = "k" > except< / span > < span class = "ne" > ImportError< / span > < span class = "p" > :< / span >
< span class = "n" > vernum< / span > < span class = "o" > =< / span > < span class = "s2" > " devel" < / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > vernum< / span > < span class = "o" > =< / span > < span class = "n" > pylorax< / span > < span class = "o" > .< / span > < span class = "n" > version< / span > < span class = "o" > .< / span > < span class = "n" > num< / span >
2018-06-07 16:18:10 +00:00
< span class = "n" > DRACUT_DEFAULT< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " --xz" < / span > < span class = "p" > ,< / span > < span class = "s2" > " --install" < / span > < span class = "p" > ,< / span > < span class = "s2" > " /.buildstamp" < / span > < span class = "p" > ,< / span > < span class = "s2" > " --no-early-microcode" < / span > < span class = "p" > ,< / span > < span class = "s2" > " --add" < / span > < span class = "p" > ,< / span > < span class = "s2" > " fips" < / span > < span class = "p" > ]< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # List of drivers to remove on ppc64 arch to keep initrd < 32MiB< / span >
< span class = "n" > REMOVE_PPC64_DRIVERS< / span > < span class = "o" > =< / span > < span class = "s2" > " floppy scsi_debug nouveau radeon cirrus mgag200" < / span >
< span class = "n" > REMOVE_PPC64_MODULES< / span > < span class = "o" > =< / span > < span class = "s2" > " drm plymouth" < / span >
2015-05-11 23:44:09 +00:00
2018-10-05 16:54:44 +00:00
< span class = "c1" > # Used for DNF conf.module_platform_id< / span >
< span class = "n" > DEFAULT_PLATFORM_ID< / span > < span class = "o" > =< / span > < span class = "s2" > " platform:el8" < / span >
2015-05-11 23:44:09 +00:00
< div class = "viewcode-block" id = "ArchData" > < a class = "viewcode-back" href = "../pylorax.html#pylorax.ArchData" > [docs]< / a > < span class = "k" > class< / span > < span class = "nc" > ArchData< / span > < span class = "p" > (< / span > < span class = "n" > DataHolder< / span > < span class = "p" > ):< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > lib64_arches< / span > < span class = "o" > =< / span > < span class = "p" > (< / span > < span class = "s2" > " x86_64" < / span > < span class = "p" > ,< / span > < span class = "s2" > " ppc64" < / span > < span class = "p" > ,< / span > < span class = "s2" > " ppc64le" < / span > < span class = "p" > ,< / span > < span class = "s2" > " s390x" < / span > < span class = "p" > ,< / span > < span class = "s2" > " ia64" < / span > < span class = "p" > ,< / span > < span class = "s2" > " aarch64" < / span > < span class = "p" > )< / span >
< span class = "n" > bcj_arch< / span > < span class = "o" > =< / span > < span class = "nb" > dict< / span > < span class = "p" > (< / span > < span class = "n" > i386< / span > < span class = "o" > =< / span > < span class = "s2" > " x86" < / span > < span class = "p" > ,< / span > < span class = "n" > x86_64< / span > < span class = "o" > =< / span > < span class = "s2" > " x86" < / span > < span class = "p" > ,< / span >
< span class = "n" > ppc< / span > < span class = "o" > =< / span > < span class = "s2" > " powerpc" < / span > < span class = "p" > ,< / span > < span class = "n" > ppc64< / span > < span class = "o" > =< / span > < span class = "s2" > " powerpc" < / span > < span class = "p" > ,< / span > < span class = "n" > ppc64le< / span > < span class = "o" > =< / span > < span class = "s2" > " powerpc" < / span > < span class = "p" > ,< / span >
< span class = "n" > arm< / span > < span class = "o" > =< / span > < span class = "s2" > " arm" < / span > < span class = "p" > ,< / span > < span class = "n" > armhfp< / span > < span class = "o" > =< / span > < span class = "s2" > " arm" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > def< / span > < span class = "nf" > __init__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > buildarch< / span > < span class = "p" > ):< / span >
2017-11-28 17:18:51 +00:00
< span class = "nb" > super< / span > < span class = "p" > (< / span > < span class = "n" > ArchData< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "fm" > __init__< / span > < span class = "p" > ()< / span >
2015-05-11 23:44:09 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > buildarch< / span > < span class = "o" > =< / span > < span class = "n" > buildarch< / span >
2016-03-18 23:30:48 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > basearch< / span > < span class = "o" > =< / span > < span class = "n" > dnf< / span > < span class = "o" > .< / span > < span class = "n" > rpm< / span > < span class = "o" > .< / span > < span class = "n" > basearch< / span > < span class = "p" > (< / span > < span class = "n" > buildarch< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > libdir< / span > < span class = "o" > =< / span > < span class = "s2" > " lib64" < / span > < span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > basearch< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > lib64_arches< / span > < span class = "k" > else< / span > < span class = "s2" > " lib" < / span >
2016-11-29 17:27:44 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > bcj< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > bcj_arch< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > basearch< / span > < span class = "p" > )< / span > < / div >
2015-05-11 23:44:09 +00:00
< div class = "viewcode-block" id = "Lorax" > < a class = "viewcode-back" href = "../pylorax.html#pylorax.Lorax" > [docs]< / a > < span class = "k" > class< / span > < span class = "nc" > Lorax< / span > < span class = "p" > (< / span > < span class = "n" > BaseLoraxClass< / span > < span class = "p" > ):< / span >
< span class = "k" > def< / span > < span class = "nf" > __init__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
2017-11-28 17:18:51 +00:00
< span class = "n" > BaseLoraxClass< / span > < span class = "o" > .< / span > < span class = "fm" > __init__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span >
2016-11-29 17:27:44 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _configured< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > workdir< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > inroot< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > outputdir< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _templatedir< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "c1" > # set locale to C< / span >
< span class = "n" > locale< / span > < span class = "o" > .< / span > < span class = "n" > setlocale< / span > < span class = "p" > (< / span > < span class = "n" > locale< / span > < span class = "o" > .< / span > < span class = "n" > LC_ALL< / span > < span class = "p" > ,< / span > < span class = "s1" > ' C' < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< div class = "viewcode-block" id = "Lorax.configure" > < a class = "viewcode-back" href = "../pylorax.html#pylorax.Lorax.configure" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > configure< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > conf_file< / span > < span class = "o" > =< / span > < span class = "s2" > " /etc/lorax/lorax.conf" < / span > < span class = "p" > ):< / span >
2015-05-11 23:44:09 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > =< / span > < span class = "n" > configparser< / span > < span class = "o" > .< / span > < span class = "n" > SafeConfigParser< / span > < span class = "p" > ()< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # set defaults< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > add_section< / span > < span class = "p" > (< / span > < span class = "s2" > " lorax" < / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > set< / span > < span class = "p" > (< / span > < span class = "s2" > " lorax" < / span > < span class = "p" > ,< / span > < span class = "s2" > " debug" < / span > < span class = "p" > ,< / span > < span class = "s2" > " 1" < / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > set< / span > < span class = "p" > (< / span > < span class = "s2" > " lorax" < / span > < span class = "p" > ,< / span > < span class = "s2" > " sharedir" < / span > < span class = "p" > ,< / span > < span class = "s2" > " /usr/share/lorax" < / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > set< / span > < span class = "p" > (< / span > < span class = "s2" > " lorax" < / span > < span class = "p" > ,< / span > < span class = "s2" > " logdir" < / span > < span class = "p" > ,< / span > < span class = "s2" > " /var/log/lorax" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > add_section< / span > < span class = "p" > (< / span > < span class = "s2" > " output" < / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > set< / span > < span class = "p" > (< / span > < span class = "s2" > " output" < / span > < span class = "p" > ,< / span > < span class = "s2" > " colors" < / span > < span class = "p" > ,< / span > < span class = "s2" > " 1" < / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > set< / span > < span class = "p" > (< / span > < span class = "s2" > " output" < / span > < span class = "p" > ,< / span > < span class = "s2" > " encoding" < / span > < span class = "p" > ,< / span > < span class = "s2" > " utf-8" < / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > set< / span > < span class = "p" > (< / span > < span class = "s2" > " output" < / span > < span class = "p" > ,< / span > < span class = "s2" > " ignorelist" < / span > < span class = "p" > ,< / span > < span class = "s2" > " /usr/share/lorax/ignorelist" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > add_section< / span > < span class = "p" > (< / span > < span class = "s2" > " templates" < / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > set< / span > < span class = "p" > (< / span > < span class = "s2" > " templates" < / span > < span class = "p" > ,< / span > < span class = "s2" > " ramdisk" < / span > < span class = "p" > ,< / span > < span class = "s2" > " ramdisk.ltmpl" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > add_section< / span > < span class = "p" > (< / span > < span class = "s2" > " compression" < / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > set< / span > < span class = "p" > (< / span > < span class = "s2" > " compression" < / span > < span class = "p" > ,< / span > < span class = "s2" > " type" < / span > < span class = "p" > ,< / span > < span class = "s2" > " xz" < / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > set< / span > < span class = "p" > (< / span > < span class = "s2" > " compression" < / span > < span class = "p" > ,< / span > < span class = "s2" > " args" < / span > < span class = "p" > ,< / span > < span class = "s2" > " " < / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > set< / span > < span class = "p" > (< / span > < span class = "s2" > " compression" < / span > < span class = "p" > ,< / span > < span class = "s2" > " bcj" < / span > < span class = "p" > ,< / span > < span class = "s2" > " on" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "c1" > # read the config file< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > isfile< / span > < span class = "p" > (< / span > < span class = "n" > conf_file< / span > < span class = "p" > ):< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > read< / span > < span class = "p" > (< / span > < span class = "n" > conf_file< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # set up the output< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > getboolean< / span > < span class = "p" > (< / span > < span class = "s2" > " lorax" < / span > < span class = "p" > ,< / span > < span class = "s2" > " debug" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > output_level< / span > < span class = "o" > =< / span > < span class = "n" > output< / span > < span class = "o" > .< / span > < span class = "n" > DEBUG< / span > < span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "k" > else< / span > < span class = "n" > output< / span > < span class = "o" > .< / span > < span class = "n" > INFO< / span >
< span class = "k" > if< / span > < span class = "n" > sys< / span > < span class = "o" > .< / span > < span class = "n" > stdout< / span > < span class = "o" > .< / span > < span class = "n" > isatty< / span > < span class = "p" > ():< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > colors< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > getboolean< / span > < span class = "p" > (< / span > < span class = "s2" > " output" < / span > < span class = "p" > ,< / span > < span class = "s2" > " colors" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > else< / span > < span class = "p" > :< / span >
2016-11-29 17:27:44 +00:00
< span class = "n" > colors< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > encoding< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " output" < / span > < span class = "p" > ,< / span > < span class = "s2" > " encoding" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > output< / span > < span class = "o" > .< / span > < span class = "n" > basic_config< / span > < span class = "p" > (< / span > < span class = "n" > output_level< / span > < span class = "o" > =< / span > < span class = "n" > output_level< / span > < span class = "p" > ,< / span >
< span class = "n" > colors< / span > < span class = "o" > =< / span > < span class = "n" > colors< / span > < span class = "p" > ,< / span > < span class = "n" > encoding< / span > < span class = "o" > =< / span > < span class = "n" > encoding< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > ignorelist< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " output" < / span > < span class = "p" > ,< / span > < span class = "s2" > " ignorelist" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > isfile< / span > < span class = "p" > (< / span > < span class = "n" > ignorelist< / span > < span class = "p" > ):< / span >
2016-05-23 23:55:51 +00:00
< span class = "k" > with< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > ignorelist< / span > < span class = "p" > ,< / span > < span class = "s2" > " r" < / span > < span class = "p" > )< / span > < span class = "k" > as< / span > < span class = "n" > fobj< / span > < span class = "p" > :< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > for< / span > < span class = "n" > line< / span > < span class = "ow" > in< / span > < span class = "n" > fobj< / span > < span class = "p" > :< / span >
< span class = "n" > line< / span > < span class = "o" > =< / span > < span class = "n" > line< / span > < span class = "o" > .< / span > < span class = "n" > strip< / span > < span class = "p" > ()< / span >
2016-05-23 23:55:51 +00:00
< span class = "k" > if< / span > < span class = "n" > line< / span > < span class = "ow" > and< / span > < span class = "ow" > not< / span > < span class = "n" > line< / span > < span class = "o" > .< / span > < span class = "n" > startswith< / span > < span class = "p" > (< / span > < span class = "s2" > " #" < / span > < span class = "p" > ):< / span >
2015-05-11 23:44:09 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > output< / span > < span class = "o" > .< / span > < span class = "n" > ignore< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # cron does not have sbin in PATH,< / span >
< span class = "c1" > # so we have to add it ourselves< / span >
2016-11-29 17:27:44 +00:00
< span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > environ< / span > < span class = "p" > [< / span > < span class = "s2" > " PATH" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "s2" > " < / span > < span class = "si" > {0}< / span > < span class = "s2" > :/sbin:/usr/sbin" < / span > < span class = "o" > .< / span > < span class = "n" > format< / span > < span class = "p" > (< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > environ< / span > < span class = "p" > [< / span > < span class = "s2" > " PATH" < / span > < span class = "p" > ])< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "c1" > # remove some environmental variables that can cause problems with package scripts< / span >
< span class = "n" > env_remove< / span > < span class = "o" > =< / span > < span class = "p" > (< / span > < span class = "s1" > ' DISPLAY' < / span > < span class = "p" > ,< / span > < span class = "s1" > ' DBUS_SESSION_BUS_ADDRESS' < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "nb" > list< / span > < span class = "p" > (< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > environ< / span > < span class = "o" > .< / span > < span class = "n" > pop< / span > < span class = "p" > (< / span > < span class = "n" > k< / span > < span class = "p" > )< / span > < span class = "k" > for< / span > < span class = "n" > k< / span > < span class = "ow" > in< / span > < span class = "n" > env_remove< / span > < span class = "k" > if< / span > < span class = "n" > k< / span > < span class = "ow" > in< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > environ< / span > < span class = "p" > )< / span >
2016-11-29 17:27:44 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _configured< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < / div >
2016-02-13 00:06:33 +00:00
< span class = "nd" > @property< / span >
2016-11-29 17:27:44 +00:00
< span class = "k" > def< / span > < span class = "nf" > templatedir< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
2016-02-13 00:06:33 +00:00
< span class = "sd" > " " " Find the template directory.< / span >
< span class = "sd" > Pick the first directory under sharedir/templates.d/ if it exists.< / span >
< span class = "sd" > Otherwise use the sharedir< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _templatedir< / span > < span class = "p" > :< / span >
2016-05-23 23:55:51 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _templatedir< / span > < span class = "o" > =< / span > < span class = "n" > find_templates< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " lorax" < / span > < span class = "p" > ,< / span > < span class = "s2" > " sharedir" < / span > < span class = "p" > ))< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " Using templatedir < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _templatedir< / span > < span class = "p" > )< / span >
2016-02-13 00:06:33 +00:00
< span class = "k" > return< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _templatedir< / span >
2016-11-29 17:27:44 +00:00
2015-05-11 23:44:09 +00:00
< div class = "viewcode-block" id = "Lorax.init_stream_logging" > < a class = "viewcode-back" href = "../pylorax.html#pylorax.Lorax.init_stream_logging" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > init_stream_logging< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "n" > sh< / span > < span class = "o" > =< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > StreamHandler< / span > < span class = "p" > ()< / span >
< span class = "n" > sh< / span > < span class = "o" > .< / span > < span class = "n" > setLevel< / span > < span class = "p" > (< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > INFO< / span > < span class = "p" > )< / span >
2016-11-29 17:27:44 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > addHandler< / span > < span class = "p" > (< / span > < span class = "n" > sh< / span > < span class = "p" > )< / span > < / div >
2016-05-23 23:55:51 +00:00
< div class = "viewcode-block" id = "Lorax.init_file_logging" > < a class = "viewcode-back" href = "../pylorax.html#pylorax.Lorax.init_file_logging" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > init_file_logging< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > logdir< / span > < span class = "p" > ,< / span > < span class = "n" > logname< / span > < span class = "o" > =< / span > < span class = "s2" > " pylorax.log" < / span > < span class = "p" > ):< / span >
< span class = "n" > fh< / span > < span class = "o" > =< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > FileHandler< / span > < span class = "p" > (< / span > < span class = "n" > filename< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > logdir< / span > < span class = "p" > ,< / span > < span class = "n" > logname< / span > < span class = "p" > ),< / span > < span class = "n" > mode< / span > < span class = "o" > =< / span > < span class = "s2" > " w" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > fh< / span > < span class = "o" > .< / span > < span class = "n" > setLevel< / span > < span class = "p" > (< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > DEBUG< / span > < span class = "p" > )< / span >
2016-11-29 17:27:44 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > addHandler< / span > < span class = "p" > (< / span > < span class = "n" > fh< / span > < span class = "p" > )< / span > < / div >
2016-05-23 23:55:51 +00:00
< div class = "viewcode-block" id = "Lorax.run" > < a class = "viewcode-back" href = "../pylorax.html#pylorax.Lorax.run" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > run< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > product< / span > < span class = "p" > ,< / span > < span class = "n" > version< / span > < span class = "p" > ,< / span > < span class = "n" > release< / span > < span class = "p" > ,< / span > < span class = "n" > variant< / span > < span class = "o" > =< / span > < span class = "s2" > " " < / span > < span class = "p" > ,< / span > < span class = "n" > bugurl< / span > < span class = "o" > =< / span > < span class = "s2" > " " < / span > < span class = "p" > ,< / span >
2016-11-29 17:27:44 +00:00
< span class = "n" > isfinal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > workdir< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span > < span class = "n" > outputdir< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span > < span class = "n" > buildarch< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span > < span class = "n" > volid< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "n" > domacboot< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span > < span class = "n" > doupgrade< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span > < span class = "n" > remove_temp< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "n" > installpkgs< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span > < span class = "n" > excludepkgs< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > size< / span > < span class = "o" > =< / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span >
2016-11-29 17:27:44 +00:00
< span class = "n" > add_templates< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "n" > add_template_vars< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "n" > add_arch_templates< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "n" > add_arch_template_vars< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
2018-06-07 16:18:10 +00:00
< span class = "n" > verify< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "n" > user_dracut_args< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > ):< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > assert< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _configured< / span >
< span class = "n" > installpkgs< / span > < span class = "o" > =< / span > < span class = "n" > installpkgs< / span > < span class = "ow" > or< / span > < span class = "p" > []< / span >
2016-11-29 17:27:44 +00:00
< span class = "n" > excludepkgs< / span > < span class = "o" > =< / span > < span class = "n" > excludepkgs< / span > < span class = "ow" > or< / span > < span class = "p" > []< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "n" > domacboot< / span > < span class = "p" > :< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > runcmd< / span > < span class = "p" > ([< / span > < span class = "s2" > " rpm" < / span > < span class = "p" > ,< / span > < span class = "s2" > " -q" < / span > < span class = "p" > ,< / span > < span class = "s2" > " hfsplus-tools" < / span > < span class = "p" > ])< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > except< / span > < span class = "n" > CalledProcessError< / span > < span class = "p" > :< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > critical< / span > < span class = "p" > (< / span > < span class = "s2" > " you need to install hfsplus-tools to create mac images" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > sys< / span > < span class = "o" > .< / span > < span class = "n" > exit< / span > < span class = "p" > (< / span > < span class = "mi" > 1< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # set up work directory< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > workdir< / span > < span class = "o" > =< / span > < span class = "n" > workdir< / span > < span class = "ow" > or< / span > < span class = "n" > tempfile< / span > < span class = "o" > .< / span > < span class = "n" > mkdtemp< / span > < span class = "p" > (< / span > < span class = "n" > prefix< / span > < span class = "o" > =< / span > < span class = "s2" > " pylorax.work." < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > isdir< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > workdir< / span > < span class = "p" > ):< / span >
< span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > makedirs< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > workdir< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # set up log directory< / span >
< span class = "n" > logdir< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " lorax" < / span > < span class = "p" > ,< / span > < span class = "s2" > " logdir" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > isdir< / span > < span class = "p" > (< / span > < span class = "n" > logdir< / span > < span class = "p" > ):< / span >
< span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > makedirs< / span > < span class = "p" > (< / span > < span class = "n" > logdir< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > init_stream_logging< / span > < span class = "p" > ()< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > init_file_logging< / span > < span class = "p" > (< / span > < span class = "n" > logdir< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " version is < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > vernum< / span > < span class = "p" > )< / span >
2018-11-29 21:08:44 +00:00
< span class = "n" > log_selinux_state< / span > < span class = "p" > ()< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " using work directory < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > workdir< / span > < span class = "p" > )< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " using log directory < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > logdir< / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "c1" > # set up output directory< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > outputdir< / span > < span class = "o" > =< / span > < span class = "n" > outputdir< / span > < span class = "ow" > or< / span > < span class = "n" > tempfile< / span > < span class = "o" > .< / span > < span class = "n" > mkdtemp< / span > < span class = "p" > (< / span > < span class = "n" > prefix< / span > < span class = "o" > =< / span > < span class = "s2" > " pylorax.out." < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > isdir< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > outputdir< / span > < span class = "p" > ):< / span >
< span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > makedirs< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > outputdir< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " using output directory < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > outputdir< / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "c1" > # do we have root privileges?< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " checking for root privileges" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > geteuid< / span > < span class = "p" > ()< / span > < span class = "o" > ==< / span > < span class = "mi" > 0< / span > < span class = "p" > :< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > critical< / span > < span class = "p" > (< / span > < span class = "s2" > " no root privileges" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > sys< / span > < span class = "o" > .< / span > < span class = "n" > exit< / span > < span class = "p" > (< / span > < span class = "mi" > 1< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # do we have a proper dnf base object?< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " checking dnf base object" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "nb" > isinstance< / span > < span class = "p" > (< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > dnf< / span > < span class = "o" > .< / span > < span class = "n" > Base< / span > < span class = "p" > ):< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > critical< / span > < span class = "p" > (< / span > < span class = "s2" > " no dnf base object" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > sys< / span > < span class = "o" > .< / span > < span class = "n" > exit< / span > < span class = "p" > (< / span > < span class = "mi" > 1< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > inroot< / span > < span class = "o" > =< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > installroot< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " using install root: < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > inroot< / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > buildarch< / span > < span class = "p" > :< / span >
< span class = "n" > buildarch< / span > < span class = "o" > =< / span > < span class = "n" > get_buildarch< / span > < span class = "p" > (< / span > < span class = "n" > dbo< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " setting up build architecture" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "o" > =< / span > < span class = "n" > ArchData< / span > < span class = "p" > (< / span > < span class = "n" > buildarch< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "k" > for< / span > < span class = "n" > attr< / span > < span class = "ow" > in< / span > < span class = "p" > (< / span > < span class = "s1" > ' buildarch' < / span > < span class = "p" > ,< / span > < span class = "s1" > ' basearch' < / span > < span class = "p" > ,< / span > < span class = "s1" > ' libdir' < / span > < span class = "p" > ):< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " self.arch.< / span > < span class = "si" > %s< / span > < span class = "s2" > = < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > attr< / span > < span class = "p" > ,< / span > < span class = "nb" > getattr< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "p" > ,< / span > < span class = "n" > attr< / span > < span class = "p" > ))< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " setting up build parameters" < / span > < span class = "p" > )< / span >
2015-07-10 18:39:39 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "o" > =< / span > < span class = "n" > DataHolder< / span > < span class = "p" > (< / span > < span class = "n" > name< / span > < span class = "o" > =< / span > < span class = "n" > product< / span > < span class = "p" > ,< / span > < span class = "n" > version< / span > < span class = "o" > =< / span > < span class = "n" > version< / span > < span class = "p" > ,< / span > < span class = "n" > release< / span > < span class = "o" > =< / span > < span class = "n" > release< / span > < span class = "p" > ,< / span >
< span class = "n" > variant< / span > < span class = "o" > =< / span > < span class = "n" > variant< / span > < span class = "p" > ,< / span > < span class = "n" > bugurl< / span > < span class = "o" > =< / span > < span class = "n" > bugurl< / span > < span class = "p" > ,< / span > < span class = "n" > isfinal< / span > < span class = "o" > =< / span > < span class = "n" > isfinal< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " product data: < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "c1" > # NOTE: if you change isolabel, you need to change pungi to match, or< / span >
< span class = "c1" > # the pungi images won' t boot.< / span >
< span class = "n" > isolabel< / span > < span class = "o" > =< / span > < span class = "n" > volid< / span > < span class = "ow" > or< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > -< / span > < span class = "si" > %s< / span > < span class = "s2" > -< / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > version< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "o" > .< / span > < span class = "n" > basearch< / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "n" > isolabel< / span > < span class = "p" > )< / span > < span class = "o" > > < / span > < span class = "mi" > 32< / span > < span class = "p" > :< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > fatal< / span > < span class = "p" > (< / span > < span class = "s2" > " the volume id cannot be longer than 32 characters" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > sys< / span > < span class = "o" > .< / span > < span class = "n" > exit< / span > < span class = "p" > (< / span > < span class = "mi" > 1< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # NOTE: rb.root = dbo.conf.installroot (== self.inroot)< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > rb< / span > < span class = "o" > =< / span > < span class = "n" > RuntimeBuilder< / span > < span class = "p" > (< / span > < span class = "n" > product< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "p" > ,< / span > < span class = "n" > arch< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "p" > ,< / span >
2016-02-13 00:06:33 +00:00
< span class = "n" > dbo< / span > < span class = "o" > =< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > templatedir< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > templatedir< / span > < span class = "p" > ,< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > installpkgs< / span > < span class = "o" > =< / span > < span class = "n" > installpkgs< / span > < span class = "p" > ,< / span >
2016-11-29 17:27:44 +00:00
< span class = "n" > excludepkgs< / span > < span class = "o" > =< / span > < span class = "n" > excludepkgs< / span > < span class = "p" > ,< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > add_templates< / span > < span class = "o" > =< / span > < span class = "n" > add_templates< / span > < span class = "p" > ,< / span >
< span class = "n" > add_template_vars< / span > < span class = "o" > =< / span > < span class = "n" > add_template_vars< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " installing runtime packages" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > rb< / span > < span class = "o" > .< / span > < span class = "n" > install< / span > < span class = "p" > ()< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # write .buildstamp< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > buildstamp< / span > < span class = "o" > =< / span > < span class = "n" > BuildStamp< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > version< / span > < span class = "p" > ,< / span >
2018-03-15 20:53:58 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > bugurl< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > isfinal< / span > < span class = "p" > ,< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "o" > .< / span > < span class = "n" > buildarch< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > variant< / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "n" > buildstamp< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > inroot< / span > < span class = "p" > ,< / span > < span class = "s2" > " .buildstamp" < / span > < span class = "p" > ))< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > :< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > rb< / span > < span class = "o" > .< / span > < span class = "n" > writepkglists< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > logdir< / span > < span class = "p" > ,< / span > < span class = "s2" > " pkglists" < / span > < span class = "p" > ))< / span >
< span class = "n" > rb< / span > < span class = "o" > .< / span > < span class = "n" > writepkgsizes< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > logdir< / span > < span class = "p" > ,< / span > < span class = "s2" > " original-pkgsizes.txt" < / span > < span class = "p" > ))< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " doing post-install configuration" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > rb< / span > < span class = "o" > .< / span > < span class = "n" > postinstall< / span > < span class = "p" > ()< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # write .discinfo< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > discinfo< / span > < span class = "o" > =< / span > < span class = "n" > DiscInfo< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > release< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "o" > .< / span > < span class = "n" > basearch< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > discinfo< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > outputdir< / span > < span class = "p" > ,< / span > < span class = "s2" > " .discinfo" < / span > < span class = "p" > ))< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " backing up installroot" < / span > < span class = "p" > )< / span >
< span class = "n" > installroot< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > workdir< / span > < span class = "p" > ,< / span > < span class = "s2" > " installroot" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > linktree< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > inroot< / span > < span class = "p" > ,< / span > < span class = "n" > installroot< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " generating kernel module metadata" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > rb< / span > < span class = "o" > .< / span > < span class = "n" > generate_module_data< / span > < span class = "p" > ()< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " cleaning unneeded files" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > rb< / span > < span class = "o" > .< / span > < span class = "n" > cleanup< / span > < span class = "p" > ()< / span >
2015-08-25 22:51:32 +00:00
< span class = "k" > if< / span > < span class = "n" > verify< / span > < span class = "p" > :< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " verifying the installroot" < / span > < span class = "p" > )< / span >
2015-08-25 22:51:32 +00:00
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > rb< / span > < span class = "o" > .< / span > < span class = "n" > verify< / span > < span class = "p" > ():< / span >
< span class = "n" > sys< / span > < span class = "o" > .< / span > < span class = "n" > exit< / span > < span class = "p" > (< / span > < span class = "mi" > 1< / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " Skipping verify" < / span > < span class = "p" > )< / span >
2015-08-25 22:51:32 +00:00
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > :< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > rb< / span > < span class = "o" > .< / span > < span class = "n" > writepkgsizes< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > logdir< / span > < span class = "p" > ,< / span > < span class = "s2" > " final-pkgsizes.txt" < / span > < span class = "p" > ))< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " creating the runtime image" < / span > < span class = "p" > )< / span >
< span class = "n" > runtime< / span > < span class = "o" > =< / span > < span class = "s2" > " images/install.img" < / span >
< span class = "n" > compression< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " compression" < / span > < span class = "p" > ,< / span > < span class = "s2" > " type" < / span > < span class = "p" > )< / span >
< span class = "n" > compressargs< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " compression" < / span > < span class = "p" > ,< / span > < span class = "s2" > " args" < / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > ()< / span > < span class = "c1" > # pylint: disable=no-member< / span >
< span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > getboolean< / span > < span class = "p" > (< / span > < span class = "s2" > " compression" < / span > < span class = "p" > ,< / span > < span class = "s2" > " bcj" < / span > < span class = "p" > ):< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "o" > .< / span > < span class = "n" > bcj< / span > < span class = "p" > :< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > compressargs< / span > < span class = "o" > +=< / span > < span class = "p" > [< / span > < span class = "s2" > " -Xbcj" < / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "o" > .< / span > < span class = "n" > bcj< / span > < span class = "p" > ]< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > else< / span > < span class = "p" > :< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " no BCJ filter for arch < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "o" > .< / span > < span class = "n" > basearch< / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > rb< / span > < span class = "o" > .< / span > < span class = "n" > create_runtime< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > installroot< / span > < span class = "p" > ,< / span > < span class = "n" > runtime< / span > < span class = "p" > ),< / span >
< span class = "n" > compression< / span > < span class = "o" > =< / span > < span class = "n" > compression< / span > < span class = "p" > ,< / span > < span class = "n" > compressargs< / span > < span class = "o" > =< / span > < span class = "n" > compressargs< / span > < span class = "p" > ,< / span >
< span class = "n" > size< / span > < span class = "o" > =< / span > < span class = "n" > size< / span > < span class = "p" > )< / span >
< span class = "n" > rb< / span > < span class = "o" > .< / span > < span class = "n" > finished< / span > < span class = "p" > ()< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " preparing to build output tree and boot images" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > treebuilder< / span > < span class = "o" > =< / span > < span class = "n" > TreeBuilder< / span > < span class = "p" > (< / span > < span class = "n" > product< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "p" > ,< / span > < span class = "n" > arch< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "p" > ,< / span >
< span class = "n" > inroot< / span > < span class = "o" > =< / span > < span class = "n" > installroot< / span > < span class = "p" > ,< / span > < span class = "n" > outroot< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > outputdir< / span > < span class = "p" > ,< / span >
< span class = "n" > runtime< / span > < span class = "o" > =< / span > < span class = "n" > runtime< / span > < span class = "p" > ,< / span > < span class = "n" > isolabel< / span > < span class = "o" > =< / span > < span class = "n" > isolabel< / span > < span class = "p" > ,< / span >
< span class = "n" > domacboot< / span > < span class = "o" > =< / span > < span class = "n" > domacboot< / span > < span class = "p" > ,< / span > < span class = "n" > doupgrade< / span > < span class = "o" > =< / span > < span class = "n" > doupgrade< / span > < span class = "p" > ,< / span >
2016-02-13 00:06:33 +00:00
< span class = "n" > templatedir< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > templatedir< / span > < span class = "p" > ,< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > add_templates< / span > < span class = "o" > =< / span > < span class = "n" > add_arch_templates< / span > < span class = "p" > ,< / span >
< span class = "n" > add_template_vars< / span > < span class = "o" > =< / span > < span class = "n" > add_arch_template_vars< / span > < span class = "p" > ,< / span >
< span class = "n" > workdir< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > workdir< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " rebuilding initramfs images" < / span > < span class = "p" > )< / span >
2018-06-07 16:18:10 +00:00
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > user_dracut_args< / span > < span class = "p" > :< / span >
< span class = "n" > dracut_args< / span > < span class = "o" > =< / span > < span class = "n" > DRACUT_DEFAULT< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > dracut_args< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > for< / span > < span class = "n" > arg< / span > < span class = "ow" > in< / span > < span class = "n" > user_dracut_args< / span > < span class = "p" > :< / span >
< span class = "n" > dracut_args< / span > < span class = "o" > +=< / span > < span class = "n" > arg< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s2" > " " < / span > < span class = "p" > ,< / span > < span class = "mi" > 1< / span > < span class = "p" > )< / span >
2018-10-05 16:54:44 +00:00
< span class = "n" > anaconda_args< / span > < span class = "o" > =< / span > < span class = "n" > dracut_args< / span > < span class = "o" > +< / span > < span class = "p" > [< / span > < span class = "s2" > " --add" < / span > < span class = "p" > ,< / span > < span class = "s2" > " anaconda pollcdrom qemu qemu-net prefixdevname-tools" < / span > < span class = "p" > ]< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "c1" > # ppc64 cannot boot an initrd > 32MiB so remove some drivers< / span >
< span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "o" > .< / span > < span class = "n" > basearch< / span > < span class = "ow" > in< / span > < span class = "p" > (< / span > < span class = "s2" > " ppc64" < / span > < span class = "p" > ,< / span > < span class = "s2" > " ppc64le" < / span > < span class = "p" > ):< / span >
< span class = "n" > dracut_args< / span > < span class = "o" > .< / span > < span class = "n" > extend< / span > < span class = "p" > ([< / span > < span class = "s2" > " --omit-drivers" < / span > < span class = "p" > ,< / span > < span class = "n" > REMOVE_PPC64_DRIVERS< / span > < span class = "p" > ])< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "c1" > # Only omit dracut modules from the initrd so that they' re kept for< / span >
< span class = "c1" > # upgrade.img< / span >
< span class = "n" > anaconda_args< / span > < span class = "o" > .< / span > < span class = "n" > extend< / span > < span class = "p" > ([< / span > < span class = "s2" > " --omit" < / span > < span class = "p" > ,< / span > < span class = "n" > REMOVE_PPC64_MODULES< / span > < span class = "p" > ])< / span >
2015-05-11 23:44:09 +00:00
2018-06-07 16:18:10 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " dracut args = < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > dracut_args< / span > < span class = "p" > )< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " anaconda args = < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > anaconda_args< / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > treebuilder< / span > < span class = "o" > .< / span > < span class = "n" > rebuild_initrds< / span > < span class = "p" > (< / span > < span class = "n" > add_args< / span > < span class = "o" > =< / span > < span class = "n" > anaconda_args< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " populating output tree and building boot images" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > treebuilder< / span > < span class = "o" > .< / span > < span class = "n" > build< / span > < span class = "p" > ()< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # write .treeinfo file and we' re done< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > treeinfo< / span > < span class = "o" > =< / span > < span class = "n" > TreeInfo< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > version< / span > < span class = "p" > ,< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > variant< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "o" > .< / span > < span class = "n" > basearch< / span > < span class = "p" > )< / span >
< span class = "k" > for< / span > < span class = "n" > section< / span > < span class = "p" > ,< / span > < span class = "n" > data< / span > < span class = "ow" > in< / span > < span class = "n" > treebuilder< / span > < span class = "o" > .< / span > < span class = "n" > treeinfo_data< / span > < span class = "o" > .< / span > < span class = "n" > items< / span > < span class = "p" > ():< / span >
< span class = "n" > treeinfo< / span > < span class = "o" > .< / span > < span class = "n" > add_section< / span > < span class = "p" > (< / span > < span class = "n" > section< / span > < span class = "p" > ,< / span > < span class = "n" > data< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > treeinfo< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > outputdir< / span > < span class = "p" > ,< / span > < span class = "s2" > " .treeinfo" < / span > < span class = "p" > ))< / span >
2015-05-11 23:44:09 +00:00
2016-05-23 23:55:51 +00:00
< span class = "c1" > # cleanup< / span >
2015-05-11 23:44:09 +00:00
< span class = "k" > if< / span > < span class = "n" > remove_temp< / span > < span class = "p" > :< / span >
2016-11-29 17:27:44 +00:00
< span class = "n" > remove< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > workdir< / span > < span class = "p" > )< / span > < / div > < / div >
2015-05-11 23:44:09 +00:00
< div class = "viewcode-block" id = "get_buildarch" > < a class = "viewcode-back" href = "../pylorax.html#pylorax.get_buildarch" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > get_buildarch< / span > < span class = "p" > (< / span > < span class = "n" > dbo< / span > < span class = "p" > ):< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # get architecture of the available anaconda package< / span >
2016-11-29 17:27:44 +00:00
< span class = "n" > buildarch< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > q< / span > < span class = "o" > =< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > sack< / span > < span class = "o" > .< / span > < span class = "n" > query< / span > < span class = "p" > ()< / span >
< span class = "n" > a< / span > < span class = "o" > =< / span > < span class = "n" > q< / span > < span class = "o" > .< / span > < span class = "n" > available< / span > < span class = "p" > ()< / span >
2017-11-28 17:18:51 +00:00
< span class = "k" > for< / span > < span class = "n" > anaconda< / span > < span class = "ow" > in< / span > < span class = "n" > a< / span > < span class = "o" > .< / span > < span class = "n" > filter< / span > < span class = "p" > (< / span > < span class = "n" > name< / span > < span class = "o" > =< / span > < span class = "s2" > " anaconda-core" < / span > < span class = "p" > ):< / span >
2016-05-23 23:55:51 +00:00
< span class = "k" > if< / span > < span class = "n" > anaconda< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span > < span class = "o" > !=< / span > < span class = "s2" > " src" < / span > < span class = "p" > :< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > buildarch< / span > < span class = "o" > =< / span > < span class = "n" > anaconda< / span > < span class = "o" > .< / span > < span class = "n" > arch< / span >
< span class = "k" > break< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > buildarch< / span > < span class = "p" > :< / span >
2017-11-28 17:18:51 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > critical< / span > < span class = "p" > (< / span > < span class = "s2" > " no anaconda-core package in the repository" < / span > < span class = "p" > )< / span >
2015-05-11 23:44:09 +00:00
< span class = "n" > sys< / span > < span class = "o" > .< / span > < span class = "n" > exit< / span > < span class = "p" > (< / span > < span class = "mi" > 1< / span > < span class = "p" > )< / span >
2016-11-29 17:27:44 +00:00
< span class = "k" > return< / span > < span class = "n" > buildarch< / span > < / div >
2015-07-10 18:39:39 +00:00
< div class = "viewcode-block" id = "setup_logging" > < a class = "viewcode-back" href = "../pylorax.html#pylorax.setup_logging" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > setup_logging< / span > < span class = "p" > (< / span > < span class = "n" > logfile< / span > < span class = "p" > ,< / span > < span class = "n" > theLogger< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " < / span >
< span class = "sd" > Setup the various logs< / span >
< span class = "sd" > :param logfile: filename to write the log to< / span >
< span class = "sd" > :type logfile: string< / span >
< span class = "sd" > :param theLogger: top-level logger< / span >
< span class = "sd" > :type theLogger: logging.Logger< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > isdir< / span > < span class = "p" > (< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > abspath< / span > < span class = "p" > (< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > dirname< / span > < span class = "p" > (< / span > < span class = "n" > logfile< / span > < span class = "p" > ))):< / span >
< span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > makedirs< / span > < span class = "p" > (< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > abspath< / span > < span class = "p" > (< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > dirname< / span > < span class = "p" > (< / span > < span class = "n" > logfile< / span > < span class = "p" > )))< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # Setup logging to console and to logfile< / span >
2015-07-10 18:39:39 +00:00
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > setLevel< / span > < span class = "p" > (< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > DEBUG< / span > < span class = "p" > )< / span >
< span class = "n" > theLogger< / span > < span class = "o" > .< / span > < span class = "n" > setLevel< / span > < span class = "p" > (< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > DEBUG< / span > < span class = "p" > )< / span >
< span class = "n" > sh< / span > < span class = "o" > =< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > StreamHandler< / span > < span class = "p" > ()< / span >
< span class = "n" > sh< / span > < span class = "o" > .< / span > < span class = "n" > setLevel< / span > < span class = "p" > (< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > INFO< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > fmt< / span > < span class = "o" > =< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > Formatter< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %(asctime)s< / span > < span class = "s2" > : < / span > < span class = "si" > %(message)s< / span > < span class = "s2" > " < / span > < span class = "p" > )< / span >
2015-07-10 18:39:39 +00:00
< span class = "n" > sh< / span > < span class = "o" > .< / span > < span class = "n" > setFormatter< / span > < span class = "p" > (< / span > < span class = "n" > fmt< / span > < span class = "p" > )< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > addHandler< / span > < span class = "p" > (< / span > < span class = "n" > sh< / span > < span class = "p" > )< / span >
< span class = "n" > theLogger< / span > < span class = "o" > .< / span > < span class = "n" > addHandler< / span > < span class = "p" > (< / span > < span class = "n" > sh< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > fh< / span > < span class = "o" > =< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > FileHandler< / span > < span class = "p" > (< / span > < span class = "n" > filename< / span > < span class = "o" > =< / span > < span class = "n" > logfile< / span > < span class = "p" > ,< / span > < span class = "n" > mode< / span > < span class = "o" > =< / span > < span class = "s2" > " w" < / span > < span class = "p" > )< / span >
2015-07-10 18:39:39 +00:00
< span class = "n" > fh< / span > < span class = "o" > .< / span > < span class = "n" > setLevel< / span > < span class = "p" > (< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > DEBUG< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > fmt< / span > < span class = "o" > =< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > Formatter< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %(asctime)s< / span > < span class = "s2" > < / span > < span class = "si" > %(levelname)s< / span > < span class = "s2" > < / span > < span class = "si" > %(name)s< / span > < span class = "s2" > : < / span > < span class = "si" > %(message)s< / span > < span class = "s2" > " < / span > < span class = "p" > )< / span >
2015-07-10 18:39:39 +00:00
< span class = "n" > fh< / span > < span class = "o" > .< / span > < span class = "n" > setFormatter< / span > < span class = "p" > (< / span > < span class = "n" > fmt< / span > < span class = "p" > )< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > addHandler< / span > < span class = "p" > (< / span > < span class = "n" > fh< / span > < span class = "p" > )< / span >
< span class = "n" > theLogger< / span > < span class = "o" > .< / span > < span class = "n" > addHandler< / span > < span class = "p" > (< / span > < span class = "n" > fh< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "c1" > # External program output log< / span >
2015-07-10 18:39:39 +00:00
< span class = "n" > program_log< / span > < span class = "o" > .< / span > < span class = "n" > setLevel< / span > < span class = "p" > (< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > DEBUG< / span > < span class = "p" > )< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > f< / span > < span class = "o" > =< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > abspath< / span > < span class = "p" > (< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > dirname< / span > < span class = "p" > (< / span > < span class = "n" > logfile< / span > < span class = "p" > ))< / span > < span class = "o" > +< / span > < span class = "s2" > " /program.log" < / span >
< span class = "n" > fh< / span > < span class = "o" > =< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > FileHandler< / span > < span class = "p" > (< / span > < span class = "n" > filename< / span > < span class = "o" > =< / span > < span class = "n" > f< / span > < span class = "p" > ,< / span > < span class = "n" > mode< / span > < span class = "o" > =< / span > < span class = "s2" > " w" < / span > < span class = "p" > )< / span >
2015-07-10 18:39:39 +00:00
< span class = "n" > fh< / span > < span class = "o" > .< / span > < span class = "n" > setLevel< / span > < span class = "p" > (< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > DEBUG< / span > < span class = "p" > )< / span >
2016-11-29 17:27:44 +00:00
< span class = "n" > program_log< / span > < span class = "o" > .< / span > < span class = "n" > addHandler< / span > < span class = "p" > (< / span > < span class = "n" > fh< / span > < span class = "p" > )< / span > < / div >
2016-02-13 00:06:33 +00:00
2016-05-23 23:55:51 +00:00
< div class = "viewcode-block" id = "find_templates" > < a class = "viewcode-back" href = "../pylorax.html#pylorax.find_templates" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > find_templates< / span > < span class = "p" > (< / span > < span class = "n" > templatedir< / span > < span class = "o" > =< / span > < span class = "s2" > " /usr/share/lorax" < / span > < span class = "p" > ):< / span >
2016-02-13 00:06:33 +00:00
< span class = "sd" > " " " Find the templates to use.< / span >
< span class = "sd" > :param str templatedir: Top directory to search for templates< / span >
< span class = "sd" > :returns: Path to templates< / span >
< span class = "sd" > :rtype: str< / span >
< span class = "sd" > If there is a templates.d directory under templatedir the< / span >
< span class = "sd" > lowest numbered directory entry is returned.< / span >
< span class = "sd" > eg. /usr/share/lorax/templates.d/99-generic/< / span >
< span class = "sd" > " " " < / span >
2016-05-23 23:55:51 +00:00
< span class = "k" > if< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > isdir< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > templatedir< / span > < span class = "p" > ,< / span > < span class = "s2" > " templates.d" < / span > < span class = "p" > )):< / span >
2016-02-13 00:06:33 +00:00
< span class = "k" > try< / span > < span class = "p" > :< / span >
2016-05-23 23:55:51 +00:00
< span class = "n" > templatedir< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "n" > glob< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > templatedir< / span > < span class = "p" > ,< / span > < span class = "s2" > " templates.d" < / span > < span class = "p" > ,< / span > < span class = "s2" > " *" < / span > < span class = "p" > )))[< / span > < span class = "mi" > 0< / span > < span class = "p" > ]< / span >
2016-02-13 00:06:33 +00:00
< span class = "k" > except< / span > < span class = "ne" > IndexError< / span > < span class = "p" > :< / span >
< span class = "k" > pass< / span >
< span class = "k" > return< / span > < span class = "n" > templatedir< / span > < / div >
2018-11-29 21:08:44 +00:00
< div class = "viewcode-block" id = "log_selinux_state" > < a class = "viewcode-back" href = "../pylorax.html#pylorax.log_selinux_state" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > log_selinux_state< / span > < span class = "p" > ():< / span >
< span class = "sd" > " " " Log the current state of selinux" " " < / span >
< span class = "k" > if< / span > < span class = "n" > selinux< / span > < span class = "o" > .< / span > < span class = "n" > is_selinux_enabled< / span > < span class = "p" > ():< / span >
< span class = "k" > if< / span > < span class = "n" > selinux< / span > < span class = "o" > .< / span > < span class = "n" > security_getenforce< / span > < span class = "p" > ():< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " selinux is enabled and in Enforcing mode" < / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " selinux is enabled and in Permissive mode" < / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " selinux is Disabled" < / span > < span class = "p" > )< / span > < / div >
2015-05-11 23:44:09 +00:00
< / pre > < / div >
2017-11-28 17:18:51 +00:00
< / div >
2018-05-16 20:15:10 +00:00
2015-05-11 23:44:09 +00:00
< / div >
< footer >
< hr / >
< div role = "contentinfo" >
< p >
2018-10-30 16:35:18 +00:00
© Copyright 2018, Red Hat, Inc.
2016-02-13 00:06:33 +00:00
2015-05-11 23:44:09 +00:00
< / p >
< / div >
2018-05-16 20:15:10 +00:00
Built with < a href = "http://sphinx-doc.org/" > Sphinx< / a > using a < a href = "https://github.com/rtfd/sphinx_rtd_theme" > theme< / a > provided by < a href = "https://readthedocs.org" > Read the Docs< / a > .
2015-07-10 18:39:39 +00:00
2015-05-11 23:44:09 +00:00
< / footer >
2015-07-10 18:39:39 +00:00
2015-05-11 23:44:09 +00:00
< / div >
< / div >
< / section >
< / div >
2018-10-30 16:35:18 +00:00
< script type = "text/javascript" >
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../',
2019-01-09 18:23:13 +00:00
VERSION:'28.14.21',
2018-10-30 16:35:18 +00:00
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
< / script >
< script type = "text/javascript" src = "../_static/jquery.js" > < / script >
< script type = "text/javascript" src = "../_static/underscore.js" > < / script >
< script type = "text/javascript" src = "../_static/doctools.js" > < / script >
2015-05-11 23:44:09 +00:00
2018-10-30 16:35:18 +00:00
< script type = "text/javascript" src = "../_static/js/theme.js" > < / script >
2015-05-11 23:44:09 +00:00
< script type = "text/javascript" >
jQuery(function () {
2018-06-04 23:50:39 +00:00
SphinxRtdTheme.Navigation.enable(true);
2015-05-11 23:44:09 +00:00
});
2018-05-16 20:15:10 +00:00
< / script >
2015-05-11 23:44:09 +00:00
< / body >
< / html >