1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 15:39:43 +00:00

ensure ignore are respected

This commit is contained in:
deadc0de6
2020-12-11 19:45:03 +01:00
parent f6ac82082f
commit 2e0bab0ba2
3 changed files with 12 additions and 10 deletions

View File

@@ -134,8 +134,11 @@ def _dotfile_compare(o, dotfile, tmp):
LOG.dbg('points to itself')
return True
ignores = list(set(o.compare_ignore + dotfile.cmpignore))
ignores = patch_ignores(ignores, dotfile.dst, debug=o.debug)
insttmp = None
if dotfile.template and Templategen.is_template(src):
if dotfile.template and Templategen.is_template(src, ignore=ignores):
# install dotfile to temporary dir for compare
ret, err, insttmp = inst.install_to_temp(t, tmp, src, dotfile.dst,
is_template=True,
@@ -149,8 +152,6 @@ def _dotfile_compare(o, dotfile, tmp):
src = insttmp
# compare
ignores = list(set(o.compare_ignore + dotfile.cmpignore))
ignores = patch_ignores(ignores, dotfile.dst, debug=o.debug)
diff = comp.compare(src, dotfile.dst, ignore=ignores)
# clean tmp transformed dotfile if any
@@ -220,6 +221,7 @@ def _dotfile_install(o, dotfile, tmpdir=None):
dotfile.link,
actionexec=pre_actions_exec,
is_template=is_template,
ignore=ignores,
chmod=dotfile.chmod)
elif hasattr(dotfile, 'link') and \
dotfile.link == LinkTypes.LINK_CHILDREN:
@@ -239,8 +241,6 @@ def _dotfile_install(o, dotfile, tmpdir=None):
if not tmp:
return False, dotfile.key, None
src = tmp
ignores = list(set(o.install_ignore + dotfile.instignore))
ignores = patch_ignores(ignores, dotfile.dst, debug=o.debug)
r, err = inst.install(t, src, dotfile.dst,
LinkTypes.NOLINK,
actionexec=pre_actions_exec,

View File

@@ -111,7 +111,7 @@ class Installer:
if self.totemp:
r, err, _ = self.install_to_temp(templater, self.totemp,
src, dst, is_template=is_template,
chmod=chmod)
chmod=chmod, ignore=ignore)
return self._log_install(r, err)
isdir = os.path.isdir(src)
@@ -186,7 +186,7 @@ class Installer:
return self._log_install(r, err)
def install_to_temp(self, templater, tmpdir, src, dst,
is_template=True, chmod=None):
is_template=True, chmod=None, ignore=[]):
"""
install a dotfile to a tempdir
@@ -196,6 +196,7 @@ class Installer:
@dst: dotfile destination path in the FS
@is_template: this dotfile is a template
@chmod: rights to apply if any
@ignore: patterns to ignore
return
- success, error-if-any, dotfile-installed-path
@@ -225,7 +226,7 @@ class Installer:
ret, err = self.install(templater, src, tmpdst,
LinkTypes.NOLINK,
is_template=is_template,
chmod=chmod)
chmod=chmod, ignore=ignore)
if self.debug:
if ret:
self.log.dbg('tmp installed in {}'.format(tmpdst))
@@ -243,7 +244,8 @@ class Installer:
# low level accessors for public methods
########################################################
def _link(self, templater, src, dst, actionexec=None, is_template=True):
def _link(self, templater, src, dst, actionexec=None,
is_template=True):
"""
install link:link

View File

@@ -148,7 +148,7 @@ class Updater:
return tmp
def _is_template(self, path):
if not Templategen.is_template(path):
if not Templategen.is_template(path, ignore=self.ignores):
if self.debug:
self.log.dbg('{} is NO template'.format(path))
return False