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

locale_gen: fix/improvements #9238

Merged

Conversation

russoz
Copy link
Collaborator

@russoz russoz commented Dec 12, 2024

SUMMARY

It introduces a RV mechanism that declares the mode in a more descriptive way:

ubuntu_mode mechanism
False glibc
True debian

Refer to #9131 (comment) for a more complete rationale.

Change the logic to determine whether ubuntu_mode is True or False.

Formerly it would:

  1. set ubuntu_mode=True if /var/lib/locales/supported.d existed,
  2. else False if /etc/locale.gen exists,
  3. else raising an error.

With this PR it will:

  1. set ubuntu_mode=False is /etc/locale.gen is present,
  2. else True if the /var/lib/... directory exists,
  3. else error.

Canonical made a deliberate decision to move towards the glibc support, so all Ubuntu versions since 16.04 have /etc/locale.gen. I have tested locally in Debian 11 and 12 and both of them worked using glibc mode.

The PR will include tests forcing ubuntu_mode=True.

Fixes #8487 #9131

ISSUE TYPE
  • Bugfix Pull Request
  • Refactoring Pull Request
COMPONENT NAME

locale_gen

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added WIP Work in progress bug This issue/PR relates to a bug module module plugins plugin (any type) labels Dec 12, 2024
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-9 Automatically create a backport for the stable-9 branch backport-10 Automatically create a backport for the stable-10 branch labels Dec 14, 2024
@ansibullbot

This comment was marked as resolved.

@ansibullbot ansibullbot added integration tests/integration tests tests labels Dec 16, 2024
@ansibullbot

This comment was marked as resolved.

@russoz russoz force-pushed the locale-gen-rewrite branch from 0bff56e to 2840fd3 Compare December 16, 2024 03:46
@ansibullbot

This comment was marked as resolved.

@russoz russoz changed the title [WIP] locale_gen: fix/improvements locale_gen: fix/improvements Dec 23, 2024
@russoz russoz requested a review from felixfontein December 23, 2024 02:52
@russoz
Copy link
Collaborator Author

russoz commented Dec 23, 2024

Hi @ltog @samikhelil83 @lukasz-zaroda

Could you please review the PR? Thanks in advance!

Happy holidays!

@ansibullbot ansibullbot removed the WIP Work in progress label Dec 23, 2024
@russoz russoz force-pushed the locale-gen-rewrite branch from 763d6fc to 23eb438 Compare December 26, 2024 10:23
@russoz russoz force-pushed the locale-gen-rewrite branch from 68af963 to 7d2b53d Compare December 29, 2024 20:03
@russoz
Copy link
Collaborator Author

russoz commented Dec 29, 2024

Rebased

plugins/modules/locale_gen.py Outdated Show resolved Hide resolved
plugins/modules/locale_gen.py Outdated Show resolved Hide resolved
plugins/modules/locale_gen.py Outdated Show resolved Hide resolved
plugins/modules/locale_gen.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

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

Besides these two details, it looks good!

changelogs/fragments/9238-locale-gen-rewrite.yml Outdated Show resolved Hide resolved
plugins/modules/locale_gen.py Outdated Show resolved Hide resolved
@ansibullbot ansibullbot added the needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI label Dec 30, 2024
@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Dec 30, 2024
@felixfontein felixfontein merged commit 6bb7a1c into ansible-collections:main Dec 30, 2024
129 checks passed
Copy link

patchback bot commented Dec 30, 2024

Backport to stable-9: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 6bb7a1c on top of patchback/backports/stable-9/6bb7a1cc735eb7f7ca1907d5a3cc0797ff7fa8f2/pr-9238

Backporting merged PR #9238 into main

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/ansible-collections/community.general.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/stable-9/6bb7a1cc735eb7f7ca1907d5a3cc0797ff7fa8f2/pr-9238 upstream/stable-9
  4. Now, cherry-pick PR locale_gen: fix/improvements #9238 contents into that branch:
    $ git cherry-pick -x 6bb7a1cc735eb7f7ca1907d5a3cc0797ff7fa8f2
    If it'll yell at you with something like fatal: Commit 6bb7a1cc735eb7f7ca1907d5a3cc0797ff7fa8f2 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x 6bb7a1cc735eb7f7ca1907d5a3cc0797ff7fa8f2
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR locale_gen: fix/improvements #9238 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/stable-9/6bb7a1cc735eb7f7ca1907d5a3cc0797ff7fa8f2/pr-9238
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein
Copy link
Collaborator

@russoz thanks for improving/fixing this!

Copy link

patchback bot commented Dec 30, 2024

Backport to stable-10: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-10/6bb7a1cc735eb7f7ca1907d5a3cc0797ff7fa8f2/pr-9238

Backported as #9481

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Dec 30, 2024
* locale_gen: fix/improvements

* fix sanity

* add RV doc

* add integration test forcing mechanism=debian

- test is failing

* fix RETURN doc

* reformat yaml

* comment out the test for ubuntu_mode=True

* multiple changes:

- add changelog fragment
- improved docs

* normalize docs after rebasing

* Update changelogs/fragments/9131-locale-gen-rewrite.yml

* apply recommendations from review

* Update plugins/modules/locale_gen.py

Co-authored-by: Felix Fontein <[email protected]>

* Update changelogs/fragments/9238-locale-gen-rewrite.yml

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/modules/locale_gen.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/modules/locale_gen.py

Co-authored-by: Felix Fontein <[email protected]>

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit 6bb7a1c)
@felixfontein felixfontein removed the backport-9 Automatically create a backport for the stable-9 branch label Dec 30, 2024
felixfontein pushed a commit that referenced this pull request Dec 30, 2024
…9481)

locale_gen: fix/improvements (#9238)

* locale_gen: fix/improvements

* fix sanity

* add RV doc

* add integration test forcing mechanism=debian

- test is failing

* fix RETURN doc

* reformat yaml

* comment out the test for ubuntu_mode=True

* multiple changes:

- add changelog fragment
- improved docs

* normalize docs after rebasing

* Update changelogs/fragments/9131-locale-gen-rewrite.yml

* apply recommendations from review

* Update plugins/modules/locale_gen.py

Co-authored-by: Felix Fontein <[email protected]>

* Update changelogs/fragments/9238-locale-gen-rewrite.yml

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/modules/locale_gen.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/modules/locale_gen.py

Co-authored-by: Felix Fontein <[email protected]>

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit 6bb7a1c)

Co-authored-by: Alexei Znamensky <[email protected]>
@russoz russoz deleted the locale-gen-rewrite branch December 30, 2024 21:07
Massl123 pushed a commit to Massl123/community.general that referenced this pull request Feb 7, 2025
* locale_gen: fix/improvements

* fix sanity

* add RV doc

* add integration test forcing mechanism=debian

- test is failing

* fix RETURN doc

* reformat yaml

* comment out the test for ubuntu_mode=True

* multiple changes:

- add changelog fragment
- improved docs

* normalize docs after rebasing

* Update changelogs/fragments/9131-locale-gen-rewrite.yml

* apply recommendations from review

* Update plugins/modules/locale_gen.py

Co-authored-by: Felix Fontein <[email protected]>

* Update changelogs/fragments/9238-locale-gen-rewrite.yml

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/modules/locale_gen.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/modules/locale_gen.py

Co-authored-by: Felix Fontein <[email protected]>

---------

Co-authored-by: Felix Fontein <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-10 Automatically create a backport for the stable-10 branch bug This issue/PR relates to a bug integration tests/integration module module needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

locale_gen Don't do anything
3 participants