[postcfg] mirrorlist generation based on system timezone #132

Open
fhdk wants to merge 4 commits from fhdk-development-patch-545a into development
fhdk commented 2025-08-30 16:20:24 +00:00 (Migrated from gitlab2.manjaro.org)

This patch work with pacman-mirrors version 5.1

It is intended to generate the mirror list for the configured system based on the configured timezone.

If the country for the configured timezone is not available CDN mirrors is configured using pacman-mirrors -c Global

This patch work with `pacman-mirrors` version 5.1 It is intended to generate the mirror list for the configured system based on the configured timezone. If the country for the configured timezone is not available CDN mirrors is configured using `pacman-mirrors -c Global`
fhdk commented 2025-08-30 16:20:24 +00:00 (Migrated from gitlab2.manjaro.org)

assigned to @philm

assigned to @philm
philm commented 2025-09-02 07:05:34 +00:00 (Migrated from gitlab2.manjaro.org)

So this is a new feature and won't break the current implementation when pacman-mirrors gets updated but this change is not yet included?

So this is a new feature and won't break the current implementation when **pacman-mirrors** gets updated but this change is not yet included?
fhdk commented 2025-09-02 10:08:17 +00:00 (Migrated from gitlab2.manjaro.org)

The change requires pacman-mirrors 5.1 which - currently - is present in unstable and testing.

The change requires pacman-mirrors 5.1 which - currently - is present in unstable and testing.
fhdk commented 2025-09-02 10:09:19 +00:00 (Migrated from gitlab2.manjaro.org)

It is possible to add a pacman-mirrors version check.

It is possible to add a pacman-mirrors version check.
philm commented 2025-09-02 10:29:57 +00:00 (Migrated from gitlab2.manjaro.org)

I mean more, what will happen when 5.1 will land in stable but not this feature ...

I mean more, what will happen when 5.1 will land in **stable** but not this feature ...
fhdk commented 2025-09-02 10:30:23 +00:00 (Migrated from gitlab2.manjaro.org)

I mean more, what will happen when 5.1 will land in stable but not this feature ...

Nothing - the output of pacman-mirrors has not changed - the API is the same - only the inner workings has changed from using geoip to use the system's timezone.

Even though I made this because there has been requests to use a country based mirror pool when installing - interfacing Calamares with pacman-mirrors is optional - not required

Also - given the fact that some uses VPN when installing the system - I had been thinking about improving the mirrorpool generation by using the systems configured timezone instead of a could-be VPN endpoint.

Insert a check in run_pacman_mirrors() like this perhaps ? (untested)

    def run_pacman_mirrors(self):
        pm_version = target_env_process_output(["pacman-mirrors", "--version"])
        from decimal import Decimal
        if pm_version <= Decimal(5):
            libcalamares.utils.warning("pacman-mirrors v5.0. Using Global mirrors.")
            target_env_call(["pacman-mirrors", "-c", "Global"])
            return

  ...

> I mean more, what will happen when 5.1 will land in **stable** but not this feature ... Nothing - the output of pacman-mirrors has not changed - the API is the same - only the inner workings has changed from using geoip to use the system's timezone. Even though I made this because there has been requests to use a country based mirror pool when installing - interfacing Calamares with pacman-mirrors is optional - not required Also - given the fact that some uses VPN when installing the system - I had been thinking about improving the mirrorpool generation by using the systems configured timezone instead of a could-be VPN endpoint. Insert a check in run_pacman_mirrors() like this perhaps ? (untested) ``` def run_pacman_mirrors(self): pm_version = target_env_process_output(["pacman-mirrors", "--version"]) from decimal import Decimal if pm_version <= Decimal(5): libcalamares.utils.warning("pacman-mirrors v5.0. Using Global mirrors.") target_env_call(["pacman-mirrors", "-c", "Global"]) return ... ```
fhdk commented 2025-09-02 10:55:57 +00:00 (Migrated from gitlab2.manjaro.org)

added 1 commit

  • 614d5b19 - Insert conditional check for pacman-mirrors v5.0

Compare with previous version

added 1 commit <ul><li>614d5b19 - Insert conditional check for pacman-mirrors v5.0</li></ul> [Compare with previous version](/applications/calamares/-/merge_requests/42/diffs?diff_id=4708&start_sha=97665db1d3f9d3ee5d0091e4185925b985e39aca)
philm commented 2025-09-02 10:58:36 +00:00 (Migrated from gitlab2.manjaro.org)

Still doesn't answer the question what will happen when calamares doesn't ship this change. Is it mandatory needed for calamares when we ship pacman-mirrors v5.1 or does v5.1 also work without that code added?

Still doesn't answer the question what will happen when **calamares** doesn't ship this change. Is it mandatory needed for calamares when we ship pacman-mirrors v5.1 or does v5.1 also work without that code added?
fhdk commented 2025-09-02 11:05:27 +00:00 (Migrated from gitlab2.manjaro.org)

I mean more, what will happen when 5.1 will land in stable but not this feature ...

Nothing - the output of pacman-mirrors has not changed - the API is the same - only the inner workings has changed from using geoip to use the system's timezone.

Is it mandatory needed for calamares when we ship pacman-mirrors v5.1

No it is not.

or does v5.1 also work without that code added?

pacman-mirrors does not depend on Calamares nor does it affect Calamares

>> I mean more, what will happen when 5.1 will land in **stable** but not this feature ... >Nothing - the output of pacman-mirrors has not changed - the API is the same - only the inner workings has changed from using geoip to use the system's timezone. > Is it mandatory needed for calamares when we ship pacman-mirrors v5.1 No it is not. > or does v5.1 also work without that code added? pacman-mirrors does not depend on Calamares nor does it affect Calamares
philm commented 2025-09-02 12:09:32 +00:00 (Migrated from gitlab2.manjaro.org)

So this MR is optional and won't affect Calamares when either v5.0 or v5.1 is used. Only adds a new feature which was added with v5.1, right?

So this MR is optional and won't affect Calamares when either v5.0 or v5.1 is used. Only adds a new feature which was added with v5.1, right?
fhdk commented 2025-09-02 12:15:46 +00:00 (Migrated from gitlab2.manjaro.org)

You are correct - Calamares already contains a call to pacman-mirrors using the -f3 argument.

It is optional.

If you look at the issues - some argue that it would be nice to have Calamares generate a local mirrorlist when possible. geoip is unreliable - thus the change to the geolocation function in pacman-mirrors.

So this MR is an enhancement to the existing call - utilising the new functionality pacman-mirrors provides behind the scene.

You are correct - Calamares already contains a call to pacman-mirrors using the `-f3` argument. It is optional. If you look at the issues - some argue that it would be nice to have Calamares generate a local mirrorlist when possible. geoip is unreliable - thus the change to the geolocation function in pacman-mirrors. So this MR is an enhancement to the existing call - utilising the new functionality pacman-mirrors provides behind the scene.
fhdk commented 2025-09-02 12:36:47 +00:00 (Migrated from gitlab2.manjaro.org)

added 1 commit

  • 02b76b36 - added target_env_process_putput to imports

Compare with previous version

added 1 commit <ul><li>02b76b36 - added target_env_process_putput to imports</li></ul> [Compare with previous version](/applications/calamares/-/merge_requests/42/diffs?diff_id=4710&start_sha=614d5b1960436d60e666fe316f4e94de9acf0f2a)
fhdk commented 2025-09-02 13:50:04 +00:00 (Migrated from gitlab2.manjaro.org)

added 1 commit

  • a1450f09 - Make pacman-mirrors version check more robust

Compare with previous version

added 1 commit <ul><li>a1450f09 - Make pacman-mirrors version check more robust</li></ul> [Compare with previous version](/applications/calamares/-/merge_requests/42/diffs?diff_id=4712&start_sha=02b76b3627c3d1bf7abda3b11c8bda6ac5d0aa2c)
fhdk commented 2025-09-02 13:54:06 +00:00 (Migrated from gitlab2.manjaro.org)

With the final version of the version check - there is zero issues adopting the proposed change.

        pm_version = 0
        pm_output = []
        target_env_process_output(["pacman-mirrors", "--version"], pm_output)
        pm_version = pm_output[0].replace("\n", "")
        libcalamares.utils.warning("pacman-mirrors --version returned '{}'".format(pm_output[0]))
        libcalamares.utils.warning("version is '{}'".format(pm_version))
        from decimal import Decimal
        if Decimal(pm_version) <= 5:
            libcalamares.utils.warning("pacman-mirrors v5.0. Using Global mirrors.")
            target_env_call(["pacman-mirrors", "-c", "Global"])
            return

image{width=550 height=270}

With the final version of the version check - there is zero issues adopting the proposed change. ``` pm_version = 0 pm_output = [] target_env_process_output(["pacman-mirrors", "--version"], pm_output) pm_version = pm_output[0].replace("\n", "") libcalamares.utils.warning("pacman-mirrors --version returned '{}'".format(pm_output[0])) libcalamares.utils.warning("version is '{}'".format(pm_version)) from decimal import Decimal if Decimal(pm_version) <= 5: libcalamares.utils.warning("pacman-mirrors v5.0. Using Global mirrors.") target_env_call(["pacman-mirrors", "-c", "Global"]) return ``` ![image](/uploads/3ad6f1fd53d59a15415f69b23b29ecbf/image.png){width=550 height=270}
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fhdk-development-patch-545a:fhdk-development-patch-545a
git switch fhdk-development-patch-545a

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch development
git merge --no-ff fhdk-development-patch-545a
git switch fhdk-development-patch-545a
git rebase development
git switch development
git merge --ff-only fhdk-development-patch-545a
git switch fhdk-development-patch-545a
git rebase development
git switch development
git merge --no-ff fhdk-development-patch-545a
git switch development
git merge --squash fhdk-development-patch-545a
git switch development
git merge --ff-only fhdk-development-patch-545a
git switch development
git merge fhdk-development-patch-545a
git push origin development
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
applications/calamares!132
No description provided.