2018-03-15 21:04:29 +00:00
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" / >
2018-04-25 20:25:07 +00:00
< title > pylorax.treebuilder — Lorax 19.7.14 documentation< / title >
2018-03-15 21:04:29 +00:00
< link rel = "stylesheet" href = "../../_static/default.css" type = "text/css" / >
< link rel = "stylesheet" href = "../../_static/pygments.css" type = "text/css" / >
< script type = "text/javascript" >
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
2018-04-25 20:25:07 +00:00
VERSION: '19.7.14',
2018-03-15 21:04:29 +00:00
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
< / 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 >
2018-04-25 20:25:07 +00:00
< link rel = "top" title = "Lorax 19.7.14 documentation" href = "../../index.html" / >
2018-03-16 23:41:16 +00:00
< link rel = "up" title = "pylorax" href = "../pylorax.html" / >
2018-03-15 21:04:29 +00:00
< / head >
< body >
< div class = "related" >
< h3 > Navigation< / h3 >
< ul >
< li class = "right" style = "margin-right: 10px" >
< a href = "../../genindex.html" title = "General Index"
accesskey="I">index< / a > < / li >
< li class = "right" >
< a href = "../../py-modindex.html" title = "Python Module Index"
>modules< / a > |< / li >
2018-04-25 20:25:07 +00:00
< li > < a href = "../../index.html" > Lorax 19.7.14 documentation< / a > » < / li >
2018-03-16 23:41:16 +00:00
< li > < a href = "../index.html" > Module code< / a > » < / li >
< li > < a href = "../pylorax.html" accesskey = "U" > pylorax< / a > » < / li >
2018-03-15 21:04:29 +00:00
< / ul >
< / div >
< div class = "document" >
< div class = "documentwrapper" >
< div class = "bodywrapper" >
< div class = "body" >
< h1 > Source code for pylorax.treebuilder< / h1 > < div class = "highlight" > < pre >
< span class = "c" > # treebuilder.py - handle arch-specific tree building stuff using templates< / span >
< span class = "c" > #< / span >
< span class = "c" > # Copyright (C) 2011 Red Hat, Inc.< / span >
< span class = "c" > #< / span >
< span class = "c" > # This program is free software; you can redistribute it and/or modify< / span >
< span class = "c" > # it under the terms of the GNU General Public License as published by< / span >
< span class = "c" > # the Free Software Foundation; either version 2 of the License, or< / span >
< span class = "c" > # (at your option) any later version.< / span >
< span class = "c" > #< / span >
< span class = "c" > # This program is distributed in the hope that it will be useful,< / span >
< span class = "c" > # but WITHOUT ANY WARRANTY; without even the implied warranty of< / span >
< span class = "c" > # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the< / span >
< span class = "c" > # GNU General Public License for more details.< / span >
< span class = "c" > #< / span >
< span class = "c" > # You should have received a copy of the GNU General Public License< / span >
< span class = "c" > # along with this program. If not, see < http://www.gnu.org/licenses/> .< / span >
< span class = "c" > #< / span >
< span class = "c" > # Author(s): Will Woods < wwoods@redhat.com> < / span >
< span class = "kn" > import< / span > < span class = "nn" > logging< / span >
< 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 = "s" > " pylorax.treebuilder" < / span > < span class = "p" > )< / span >
< span class = "kn" > import< / span > < span class = "nn" > os< / span > < span class = "o" > ,< / span > < span class = "nn" > re< / span >
< span class = "kn" > from< / span > < span class = "nn" > os.path< / span > < span class = "kn" > import< / span > < span class = "n" > basename< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.sysutils< / span > < span class = "kn" > import< / span > < span class = "n" > joinpaths< / span > < span class = "p" > ,< / span > < span class = "n" > remove< / span >
< span class = "kn" > from< / span > < span class = "nn" > shutil< / span > < span class = "kn" > import< / span > < span class = "n" > copytree< / span > < span class = "p" > ,< / span > < span class = "n" > copy2< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.base< / span > < span class = "kn" > import< / span > < span class = "n" > DataHolder< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.ltmpl< / span > < span class = "kn" > import< / span > < span class = "n" > LoraxTemplateRunner< / span >
< span class = "kn" > import< / span > < span class = "nn" > pylorax.imgutils< / span > < span class = "kn" > as< / span > < span class = "nn" > imgutils< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.executils< / span > < span class = "kn" > import< / span > < span class = "n" > runcmd< / span > < span class = "p" > ,< / span > < span class = "n" > runcmd_output< / span >
< span class = "n" > templatemap< / span > < span class = "o" > =< / span > < span class = "p" > {< / span >
< span class = "s" > ' i386' < / span > < span class = "p" > :< / span > < span class = "s" > ' x86.tmpl' < / span > < span class = "p" > ,< / span >
< span class = "s" > ' x86_64' < / span > < span class = "p" > :< / span > < span class = "s" > ' x86.tmpl' < / span > < span class = "p" > ,< / span >
< span class = "s" > ' ppc' < / span > < span class = "p" > :< / span > < span class = "s" > ' ppc.tmpl' < / span > < span class = "p" > ,< / span >
< span class = "s" > ' ppc64' < / span > < span class = "p" > :< / span > < span class = "s" > ' ppc.tmpl' < / span > < span class = "p" > ,< / span >
< span class = "s" > ' ppc64le' < / span > < span class = "p" > :< / span > < span class = "s" > ' ppc.tmpl' < / span > < span class = "p" > ,< / span >
< span class = "s" > ' s390' < / span > < span class = "p" > :< / span > < span class = "s" > ' s390.tmpl' < / span > < span class = "p" > ,< / span >
< span class = "s" > ' s390x' < / span > < span class = "p" > :< / span > < span class = "s" > ' s390.tmpl' < / span > < span class = "p" > ,< / span >
< span class = "s" > ' aarch64' < / span > < span class = "p" > :< / span > < span class = "s" > ' aarch64.tmpl' < / span > < span class = "p" > ,< / span >
< span class = "s" > ' arm' < / span > < span class = "p" > :< / span > < span class = "s" > ' arm.tmpl' < / span > < span class = "p" > ,< / span >
< span class = "s" > ' armhfp' < / span > < span class = "p" > :< / span > < span class = "s" > ' arm.tmpl' < / span > < span class = "p" > ,< / span >
< span class = "p" > }< / span >
< div class = "viewcode-block" id = "generate_module_info" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.generate_module_info" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > generate_module_info< / span > < span class = "p" > (< / span > < span class = "n" > moddir< / span > < span class = "p" > ,< / span > < span class = "n" > outfile< / span > < span class = "o" > =< / span > < span class = "bp" > None< / span > < span class = "p" > ):< / span >
< span class = "k" > def< / span > < span class = "nf" > module_desc< / span > < span class = "p" > (< / span > < span class = "n" > mod< / span > < span class = "p" > ):< / span >
< span class = "n" > output< / span > < span class = "o" > =< / span > < span class = "n" > runcmd_output< / span > < span class = "p" > ([< / span > < span class = "s" > " modinfo" < / span > < span class = "p" > ,< / span > < span class = "s" > " -F" < / span > < span class = "p" > ,< / span > < span class = "s" > " description" < / span > < span class = "p" > ,< / span > < span class = "n" > mod< / span > < span class = "p" > ])< / span >
< span class = "k" > return< / span > < span class = "n" > output< / span > < span class = "o" > .< / span > < span class = "n" > strip< / span > < span class = "p" > ()< / span >
< span class = "k" > def< / span > < span class = "nf" > read_module_set< / span > < span class = "p" > (< / span > < span class = "n" > name< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "nb" > set< / span > < span class = "p" > (< / span > < span class = "n" > l< / span > < span class = "o" > .< / span > < span class = "n" > strip< / span > < span class = "p" > ()< / span > < span class = "k" > for< / span > < span class = "n" > l< / span > < span class = "ow" > in< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > moddir< / span > < span class = "p" > ,< / span > < span class = "n" > name< / span > < span class = "p" > ))< / span > < span class = "k" > if< / span > < span class = "s" > " .ko" < / span > < span class = "ow" > in< / span > < span class = "n" > l< / span > < span class = "p" > )< / span >
< span class = "n" > modsets< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "s" > ' scsi' < / span > < span class = "p" > :< / span > < span class = "n" > read_module_set< / span > < span class = "p" > (< / span > < span class = "s" > " modules.block" < / span > < span class = "p" > ),< / span >
< span class = "s" > ' eth' < / span > < span class = "p" > :< / span > < span class = "n" > read_module_set< / span > < span class = "p" > (< / span > < span class = "s" > " modules.networking" < / span > < span class = "p" > )}< / span >
< span class = "n" > modinfo< / span > < span class = "o" > =< / span > < span class = "nb" > list< / span > < span class = "p" > ()< / span >
< span class = "k" > for< / span > < span class = "n" > root< / span > < span class = "p" > ,< / span > < span class = "n" > _dirs< / span > < span class = "p" > ,< / span > < span class = "n" > files< / span > < span class = "ow" > in< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > walk< / span > < span class = "p" > (< / span > < span class = "n" > moddir< / span > < span class = "p" > ):< / span >
< span class = "k" > for< / span > < span class = "n" > modtype< / span > < span class = "p" > ,< / span > < span class = "n" > modset< / span > < span class = "ow" > in< / span > < span class = "n" > modsets< / span > < span class = "o" > .< / span > < span class = "n" > items< / span > < span class = "p" > ():< / span >
< span class = "k" > for< / span > < span class = "n" > mod< / span > < span class = "ow" > in< / span > < span class = "n" > modset< / span > < span class = "o" > .< / span > < span class = "n" > intersection< / span > < span class = "p" > (< / span > < span class = "n" > files< / span > < span class = "p" > ):< / span > < span class = "c" > # modules in this dir< / span >
< span class = "p" > (< / span > < span class = "n" > name< / span > < span class = "p" > ,< / span > < span class = "n" > _ext< / span > < span class = "p" > )< / 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" > splitext< / span > < span class = "p" > (< / span > < span class = "n" > mod< / span > < span class = "p" > )< / span > < span class = "c" > # foo.ko -> (foo, .ko)< / span >
< span class = "n" > desc< / span > < span class = "o" > =< / span > < span class = "n" > module_desc< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > root< / span > < span class = "p" > ,< / span > < span class = "n" > mod< / span > < span class = "p" > ))< / span > < span class = "ow" > or< / span > < span class = "s" > " < / span > < span class = "si" > %s< / span > < span class = "s" > driver" < / span > < span class = "o" > %< / span > < span class = "n" > name< / span >
< span class = "n" > modinfo< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "nb" > dict< / span > < span class = "p" > (< / span > < span class = "n" > name< / span > < span class = "o" > =< / span > < span class = "n" > name< / span > < span class = "p" > ,< / span > < span class = "nb" > type< / span > < span class = "o" > =< / span > < span class = "n" > modtype< / span > < span class = "p" > ,< / span > < span class = "n" > desc< / span > < span class = "o" > =< / span > < span class = "n" > desc< / span > < span class = "p" > ))< / span >
< span class = "n" > out< / span > < span class = "o" > =< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > outfile< / span > < span class = "ow" > or< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > moddir< / span > < span class = "p" > ,< / span > < span class = "s" > " module-info" < / span > < span class = "p" > ),< / span > < span class = "s" > " w" < / span > < span class = "p" > )< / span >
< span class = "n" > out< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s" > " Version 0< / span > < span class = "se" > \n< / span > < span class = "s" > " < / span > < span class = "p" > )< / span >
< span class = "k" > for< / span > < span class = "n" > mod< / span > < span class = "ow" > in< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "n" > modinfo< / span > < span class = "p" > ,< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "k" > lambda< / span > < span class = "n" > m< / span > < span class = "p" > :< / span > < span class = "n" > m< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s" > ' name' < / span > < span class = "p" > )):< / span >
< span class = "n" > out< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s" > ' {name}< / span > < span class = "se" > \n\t< / span > < span class = "s" > {type}< / span > < span class = "se" > \n\t< / span > < span class = "s" > " {desc:.65}" < / span > < span class = "se" > \n< / span > < span class = "s" > ' < / span > < span class = "o" > .< / span > < span class = "n" > format< / span > < span class = "p" > (< / span > < span class = "o" > **< / span > < span class = "n" > mod< / span > < span class = "p" > ))< / span >
< / div >
< div class = "viewcode-block" id = "RuntimeBuilder" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.RuntimeBuilder" > [docs]< / a > < span class = "k" > class< / span > < span class = "nc" > RuntimeBuilder< / span > < span class = "p" > (< / span > < span class = "nb" > object< / span > < span class = "p" > ):< / span >
< span class = "sd" > ' ' ' Builds the anaconda runtime image.' ' ' < / span >
< 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" > product< / span > < span class = "p" > ,< / span > < span class = "n" > arch< / span > < span class = "p" > ,< / span > < span class = "n" > yum< / span > < span class = "p" > ,< / span > < span class = "n" > templatedir< / span > < span class = "o" > =< / span > < span class = "bp" > None< / span > < span class = "p" > ,< / span >
< span class = "n" > installpkgs< / span > < span class = "o" > =< / span > < span class = "bp" > None< / span > < span class = "p" > ,< / span >
< span class = "n" > add_templates< / span > < span class = "o" > =< / span > < span class = "bp" > None< / span > < span class = "p" > ,< / span >
< span class = "n" > add_template_vars< / span > < span class = "o" > =< / span > < span class = "bp" > None< / span > < span class = "p" > ):< / span >
< span class = "n" > root< / span > < span class = "o" > =< / span > < span class = "n" > yum< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > installroot< / span >
< span class = "c" > # use a copy of product so we can modify it locally< / span >
< span class = "n" > product< / span > < span class = "o" > =< / span > < span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > copy< / span > < span class = "p" > ()< / span >
< span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "o" > =< / span > < span class = "n" > product< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ()< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > vars< / span > < span class = "o" > =< / span > < span class = "n" > DataHolder< / span > < span class = "p" > (< / span > < span class = "n" > arch< / span > < span class = "o" > =< / span > < span class = "n" > arch< / span > < span class = "p" > ,< / span > < span class = "n" > product< / span > < span class = "o" > =< / span > < span class = "n" > product< / span > < span class = "p" > ,< / span > < span class = "n" > yum< / span > < span class = "o" > =< / span > < span class = "n" > yum< / span > < span class = "p" > ,< / span > < span class = "n" > root< / span > < span class = "o" > =< / span > < span class = "n" > root< / span > < span class = "p" > ,< / span >
< span class = "n" > basearch< / 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 = "n" > libdir< / span > < span class = "o" > =< / span > < span class = "n" > arch< / span > < span class = "o" > .< / span > < span class = "n" > libdir< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > yum< / span > < span class = "o" > =< / span > < span class = "n" > yum< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _runner< / span > < span class = "o" > =< / span > < span class = "n" > LoraxTemplateRunner< / span > < span class = "p" > (< / span > < span class = "n" > inroot< / span > < span class = "o" > =< / span > < span class = "n" > root< / span > < span class = "p" > ,< / span > < span class = "n" > outroot< / span > < span class = "o" > =< / span > < span class = "n" > root< / span > < span class = "p" > ,< / span >
< span class = "n" > yum_obj< / span > < span class = "o" > =< / span > < span class = "n" > yum< / span > < span class = "p" > ,< / span > < span class = "n" > templatedir< / span > < span class = "o" > =< / span > < span class = "n" > templatedir< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > add_templates< / span > < span class = "o" > =< / span > < span class = "n" > add_templates< / span > < span class = "ow" > or< / span > < span class = "p" > []< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > add_template_vars< / span > < span class = "o" > =< / span > < span class = "n" > add_template_vars< / span > < span class = "ow" > or< / span > < span class = "p" > {}< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _installpkgs< / span > < span class = "o" > =< / span > < span class = "n" > installpkgs< / span > < span class = "ow" > or< / span > < span class = "p" > []< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _runner< / span > < span class = "o" > .< / span > < span class = "n" > defaults< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > vars< / span >
< span class = "k" > def< / span > < span class = "nf" > _install_branding< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "n" > release< / span > < span class = "o" > =< / span > < span class = "bp" > None< / span >
< span class = "k" > for< / span > < span class = "n" > pkg< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > yum< / span > < span class = "o" > .< / span > < span class = "n" > whatProvides< / span > < span class = "p" > (< / span > < span class = "s" > ' /etc/system-release' < / span > < span class = "p" > ,< / span > < span class = "bp" > None< / span > < span class = "p" > ,< / span > < span class = "bp" > None< / span > < span class = "p" > ):< / span >
< span class = "k" > if< / span > < span class = "n" > pkg< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "o" > .< / span > < span class = "n" > startswith< / span > < span class = "p" > (< / span > < span class = "s" > ' generic' < / span > < span class = "p" > ):< / span >
< span class = "k" > continue< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > release< / span > < span class = "o" > =< / span > < span class = "n" > pkg< / span > < span class = "o" > .< / span > < span class = "n" > name< / span >
< span class = "k" > break< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > release< / span > < span class = "p" > :< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s" > ' could not get the release' < / span > < span class = "p" > )< / span >
< span class = "k" > return< / span >
< span class = "c" > # release< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s" > ' got release: < / span > < span class = "si" > %s< / span > < span class = "s" > ' < / span > < span class = "p" > ,< / span > < span class = "n" > release< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _runner< / span > < span class = "o" > .< / span > < span class = "n" > installpkg< / span > < span class = "p" > (< / span > < span class = "n" > release< / span > < span class = "p" > )< / span >
< span class = "c" > # logos< / span >
< span class = "n" > release< / span > < span class = "p" > ,< / span > < span class = "n" > _suffix< / span > < span class = "o" > =< / span > < span class = "n" > release< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s" > ' -' < / 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" > _runner< / span > < span class = "o" > .< / span > < span class = "n" > installpkg< / span > < span class = "p" > (< / span > < span class = "s" > ' < / span > < span class = "si" > %s< / span > < span class = "s" > -logos' < / span > < span class = "o" > %< / span > < span class = "n" > release< / span > < span class = "p" > )< / span >
< div class = "viewcode-block" id = "RuntimeBuilder.install" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.install" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > install< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "sd" > ' ' ' Install packages and do initial setup with runtime-install.tmpl' ' ' < / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _install_branding< / span > < span class = "p" > ()< / span >
< span class = "k" > if< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _installpkgs< / span > < span class = "p" > )< / span > < span class = "o" > > < / span > < span class = "mi" > 0< / span > < span class = "p" > :< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _runner< / span > < span class = "o" > .< / span > < span class = "n" > installpkg< / span > < span class = "p" > (< / span > < span class = "o" > *< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _installpkgs< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _runner< / span > < span class = "o" > .< / span > < span class = "n" > run< / span > < span class = "p" > (< / span > < span class = "s" > " runtime-install.tmpl" < / span > < span class = "p" > )< / span >
< span class = "k" > for< / span > < span class = "n" > tmpl< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > add_templates< / span > < span class = "p" > :< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _runner< / span > < span class = "o" > .< / span > < span class = "n" > run< / span > < span class = "p" > (< / span > < span class = "n" > tmpl< / span > < span class = "p" > ,< / span > < span class = "o" > **< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > add_template_vars< / span > < span class = "p" > )< / span >
< / div >
< div class = "viewcode-block" id = "RuntimeBuilder.writepkglists" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.writepkglists" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > writepkglists< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > pkglistdir< / span > < span class = "p" > ):< / span >
< span class = "sd" > ' ' ' debugging data: write out lists of package contents' ' ' < / 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" > pkglistdir< / 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" > pkglistdir< / span > < span class = "p" > )< / span >
< span class = "k" > for< / span > < span class = "n" > pkgobj< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > yum< / span > < span class = "o" > .< / span > < span class = "n" > doPackageLists< / span > < span class = "p" > (< / span > < span class = "n" > pkgnarrow< / span > < span class = "o" > =< / span > < span class = "s" > ' installed' < / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > installed< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > pkglistdir< / span > < span class = "p" > ,< / span > < span class = "n" > pkgobj< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "p" > ),< / span > < span class = "s" > " w" < / span > < span class = "p" > )< / span > < span class = "k" > as< / span > < span class = "n" > fobj< / span > < span class = "p" > :< / span >
< span class = "k" > for< / span > < span class = "n" > fname< / span > < span class = "ow" > in< / span > < span class = "n" > pkgobj< / span > < span class = "o" > .< / span > < span class = "n" > filelist< / span > < span class = "o" > +< / span > < span class = "n" > pkgobj< / span > < span class = "o" > .< / span > < span class = "n" > dirlist< / span > < span class = "p" > :< / span >
< span class = "n" > fobj< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s" > " {0}< / span > < span class = "se" > \n< / span > < span class = "s" > " < / span > < span class = "o" > .< / span > < span class = "n" > format< / span > < span class = "p" > (< / span > < span class = "n" > fname< / span > < span class = "p" > ))< / span >
< / div >
< div class = "viewcode-block" id = "RuntimeBuilder.postinstall" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.postinstall" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > postinstall< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "sd" > ' ' ' Do some post-install setup work with runtime-postinstall.tmpl' ' ' < / span >
< span class = "c" > # copy configdir into runtime root beforehand< / span >
< span class = "n" > configdir< / 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" > _runner< / span > < span class = "o" > .< / span > < span class = "n" > templatedir< / span > < span class = "p" > ,< / span > < span class = "s" > " config_files" < / span > < span class = "p" > )< / span >
< span class = "n" > configdir_path< / span > < span class = "o" > =< / span > < span class = "s" > " tmp/config_files" < / span >
< span class = "n" > fullpath< / 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" > vars< / span > < span class = "o" > .< / span > < span class = "n" > root< / span > < span class = "p" > ,< / span > < span class = "n" > configdir_path< / span > < span class = "p" > )< / span >
< 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" > exists< / span > < span class = "p" > (< / span > < span class = "n" > fullpath< / span > < span class = "p" > ):< / span >
< span class = "n" > remove< / span > < span class = "p" > (< / span > < span class = "n" > fullpath< / span > < span class = "p" > )< / span >
< span class = "n" > copytree< / span > < span class = "p" > (< / span > < span class = "n" > configdir< / span > < span class = "p" > ,< / span > < span class = "n" > fullpath< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _runner< / span > < span class = "o" > .< / span > < span class = "n" > run< / span > < span class = "p" > (< / span > < span class = "s" > " runtime-postinstall.tmpl" < / span > < span class = "p" > ,< / span > < span class = "n" > configdir< / span > < span class = "o" > =< / span > < span class = "n" > configdir_path< / span > < span class = "p" > )< / span >
< / div >
< div class = "viewcode-block" id = "RuntimeBuilder.cleanup" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.cleanup" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > cleanup< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "sd" > ' ' ' Remove unneeded packages and files with runtime-cleanup.tmpl' ' ' < / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _runner< / span > < span class = "o" > .< / span > < span class = "n" > run< / span > < span class = "p" > (< / span > < span class = "s" > " runtime-cleanup.tmpl" < / span > < span class = "p" > )< / span >
< / div >
< div class = "viewcode-block" id = "RuntimeBuilder.writepkgsizes" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.writepkgsizes" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > writepkgsizes< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > pkgsizefile< / span > < span class = "p" > ):< / span >
< span class = "sd" > ' ' ' debugging data: write a big list of pkg sizes' ' ' < / span >
< span class = "n" > fobj< / span > < span class = "o" > =< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > pkgsizefile< / span > < span class = "p" > ,< / span > < span class = "s" > " w" < / span > < span class = "p" > )< / span >
< span class = "n" > getsize< / span > < span class = "o" > =< / span > < span class = "k" > lambda< / span > < span class = "n" > f< / span > < span class = "p" > :< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > lstat< / span > < span class = "p" > (< / span > < span class = "n" > f< / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > st_size< / span > < 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" > exists< / span > < span class = "p" > (< / span > < span class = "n" > f< / span > < span class = "p" > )< / span > < span class = "k" > else< / span > < span class = "mi" > 0< / span >
< span class = "k" > for< / span > < span class = "n" > p< / span > < span class = "ow" > in< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > yum< / span > < span class = "o" > .< / span > < span class = "n" > doPackageLists< / span > < span class = "p" > (< / span > < span class = "n" > pkgnarrow< / span > < span class = "o" > =< / span > < span class = "s" > ' installed' < / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > installed< / span > < span class = "p" > ):< / span >
< span class = "n" > pkgsize< / span > < span class = "o" > =< / span > < span class = "nb" > sum< / span > < span class = "p" > (< / span > < span class = "n" > getsize< / 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" > vars< / span > < span class = "o" > .< / span > < span class = "n" > root< / span > < span class = "p" > ,< / span > < span class = "n" > f< / span > < span class = "p" > ))< / span > < span class = "k" > for< / span > < span class = "n" > f< / span > < span class = "ow" > in< / span > < span class = "n" > p< / span > < span class = "o" > .< / span > < span class = "n" > filelist< / span > < span class = "p" > )< / span >
< span class = "n" > fobj< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s" > " {0.name}.{0.arch}: {1}< / span > < span class = "se" > \n< / span > < span class = "s" > " < / span > < span class = "o" > .< / span > < span class = "n" > format< / span > < span class = "p" > (< / span > < span class = "n" > p< / span > < span class = "p" > ,< / span > < span class = "n" > pkgsize< / span > < span class = "p" > ))< / span >
< / div >
< div class = "viewcode-block" id = "RuntimeBuilder.generate_module_data" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.generate_module_data" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > generate_module_data< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "n" > root< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > vars< / span > < span class = "o" > .< / span > < span class = "n" > root< / span >
< span class = "n" > moddir< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > root< / span > < span class = "p" > ,< / span > < span class = "s" > " lib/modules/" < / span > < span class = "p" > )< / span >
< span class = "k" > for< / span > < span class = "n" > kver< / span > < span class = "ow" > in< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > listdir< / span > < span class = "p" > (< / span > < span class = "n" > moddir< / span > < span class = "p" > ):< / span >
< span class = "n" > ksyms< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > root< / span > < span class = "p" > ,< / span > < span class = "s" > " boot/System.map-< / span > < span class = "si" > %s< / span > < span class = "s" > " < / span > < span class = "o" > %< / span > < span class = "n" > kver< / 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 = "s" > " doing depmod and module-info for < / span > < span class = "si" > %s< / span > < span class = "s" > " < / span > < span class = "p" > ,< / span > < span class = "n" > kver< / span > < span class = "p" > )< / span >
< span class = "n" > runcmd< / span > < span class = "p" > ([< / span > < span class = "s" > " depmod" < / span > < span class = "p" > ,< / span > < span class = "s" > " -a" < / span > < span class = "p" > ,< / span > < span class = "s" > " -F" < / span > < span class = "p" > ,< / span > < span class = "n" > ksyms< / span > < span class = "p" > ,< / span > < span class = "s" > " -b" < / span > < span class = "p" > ,< / span > < span class = "n" > root< / span > < span class = "p" > ,< / span > < span class = "n" > kver< / span > < span class = "p" > ])< / span >
< span class = "n" > generate_module_info< / span > < span class = "p" > (< / span > < span class = "n" > moddir< / span > < span class = "o" > +< / span > < span class = "n" > kver< / span > < span class = "p" > ,< / span > < span class = "n" > outfile< / span > < span class = "o" > =< / span > < span class = "n" > moddir< / span > < span class = "o" > +< / span > < span class = "s" > " module-info" < / span > < span class = "p" > )< / span >
< / div >
< div class = "viewcode-block" id = "RuntimeBuilder.create_runtime" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.create_runtime" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > create_runtime< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > outfile< / span > < span class = "o" > =< / span > < span class = "s" > " /var/tmp/squashfs.img" < / span > < span class = "p" > ,< / span > < span class = "n" > compression< / span > < span class = "o" > =< / span > < span class = "s" > " xz" < / span > < span class = "p" > ,< / span > < span class = "n" > compressargs< / span > < span class = "o" > =< / span > < span class = "bp" > None< / span > < span class = "p" > ,< / span > < span class = "n" > size< / span > < span class = "o" > =< / span > < span class = "mi" > 2< / span > < span class = "p" > ):< / span >
< span class = "k" > if< / span > < span class = "n" > compressargs< / span > < span class = "ow" > is< / span > < span class = "bp" > None< / span > < span class = "p" > :< / span >
< span class = "n" > compressargs< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "c" > # make live rootfs image - must be named " LiveOS/rootfs.img" for dracut< / span >
< span class = "n" > workdir< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / 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" > outfile< / span > < span class = "p" > ),< / span > < span class = "s" > " runtime-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 = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > workdir< / span > < span class = "p" > ,< / span > < span class = "s" > " LiveOS" < / span > < span class = "p" > ))< / span >
< span class = "n" > imgutils< / span > < span class = "o" > .< / span > < span class = "n" > mkrootfsimg< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > vars< / span > < span class = "o" > .< / span > < span class = "n" > root< / span > < span class = "p" > ,< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > workdir< / span > < span class = "p" > ,< / span > < span class = "s" > " LiveOS/rootfs.img" < / span > < span class = "p" > ),< / span >
< span class = "s" > " Anaconda" < / 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 = "c" > # squash the live rootfs and clean up workdir< / span >
< span class = "n" > imgutils< / span > < span class = "o" > .< / span > < span class = "n" > mksquashfs< / span > < span class = "p" > (< / span > < span class = "n" > workdir< / span > < span class = "p" > ,< / span > < span class = "n" > outfile< / span > < span class = "p" > ,< / span > < span class = "n" > compression< / span > < span class = "p" > ,< / span > < span class = "n" > compressargs< / span > < span class = "p" > )< / span >
< span class = "n" > remove< / span > < span class = "p" > (< / span > < span class = "n" > workdir< / span > < span class = "p" > )< / span >
< / div > < / div >
< div class = "viewcode-block" id = "TreeBuilder" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.TreeBuilder" > [docs]< / a > < span class = "k" > class< / span > < span class = "nc" > TreeBuilder< / span > < span class = "p" > (< / span > < span class = "nb" > object< / span > < span class = "p" > ):< / span >
< span class = "sd" > ' ' ' Builds the arch-specific boot images.< / span >
< span class = "sd" > inroot should be the installtree root (the newly-built runtime dir)' ' ' < / span >
< 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" > product< / span > < span class = "p" > ,< / span > < span class = "n" > arch< / span > < span class = "p" > ,< / span > < span class = "n" > inroot< / span > < span class = "p" > ,< / span > < span class = "n" > outroot< / span > < span class = "p" > ,< / span > < span class = "n" > runtime< / span > < span class = "p" > ,< / span > < span class = "n" > isolabel< / span > < span class = "p" > ,< / span > < span class = "n" > domacboot< / span > < span class = "o" > =< / span > < span class = "bp" > False< / span > < span class = "p" > ,< / span > < span class = "n" > doupgrade< / span > < span class = "o" > =< / span > < span class = "bp" > True< / span > < span class = "p" > ,< / span > < span class = "n" > templatedir< / span > < span class = "o" > =< / span > < span class = "bp" > None< / span > < span class = "p" > ,< / span > < span class = "n" > add_templates< / span > < span class = "o" > =< / span > < span class = "bp" > None< / span > < span class = "p" > ,< / span > < span class = "n" > add_template_vars< / span > < span class = "o" > =< / span > < span class = "bp" > None< / span > < span class = "p" > ,< / span > < span class = "n" > workdir< / span > < span class = "o" > =< / span > < span class = "bp" > None< / span > < span class = "p" > ):< / span >
< span class = "c" > # NOTE: if you pass an arg named " runtime" to a mako template it' ll< / span >
< span class = "c" > # clobber some mako internal variables - hence " runtime_img" .< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > vars< / span > < span class = "o" > =< / span > < span class = "n" > DataHolder< / span > < span class = "p" > (< / span > < span class = "n" > arch< / span > < span class = "o" > =< / span > < span class = "n" > arch< / span > < span class = "p" > ,< / span > < span class = "n" > product< / span > < span class = "o" > =< / span > < span class = "n" > product< / span > < span class = "p" > ,< / span > < span class = "n" > runtime_img< / span > < span class = "o" > =< / span > < span class = "n" > runtime< / span > < span class = "p" > ,< / span >
< span class = "n" > runtime_base< / span > < span class = "o" > =< / span > < span class = "n" > basename< / span > < span class = "p" > (< / span > < span class = "n" > runtime< / span > < span class = "p" > ),< / span >
< span class = "n" > inroot< / span > < span class = "o" > =< / span > < span class = "n" > inroot< / span > < span class = "p" > ,< / span > < span class = "n" > outroot< / span > < span class = "o" > =< / span > < span class = "n" > outroot< / span > < span class = "p" > ,< / span >
< span class = "n" > basearch< / 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 = "n" > libdir< / span > < span class = "o" > =< / span > < span class = "n" > arch< / span > < span class = "o" > .< / span > < span class = "n" > libdir< / 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" > udev< / span > < span class = "o" > =< / span > < span class = "n" > udev_escape< / 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 >
< span class = "n" > workdir< / span > < span class = "o" > =< / span > < span class = "n" > workdir< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _runner< / span > < span class = "o" > =< / span > < span class = "n" > LoraxTemplateRunner< / span > < span class = "p" > (< / span > < span class = "n" > inroot< / span > < span class = "p" > ,< / span > < span class = "n" > outroot< / span > < span class = "p" > ,< / span > < span class = "n" > templatedir< / span > < span class = "o" > =< / span > < span class = "n" > templatedir< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _runner< / span > < span class = "o" > .< / span > < span class = "n" > defaults< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > vars< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > add_templates< / span > < span class = "o" > =< / span > < span class = "n" > add_templates< / span > < span class = "ow" > or< / span > < span class = "p" > []< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > add_template_vars< / span > < span class = "o" > =< / span > < span class = "n" > add_template_vars< / span > < span class = "ow" > or< / span > < span class = "p" > {}< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > templatedir< / span > < span class = "o" > =< / span > < span class = "n" > templatedir< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > treeinfo_data< / span > < span class = "o" > =< / span > < span class = "bp" > None< / span >
< span class = "nd" > @property< / span >
< div class = "viewcode-block" id = "TreeBuilder.kernels" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.TreeBuilder.kernels" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > kernels< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "n" > findkernels< / span > < span class = "p" > (< / span > < span class = "n" > root< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > vars< / span > < span class = "o" > .< / span > < span class = "n" > inroot< / span > < span class = "p" > )< / span >
< / div >
< div class = "viewcode-block" id = "TreeBuilder.rebuild_initrds" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.TreeBuilder.rebuild_initrds" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > rebuild_initrds< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > add_args< / span > < span class = "o" > =< / span > < span class = "bp" > None< / span > < span class = "p" > ,< / span > < span class = "n" > backup< / span > < span class = "o" > =< / span > < span class = "s" > " " < / span > < span class = "p" > ,< / span > < span class = "n" > prefix< / span > < span class = "o" > =< / span > < span class = "s" > " " < / span > < span class = "p" > ):< / span >
< span class = "sd" > ' ' ' Rebuild all the initrds in the tree. If backup is specified, each< / span >
< span class = "sd" > initrd will be renamed with backup as a suffix before rebuilding.< / span >
< span class = "sd" > If backup is empty, the existing initrd files will be overwritten.< / span >
< span class = "sd" > If suffix is specified, the existing initrd is untouched and a new< / span >
< span class = "sd" > image is built with the filename " ${prefix}-${kernel.version}.img" < / span >
< span class = "sd" > ' ' ' < / span >
< span class = "k" > if< / span > < span class = "n" > add_args< / span > < span class = "ow" > is< / span > < span class = "bp" > None< / span > < span class = "p" > :< / span >
< span class = "n" > add_args< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "n" > dracut< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s" > " dracut" < / span > < span class = "p" > ,< / span > < span class = "s" > " --nomdadmconf" < / span > < span class = "p" > ,< / span > < span class = "s" > " --nolvmconf" < / span > < span class = "p" > ]< / span > < span class = "o" > +< / span > < span class = "n" > add_args< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > backup< / span > < span class = "p" > :< / span >
< span class = "n" > dracut< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s" > " --force" < / span > < span class = "p" > )< / span >
< span class = "n" > kernels< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "n" > kernel< / span > < span class = "k" > for< / span > < span class = "n" > kernel< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > kernels< / span > < span class = "k" > if< / span > < span class = "nb" > hasattr< / span > < span class = "p" > (< / span > < span class = "n" > kernel< / span > < span class = "p" > ,< / span > < span class = "s" > " initrd" < / span > < span class = "p" > )]< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > kernels< / span > < span class = "p" > :< / span >
< span class = "k" > raise< / span > < span class = "ne" > Exception< / span > < span class = "p" > (< / span > < span class = "s" > " No initrds found, cannot rebuild_initrds" < / span > < span class = "p" > )< / span >
< span class = "c" > # Hush some dracut warnings. TODO: bind-mount proc in place?< / span >
< span class = "nb" > open< / 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" > vars< / span > < span class = "o" > .< / span > < span class = "n" > inroot< / span > < span class = "p" > ,< / span > < span class = "s" > " /proc/modules" < / span > < span class = "p" > ),< / span > < span class = "s" > " w" < / span > < span class = "p" > )< / span >
< span class = "k" > for< / span > < span class = "n" > kernel< / span > < span class = "ow" > in< / span > < span class = "n" > kernels< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > prefix< / span > < span class = "p" > :< / span >
< span class = "n" > idir< / 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" > dirname< / span > < span class = "p" > (< / span > < span class = "n" > kernel< / span > < span class = "o" > .< / span > < span class = "n" > initrd< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "p" > )< / span >
< span class = "n" > outfile< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > idir< / span > < span class = "p" > ,< / span > < span class = "n" > prefix< / span > < span class = "o" > +< / span > < span class = "s" > ' -' < / span > < span class = "o" > +< / span > < span class = "n" > kernel< / span > < span class = "o" > .< / span > < span class = "n" > version< / span > < span class = "o" > +< / span > < span class = "s" > ' .img' < / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > outfile< / span > < span class = "o" > =< / span > < span class = "n" > kernel< / span > < span class = "o" > .< / span > < span class = "n" > initrd< / span > < span class = "o" > .< / span > < span class = "n" > path< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s" > " rebuilding < / span > < span class = "si" > %s< / span > < span class = "s" > " < / span > < span class = "p" > ,< / span > < span class = "n" > outfile< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > backup< / span > < span class = "p" > :< / span >
< span class = "n" > initrd< / 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" > vars< / span > < span class = "o" > .< / span > < span class = "n" > inroot< / span > < span class = "p" > ,< / span > < span class = "n" > outfile< / span > < span class = "p" > )< / span >
< span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > rename< / span > < span class = "p" > (< / span > < span class = "n" > initrd< / span > < span class = "p" > ,< / span > < span class = "n" > initrd< / span > < span class = "o" > +< / span > < span class = "n" > backup< / span > < span class = "p" > )< / span >
< span class = "n" > cmd< / span > < span class = "o" > =< / span > < span class = "n" > dracut< / span > < span class = "o" > +< / span > < span class = "p" > [< / span > < span class = "n" > outfile< / span > < span class = "p" > ,< / span > < span class = "n" > kernel< / span > < span class = "o" > .< / span > < span class = "n" > version< / span > < span class = "p" > ]< / span >
< span class = "n" > runcmd< / span > < span class = "p" > (< / span > < span class = "n" > cmd< / span > < span class = "p" > ,< / span > < span class = "n" > root< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > vars< / span > < span class = "o" > .< / span > < span class = "n" > inroot< / span > < span class = "p" > )< / span >
< span class = "c" > # ppc64 cannot boot images > 32MiB, check size and warn< / span >
< span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > vars< / 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 = "s" > " ppc64" < / span > < span class = "p" > ,< / span > < span class = "s" > " ppc64le" < / span > < span class = "p" > )< / span > < span class = "ow" > and< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > exists< / span > < span class = "p" > (< / span > < span class = "n" > outfile< / span > < span class = "p" > ):< / span >
< span class = "n" > st< / span > < span class = "o" > =< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > stat< / span > < span class = "p" > (< / span > < span class = "n" > outfile< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > st< / span > < span class = "o" > .< / span > < span class = "n" > st_size< / span > < span class = "o" > > < / span > < span class = "mi" > 32< / span > < span class = "o" > *< / span > < span class = "mi" > 1024< / span > < span class = "o" > *< / span > < span class = "mi" > 1024< / span > < span class = "p" > :< / span >
< span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > warning< / span > < span class = "p" > (< / span > < span class = "s" > " ppc64 initrd < / span > < span class = "si" > %s< / span > < span class = "s" > is > 32MiB" < / span > < span class = "p" > ,< / span > < span class = "n" > outfile< / span > < span class = "p" > )< / span >
< span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > unlink< / 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" > vars< / span > < span class = "o" > .< / span > < span class = "n" > inroot< / span > < span class = "p" > ,< / span > < span class = "s" > " /proc/modules" < / span > < span class = "p" > ))< / span >
< / div >
< div class = "viewcode-block" id = "TreeBuilder.build" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.TreeBuilder.build" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > build< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "n" > templatefile< / span > < span class = "o" > =< / span > < span class = "n" > templatemap< / span > < span class = "p" > [< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > vars< / 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" > tmpl< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > add_templates< / span > < span class = "p" > :< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _runner< / span > < span class = "o" > .< / span > < span class = "n" > run< / span > < span class = "p" > (< / span > < span class = "n" > tmpl< / span > < span class = "p" > ,< / span > < span class = "o" > **< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > add_template_vars< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _runner< / span > < span class = "o" > .< / span > < span class = "n" > run< / span > < span class = "p" > (< / span > < span class = "n" > templatefile< / span > < span class = "p" > ,< / span > < span class = "n" > kernels< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > kernels< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > treeinfo_data< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _runner< / span > < span class = "o" > .< / span > < span class = "n" > results< / span > < span class = "o" > .< / span > < span class = "n" > treeinfo< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > implantisomd5< / span > < span class = "p" > ()< / span >
< / div >
< div class = "viewcode-block" id = "TreeBuilder.implantisomd5" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.TreeBuilder.implantisomd5" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > implantisomd5< / span > < span class = "p" > (< / span > < span class = "bp" > self< / 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 = "bp" > self< / 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 = "k" > if< / span > < span class = "s" > ' boot.iso' < / span > < span class = "ow" > in< / span > < span class = "n" > data< / span > < span class = "p" > :< / span >
< span class = "n" > iso< / 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" > vars< / span > < span class = "o" > .< / span > < span class = "n" > outroot< / span > < span class = "p" > ,< / span > < span class = "n" > data< / span > < span class = "p" > [< / span > < span class = "s" > ' boot.iso' < / span > < span class = "p" > ])< / span >
< span class = "n" > runcmd< / span > < span class = "p" > ([< / span > < span class = "s" > " implantisomd5" < / span > < span class = "p" > ,< / span > < span class = "n" > iso< / span > < span class = "p" > ])< / span >
< / div >
< span class = "nd" > @property< / span >
< div class = "viewcode-block" id = "TreeBuilder.dracut_hooks_path" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.TreeBuilder.dracut_hooks_path" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > dracut_hooks_path< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the path to the lorax dracut hooks scripts< / span >
< span class = "sd" > Use the configured share dir if it is setup,< / span >
< span class = "sd" > otherwise default to /usr/share/lorax/dracut_hooks< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > templatedir< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > templatedir< / span > < span class = "p" > ,< / span > < span class = "s" > " dracut_hooks" < / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "s" > " /usr/share/lorax/dracut_hooks" < / span >
< / div >
< div class = "viewcode-block" id = "TreeBuilder.copy_dracut_hooks" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.TreeBuilder.copy_dracut_hooks" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > copy_dracut_hooks< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > hooks< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Copy the hook scripts in hooks into the installroot' s /tmp/< / span >
< span class = "sd" > and return a list of commands to pass to dracut when creating the< / span >
< span class = "sd" > initramfs< / span >
< span class = "sd" > hooks is a list of tuples with the name of the hook script and the< / span >
< span class = "sd" > target dracut hook directory< / span >
< span class = "sd" > (eg. [(" 99anaconda-copy-ks.sh" , " /lib/dracut/hooks/pre-pivot" )])< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > dracut_commands< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > for< / span > < span class = "n" > hook_script< / span > < span class = "p" > ,< / span > < span class = "n" > dracut_path< / span > < span class = "ow" > in< / span > < span class = "n" > hooks< / span > < span class = "p" > :< / span >
< span class = "n" > src< / 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" > dracut_hooks_path< / span > < span class = "p" > ,< / span > < span class = "n" > hook_script< / span > < span class = "p" > )< / 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" > exists< / span > < span class = "p" > (< / span > < span class = "n" > src< / span > < span class = "p" > ):< / span >
< span class = "n" > logger< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s" > " Missing lorax dracut hook script < / span > < span class = "si" > %s< / span > < span class = "s" > " < / span > < span class = "p" > ,< / span > < span class = "n" > src< / span > < span class = "p" > )< / span >
< span class = "k" > continue< / span >
< span class = "n" > dst< / 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" > vars< / span > < span class = "o" > .< / span > < span class = "n" > inroot< / span > < span class = "p" > ,< / span > < span class = "s" > " /tmp/" < / span > < span class = "p" > ,< / span > < span class = "n" > hook_script< / span > < span class = "p" > )< / span >
< span class = "n" > copy2< / span > < span class = "p" > (< / span > < span class = "n" > src< / span > < span class = "p" > ,< / span > < span class = "n" > dst< / span > < span class = "p" > )< / span >
< span class = "n" > dracut_commands< / span > < span class = "o" > +=< / span > < span class = "p" > [< / span > < span class = "s" > " --include" < / span > < span class = "p" > ,< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "s" > " /tmp/" < / span > < span class = "p" > ,< / span > < span class = "n" > hook_script< / span > < span class = "p" > ),< / span >
< span class = "n" > dracut_path< / span > < span class = "p" > ]< / span >
< span class = "k" > return< / span > < span class = "n" > dracut_commands< / span >
< span class = "c" > #### TreeBuilder helper functions< / span >
< / div > < / div >
< div class = "viewcode-block" id = "findkernels" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.findkernels" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > findkernels< / span > < span class = "p" > (< / span > < span class = "n" > root< / span > < span class = "o" > =< / span > < span class = "s" > " /" < / span > < span class = "p" > ,< / span > < span class = "n" > kdir< / span > < span class = "o" > =< / span > < span class = "s" > " boot" < / span > < span class = "p" > ):< / span >
< span class = "c" > # To find possible flavors, awk ' /BuildKernel/ { print $4 }' kernel.spec< / span >
< span class = "n" > flavors< / span > < span class = "o" > =< / span > < span class = "p" > (< / span > < span class = "s" > ' debug' < / span > < span class = "p" > ,< / span > < span class = "s" > ' PAE' < / span > < span class = "p" > ,< / span > < span class = "s" > ' PAEdebug' < / span > < span class = "p" > ,< / span > < span class = "s" > ' smp' < / span > < span class = "p" > ,< / span > < span class = "s" > ' xen' < / span > < span class = "p" > ,< / span > < span class = "s" > ' lpae' < / span > < span class = "p" > ,< / span > < span class = "s" > ' tegra' < / span > < span class = "p" > )< / span >
< span class = "n" > kre< / span > < span class = "o" > =< / span > < span class = "n" > re< / span > < span class = "o" > .< / span > < span class = "n" > compile< / span > < span class = "p" > (< / span > < span class = "s" > r" vmlinuz-(?P< version> .+?\.(?P< arch> [a-z0-9_]+)" < / span >
< span class = "s" > r" (\.(?P< flavor> {0}))?)$" < / span > < span class = "o" > .< / span > < span class = "n" > format< / span > < span class = "p" > (< / span > < span class = "s" > " |" < / span > < span class = "o" > .< / span > < span class = "n" > join< / span > < span class = "p" > (< / span > < span class = "n" > flavors< / span > < span class = "p" > )))< / span >
< span class = "n" > kernels< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "n" > bootfiles< / span > < span class = "o" > =< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > listdir< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > root< / span > < span class = "p" > ,< / span > < span class = "n" > kdir< / span > < span class = "p" > ))< / span >
< span class = "k" > for< / span > < span class = "n" > f< / span > < span class = "ow" > in< / span > < span class = "n" > bootfiles< / span > < span class = "p" > :< / span >
< span class = "n" > match< / span > < span class = "o" > =< / span > < span class = "n" > kre< / span > < span class = "o" > .< / span > < span class = "n" > match< / span > < span class = "p" > (< / span > < span class = "n" > f< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > match< / span > < span class = "p" > :< / span >
< span class = "n" > kernel< / span > < span class = "o" > =< / span > < span class = "n" > DataHolder< / span > < span class = "p" > (< / span > < span class = "n" > path< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > kdir< / span > < span class = "p" > ,< / span > < span class = "n" > f< / span > < span class = "p" > ))< / span >
< span class = "n" > kernel< / span > < span class = "o" > .< / span > < span class = "n" > update< / span > < span class = "p" > (< / span > < span class = "n" > match< / span > < span class = "o" > .< / span > < span class = "n" > groupdict< / span > < span class = "p" > ())< / span > < span class = "c" > # sets version, arch, flavor< / span >
< span class = "n" > kernels< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "n" > kernel< / span > < span class = "p" > )< / span >
< span class = "c" > # look for associated initrd/initramfs/etc.< / span >
< span class = "k" > for< / span > < span class = "n" > kernel< / span > < span class = "ow" > in< / span > < span class = "n" > kernels< / span > < span class = "p" > :< / span >
< span class = "k" > for< / span > < span class = "n" > f< / span > < span class = "ow" > in< / span > < span class = "n" > bootfiles< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > endswith< / span > < span class = "p" > (< / span > < span class = "s" > ' -' < / span > < span class = "o" > +< / span > < span class = "n" > kernel< / span > < span class = "o" > .< / span > < span class = "n" > version< / span > < span class = "o" > +< / span > < span class = "s" > ' .img' < / span > < span class = "p" > ):< / span >
< span class = "n" > imgtype< / span > < span class = "p" > ,< / span > < span class = "n" > _rest< / span > < span class = "o" > =< / span > < span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s" > ' -' < / span > < span class = "p" > ,< / span > < span class = "mi" > 1< / span > < span class = "p" > )< / span >
< span class = "c" > # special backwards-compat case< / span >
< span class = "k" > if< / span > < span class = "n" > imgtype< / span > < span class = "o" > ==< / span > < span class = "s" > ' initramfs' < / span > < span class = "p" > :< / span >
< span class = "n" > imgtype< / span > < span class = "o" > =< / span > < span class = "s" > ' initrd' < / span >
< span class = "n" > kernel< / span > < span class = "p" > [< / span > < span class = "n" > imgtype< / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "n" > DataHolder< / span > < span class = "p" > (< / span > < span class = "n" > path< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > kdir< / span > < span class = "p" > ,< / span > < span class = "n" > f< / 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 = "s" > " kernels=< / span > < span class = "si" > %s< / span > < span class = "s" > " < / span > < span class = "p" > ,< / span > < span class = "n" > kernels< / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > kernels< / span >
< span class = "c" > # udev whitelist: ' a-zA-Z0-9#+.:=@_-' (see is_whitelisted in libudev-util.c)< / span > < / div >
< span class = "n" > udev_blacklist< / span > < span class = "o" > =< / span > < span class = "s" > ' !" $%& < / span > < span class = "se" > \' < / span > < span class = "s" > ()*,/;< > ?[< / span > < span class = "se" > \\< / span > < span class = "s" > ]^`{|}~' < / span > < span class = "c" > # ASCII printable, minus whitelist< / span >
< span class = "n" > udev_blacklist< / span > < span class = "o" > +=< / span > < span class = "s" > ' ' < / span > < span class = "o" > .< / span > < span class = "n" > join< / span > < span class = "p" > (< / span > < span class = "nb" > chr< / span > < span class = "p" > (< / span > < span class = "n" > i< / span > < span class = "p" > )< / span > < span class = "k" > for< / span > < span class = "n" > i< / span > < span class = "ow" > in< / span > < span class = "nb" > range< / span > < span class = "p" > (< / span > < span class = "mi" > 32< / span > < span class = "p" > ))< / span > < span class = "c" > # ASCII non-printable< / span >
< div class = "viewcode-block" id = "udev_escape" > < a class = "viewcode-back" href = "../../pylorax.html#pylorax.treebuilder.udev_escape" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > udev_escape< / span > < span class = "p" > (< / span > < span class = "n" > label< / span > < span class = "p" > ):< / span >
< span class = "n" > out< / span > < span class = "o" > =< / span > < span class = "s" > u' ' < / span >
< span class = "k" > for< / span > < span class = "n" > ch< / span > < span class = "ow" > in< / span > < span class = "n" > label< / span > < span class = "o" > .< / span > < span class = "n" > decode< / span > < span class = "p" > (< / span > < span class = "s" > ' utf8' < / span > < span class = "p" > ):< / span >
< span class = "n" > out< / span > < span class = "o" > +=< / span > < span class = "n" > ch< / span > < span class = "k" > if< / span > < span class = "n" > ch< / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > udev_blacklist< / span > < span class = "k" > else< / span > < span class = "s" > u' < / span > < span class = "se" > \\< / span > < span class = "s" > x< / span > < span class = "si" > %02x< / span > < span class = "s" > ' < / span > < span class = "o" > %< / span > < span class = "nb" > ord< / span > < span class = "p" > (< / span > < span class = "n" > ch< / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > out< / span > < span class = "o" > .< / span > < span class = "n" > encode< / span > < span class = "p" > (< / span > < span class = "s" > ' utf8' < / span > < span class = "p" > )< / span > < / div >
< / pre > < / div >
< / div >
< / div >
< / div >
< div class = "sphinxsidebar" >
< div class = "sphinxsidebarwrapper" >
< div id = "searchbox" style = "display: none" >
< h3 > Quick search< / h3 >
< form class = "search" action = "../../search.html" method = "get" >
< input type = "text" name = "q" / >
< input type = "submit" value = "Go" / >
< input type = "hidden" name = "check_keywords" value = "yes" / >
< input type = "hidden" name = "area" value = "default" / >
< / form >
< p class = "searchtip" style = "font-size: 90%" >
Enter search terms or a module, class or function name.
< / p >
< / div >
< script type = "text/javascript" > $ ( '#searchbox' ) . show ( 0 ) ; < / script >
< / div >
< / div >
< div class = "clearer" > < / div >
< / div >
< div class = "related" >
< h3 > Navigation< / h3 >
< ul >
< li class = "right" style = "margin-right: 10px" >
< a href = "../../genindex.html" title = "General Index"
>index< / a > < / li >
< li class = "right" >
< a href = "../../py-modindex.html" title = "Python Module Index"
>modules< / a > |< / li >
2018-04-25 20:25:07 +00:00
< li > < a href = "../../index.html" > Lorax 19.7.14 documentation< / a > » < / li >
2018-03-16 23:41:16 +00:00
< li > < a href = "../index.html" > Module code< / a > » < / li >
< li > < a href = "../pylorax.html" > pylorax< / a > » < / li >
2018-03-15 21:04:29 +00:00
< / ul >
< / div >
< div class = "footer" >
2018-03-16 23:41:16 +00:00
© Copyright 2018, Red Hat, Inc..
2018-03-15 21:04:29 +00:00
Created using < a href = "http://sphinx.pocoo.org/" > Sphinx< / a > 1.1.3.
< / div >
< / body >
< / html >