Commit 5af11468 authored by Kirill Smelkov's avatar Kirill Smelkov

Fix regression when updating a part with several unicode paths in __buildout_installed__

Commit 57f3dd73 (Write .installed.cfg only once, in safe way and only if
there's any change) changed the way how __buildout_installed__ is read
and then written back on part upgrade.

In particular, before it was always:

    on install:
    - get [] of installed parts from recipe.install()

    on update:
    - read __buildout_installed__
    - split it by \n

    on write back for both:
    - join by \n
    - write to __buildout_installed__

but after that patch on-update stopped doing that split by \n and on
writeback the code checks for installed_files to be string and does not
split it if it is.

Except the check does not work for unicode strings. Look e.g. what
currently happens with fluentd:

After first install it is

__buildout_installed__ =
!py!u'/srv/slapgrid/slappart6/srv/runner/software/73a7bf66fea06c703a70faaced67dabf/parts/fluentd\n/srv/slapgrid/slappart6/srv/runner/software/73a7bf66fea06c703a70faaced67dabf/bin/fluent-cat\n/srv/slapgrid/slappart6/srv/runner/software/73a7bf66fea06c703a70faaced67dabf/bin/fluent-gem\n/srv/slapgrid/slappart6/srv/runner/software/73a7bf66fea06c703a70faaced67dabf/bin/fluent-debug\n/srv/slapgrid/slappart6/srv/runner/software/73a7bf66fea06c703a70faaced67dabf/bin/fluentd\n/srv/slapgrid/slappart6/srv/runner/software/73a7bf66fea06c703a70faaced67dabf/bin/gem'

but after update it becomes

__buildout_installed__ =
!py!u'/\ns\nr\nv\n/\ns\nl\na\np\ng\nr\ni\nd\n/\ns\nl\na\np\np\na\nr\nt\n6\n/\ns\nr\nv\n/\nr\nu\nn\nn\ne\nr\n/\ns\no\nf\nt\nw\na\nr\ne\n/\n7\n3\na\n7\nb\nf\n6\n6\nf\ne\na\n0\n6\nc\n7\n0\n3\na\n7\n0\nf\na\na\nc\ne\nd\n6\n7\nd\na\nb\nf\n/\np\na\nr\nt\ns\n/\nf\nl\nu\ne\nn\nt\nd\n\n\n/\ns\nr\nv\n/\ns\nl\na\np\ng\nr\ni\nd\n/\ns\nl\na\np\np\na\nr\nt\n6\n/\ns\nr\nv\n/\nr\nu\nn\nn\ne\nr\n/\ns\no\n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nu\nn\nn\ne\nr\n/\ns\no\nf\nt\nw\na\nr\ne\n/\n7\n3\na\n7\nb\nf\n6\n6\nf\ne\na\n0\n6\nc\n7\n0\n3\na\n7\n0\nf\na\na\nc\ne\nd\n6\n7\nd\na\nb\nf\n/\nb\ni\nn\n/\ng\ne\nm'

Correct the check to take unicode strings into account.

/cc @jm
/reviewed-by @kazuhiko
parent 050107c1
...@@ -783,7 +783,7 @@ class Buildout(UserDict.DictMixin): ...@@ -783,7 +783,7 @@ class Buildout(UserDict.DictMixin):
part) part)
installed_files = "" installed_files = ""
if not isinstance(installed_files, str): if not isinstance(installed_files, basestring):
installed_files = '\n'.join(installed_files) installed_files = '\n'.join(installed_files)
saved_options['__buildout_installed__'] = installed_files saved_options['__buildout_installed__'] = installed_files
saved_options['__buildout_signature__'] = signature saved_options['__buildout_signature__'] = signature
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment