Add the pedantic option
By default copy file errors are ignored, when pedantic is set to True, they result in an exception.
This commit is contained in:
parent
f0052a980b
commit
01a1f80b79
@ -74,6 +74,8 @@ def main(args):
|
||||
|
||||
# lorax settings
|
||||
settings = OptionGroup(parser, "lorax settings")
|
||||
settings.add_option("--pedantic", help="don't ignore copy errors",
|
||||
action="store_true", default=False)
|
||||
settings.add_option("-c", "--cleanup", help="clean up on exit",
|
||||
action="store_true", default=False)
|
||||
|
||||
@ -123,6 +125,8 @@ def main(args):
|
||||
config.encoding = opts.encoding
|
||||
config.debug = opts.debug
|
||||
|
||||
config.pedantic = opts.pedantic
|
||||
|
||||
# run lorax
|
||||
params = {"installtree": installtree,
|
||||
"outputdir": opts.outputdir,
|
||||
|
@ -130,7 +130,8 @@ class BaseImageClass(BaseLoraxClass):
|
||||
if dstdir:
|
||||
makedirs_(os.path.join(self.dsttree, dstdir))
|
||||
|
||||
dcopy_(fname, dstdir, self.srctree, self.dsttree)
|
||||
dcopy_(fname, dstdir, self.srctree, self.dsttree,
|
||||
ignore_errors=not self.conf.pedantic)
|
||||
|
||||
def rename(self, fname, target):
|
||||
fname = os.path.join(self.dsttree, fname)
|
||||
|
@ -30,7 +30,9 @@ class LoraxConfig(object):
|
||||
# output settings
|
||||
self.colors = True
|
||||
self.encoding = "utf-8"
|
||||
self.debug = False
|
||||
self.debug = True
|
||||
|
||||
self.pedantic = False
|
||||
|
||||
self.confdir = "/etc/lorax"
|
||||
self.datadir = "/usr/share/lorax"
|
||||
|
@ -806,12 +806,14 @@ class Install(BaseImageClass):
|
||||
def move_bins(self):
|
||||
# move bin to usr/bin
|
||||
scopy_(src_root=self.srctree, src_path="bin/*",
|
||||
dst_root=self.srctree, dst_path="usr/bin")
|
||||
dst_root=self.srctree, dst_path="usr/bin",
|
||||
ignore_errors=not self.conf.pedantic)
|
||||
remove_(os.path.join(self.srctree, "bin"))
|
||||
|
||||
# move sbin to /usr/sbin
|
||||
scopy_(src_root=self.srctree, src_path="sbin/*",
|
||||
dst_root=self.srctree, dst_path="usr/sbin")
|
||||
dst_root=self.srctree, dst_path="usr/sbin",
|
||||
ignore_errors=not self.conf.pedantic)
|
||||
remove_(os.path.join(self.srctree, "sbin"))
|
||||
|
||||
# fix broken links
|
||||
|
Loading…
Reference in New Issue
Block a user