On Mon, 27 Oct 2014 13:35:19 -0700 Zac Medico <zmed...@gentoo.org> wrote:
> Users may not want some symlinks to get clobbered, so protect them > with CONFIG_PROTECT. Changes were required in the dblink.mergeme > method and the new_protect_filename function. > > The changes to dblink.mergeme do 3 things: > > * Move the bulk of config protection logic from dblink.mergeme to a > new dblink._protect method. The new method only returns 3 > variables, which makes it easier to understand how config protection > interacts with the dblink.mergeme code that uses those variables. > This is important, since dblink.mergeme has so many variables. > > * Initialize more variables at the beginning of dblink.mergeme, since > those variables are used by the dblink._protect method. > > * Use the variables returned from dblink._protect to trigger > appropriate behavior later in dblink.mergeme. > > The new_protect_filename changes are required since this function > compares the new file to old ._cfg* files that may already exist, in > order to avoid creating duplicate ._cfg* files. In these comparisons, > it needs to handle symlinks differently from regular files. > > The unit tests demonstrate operation in many different scenarios, > including: > > * regular file replaces regular file > * regular file replaces symlink > * regular file replaces directory > * symlink replaces symlink > * symlink replaces regular file > * symlink replaces directory > * directory replaces regular file > * directory replaces symlink > > X-Gentoo-Bug: 485598 > X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=485598 > --- > This updated patch only adds to the commit message in order to > provide some information that may be helpful to reviewers of the > patch. There are no changes to the code. > > pym/portage/dbapi/vartree.py | 255 > ++++++++++++--------- pym/portage/tests/emerge/test_config_protect.py > | 292 ++++++++++++++++++++++++ > pym/portage/util/__init__.py | 35 ++- 3 files > changed, 463 insertions(+), 119 deletions(-) create mode 100644 > pym/portage/tests/emerge/test_config_protect.py > See my github inline comments re: use of my* variables -- Brian Dolbec <dolsen>