-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[WIP] locale_gen: search for available locales in /usr/local as well #11046
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
Open
russoz
wants to merge
3
commits into
ansible-collections:main
Choose a base branch
from
russoz-ansible:locale-gen-usrlocal
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+226
−19
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| comment_char % | ||
| escape_char / | ||
|
|
||
| % This file is part of the GNU C Library and contains locale data. | ||
| % The Free Software Foundation does not claim any copyright interest | ||
| % in the locale data contained in this file. The foregoing does not | ||
| % affect the license of the GNU C Library as a whole. It does not | ||
| % exempt you from the conditions of the license if your use would | ||
| % otherwise be governed by that license. | ||
|
|
||
| LC_IDENTIFICATION | ||
| title "English locale for the USA with ISO formats" | ||
| language "American English" | ||
|
|
||
| category "i18n:2012";LC_IDENTIFICATION | ||
| category "i18n:2012";LC_CTYPE | ||
| category "i18n:2012";LC_COLLATE | ||
| category "i18n:2012";LC_TIME | ||
| category "i18n:2012";LC_NUMERIC | ||
| category "i18n:2012";LC_MONETARY | ||
| category "i18n:2012";LC_MESSAGES | ||
| category "i18n:2012";LC_PAPER | ||
| category "i18n:2012";LC_NAME | ||
| category "i18n:2012";LC_ADDRESS | ||
| category "i18n:2012";LC_TELEPHONE | ||
| category "i18n:2012";LC_MEASUREMENT | ||
| END LC_IDENTIFICATION | ||
|
|
||
| LC_TIME | ||
| day "Sunday";/ | ||
| "Monday";/ | ||
| "Tuesday";/ | ||
| "Wednesday";/ | ||
| "Thursday";/ | ||
| "Friday";/ | ||
| "Saturday" | ||
| abday "Sun";/ | ||
| "Mon";/ | ||
| "Tue";/ | ||
| "Wed";/ | ||
| "Thu";/ | ||
| "Fri";/ | ||
| "Sat" | ||
|
|
||
| mon "January";/ | ||
| "February";/ | ||
| "March";/ | ||
| "April";/ | ||
| "May";/ | ||
| "June";/ | ||
| "July";/ | ||
| "August";/ | ||
| "September";/ | ||
| "October";/ | ||
| "November";/ | ||
| "December" | ||
| abmon "Jan";/ | ||
| "Feb";/ | ||
| "Mar";/ | ||
| "Apr";/ | ||
| "May";/ | ||
| "Jun";/ | ||
| "Jul";/ | ||
| "Aug";/ | ||
| "Sep";/ | ||
| "Oct";/ | ||
| "Nov";/ | ||
| "Dec" | ||
|
|
||
| date_fmt "%a %d %b %Y %T %Z" | ||
| d_t_fmt "%a %d %b %Y %T" | ||
| d_fmt "%Y-%m-%d" | ||
| t_fmt "%T" | ||
| t_fmt_ampm "" | ||
| am_pm "";"" | ||
| week 7;19971130;4 | ||
| first_weekday 2 | ||
| END LC_TIME | ||
|
|
||
| LC_CTYPE | ||
| copy "en_US" | ||
| END LC_CTYPE | ||
|
|
||
| LC_COLLATE | ||
| copy "en_US" | ||
| END LC_COLLATE | ||
|
|
||
| LC_MONETARY | ||
| copy "en_US" | ||
| END LC_MONETARY | ||
|
|
||
| LC_NUMERIC | ||
| decimal_point "." | ||
| thousands_sep "," | ||
| grouping 3;3 | ||
| END LC_NUMERIC | ||
|
|
||
| LC_MESSAGES | ||
| copy "en_US" | ||
| END LC_MESSAGES | ||
|
|
||
| LC_PAPER | ||
| copy "i18n" | ||
| END LC_PAPER | ||
|
|
||
| LC_TELEPHONE | ||
| copy "en_US" | ||
| END LC_TELEPHONE | ||
|
|
||
| LC_MEASUREMENT | ||
| copy "i18n" | ||
| END LC_MEASUREMENT | ||
|
|
||
| LC_NAME | ||
| copy "en_US" | ||
| END LC_NAME | ||
|
|
||
| LC_ADDRESS | ||
| copy "en_US" | ||
| END LC_ADDRESS |
79 changes: 79 additions & 0 deletions
79
tests/integration/targets/locale_gen/tasks/11046-usrlocal.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,79 @@ | ||||||||
| --- | ||||||||
| # Copyright (c) Ansible Project | ||||||||
| # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) | ||||||||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||||||||
|
|
||||||||
| - name: Is the locale we're going to test against installed? | ||||||||
| command: locale -a | ||||||||
| register: initial_state | ||||||||
|
|
||||||||
| - name: Make sure the locale is not installed (BEGIN) | ||||||||
| community.general.locale_gen: | ||||||||
| name: en_US@iso | ||||||||
| state: absent | ||||||||
| ignore_errors: true | ||||||||
| register: not_available | ||||||||
|
|
||||||||
| - name: Ensure /usr/local/share/i18n/ | ||||||||
| ansible.builtin.file: | ||||||||
| path: /usr/local/share/i18n/locales | ||||||||
| state: directory | ||||||||
| mode: '0755' | ||||||||
|
|
||||||||
| - name: Back up /etc/locale.gen | ||||||||
| ansible.builtin.copy: | ||||||||
| src: /etc/locale.gen | ||||||||
| dest: /etc/locale.gen.bkp | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
|
||||||||
| - name: Add line to /etc/locale.gen | ||||||||
| ansible.builtin.shell: > | ||||||||
| echo "# en_US@iso UTF-8" >> /etc/locale.gen | ||||||||
|
|
||||||||
| - name: Copy custom locale | ||||||||
| ansible.builtin.copy: | ||||||||
| dest: /usr/local/share/i18n/locales/en_US@iso | ||||||||
| src: en_US@iso | ||||||||
| mode: '0644' | ||||||||
|
|
||||||||
| - name: Add custom locale to SUPPORTED | ||||||||
| ansible.builtin.copy: | ||||||||
| dest: /usr/local/share/i18n/SUPPORTED | ||||||||
| content: | | ||||||||
| en_US@iso UTF-8 | ||||||||
| mode: '0644' | ||||||||
|
|
||||||||
| - name: Make sure the locale is available | ||||||||
| community.general.locale_gen: | ||||||||
| name: en_US@iso | ||||||||
| state: absent | ||||||||
| register: available | ||||||||
|
|
||||||||
| - name: Make sure the locale is installed | ||||||||
| community.general.locale_gen: | ||||||||
| name: en_US@iso | ||||||||
| state: present | ||||||||
| register: installed | ||||||||
|
|
||||||||
| - name: Check assertions | ||||||||
| ansible.builtin.assert: | ||||||||
| that: | ||||||||
| - not_available is failed | ||||||||
| - > | ||||||||
| "locales you have entered are not available on your system: en_US@iso" in not_available.msg | ||||||||
| - available is not changed | ||||||||
| - installed is changed | ||||||||
|
|
||||||||
| - name: Make sure the locale is not installed (END) | ||||||||
| community.general.locale_gen: | ||||||||
| name: en_US@iso | ||||||||
| state: absent | ||||||||
|
|
||||||||
| - name: Remove /usr/local/share/i18n/ | ||||||||
| ansible.builtin.file: | ||||||||
| path: /usr/local/share/i18n/ | ||||||||
| state: absent | ||||||||
|
|
||||||||
| - name: Restore /etc/locale.gen | ||||||||
| ansible.builtin.copy: | ||||||||
| src: /etc/locale.gen.bkp | ||||||||
| dest: /etc/locale.gen | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add a
[email protected]file next to it with a license header, or add it as a comment at the top of this file.