Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eapply_user: combine sort for all dirs (bug 608880) #186

Merged
merged 1 commit into from Aug 11, 2017

Conversation

zmedico
Copy link
Member

@zmedico zmedico commented Aug 6, 2017

Combine the patch basenames from all matched directories into a
list, and apply them in POSIX sorted order. This allows patches in
more-specific directories to override patches of the same basename found
in less-specific directories. An empty patch (or /dev/null symlink)
negates a patch with the same basename found in a less-specific
directory.

This behavior is much more flexible and intuitive than the previous one,
while remaining backward-compatible to some extent.

NOTE: The implementation uses an associative array, which requires bash
version 4 or later.

X-Gentoo-bug: 608880
X-Gentoo-bug-url: https://bugs.gentoo.org/608880

@zmedico zmedico force-pushed the bug_608880 branch 3 times, most recently from 63640d4 to 967b4c6 Compare August 10, 2017 17:18
eapply "${f}"
applied=1
fi
done < <(printf -- "%s\0" "${!_eapply_user_patches[@]}" |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shellcheck: ^-- SC1117: Backslash is literal in "\0". Prefer explicit escaping: "\0".
https://github.com/koalaman/shellcheck/wiki/SC1117

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd dare say a more readable fix would be to use single quotes, i.e. '%s\0'.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's better. Done now.

Combine the patch basenames from all matched directories into a
list, and apply them in POSIX sorted order.  This allows patches in
more-specific directories to override patches of the same basename found
in less-specific directories. An empty patch (or /dev/null symlink)
negates a patch with the same basename found in a less-specific
directory.

This behavior is much more flexible and intuitive than the previous one,
while remaining backward-compatible to some extent.

NOTE: The implementation uses an associative array, which requires bash
version 4 or later.

X-Gentoo-bug: 608880
X-Gentoo-bug-url: https://bugs.gentoo.org/608880
Reviewed-by: Manuel Rüger <mrueg@gentoo.org>
@gentoo-bot gentoo-bot merged commit 7d2c4fb into gentoo:master Aug 11, 2017
@zmedico zmedico deleted the bug_608880 branch August 20, 2017 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants