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

Handling version mismatches #23

Closed
jasonhansel opened this issue Jan 9, 2018 · 3 comments
Closed

Handling version mismatches #23

jasonhansel opened this issue Jan 9, 2018 · 3 comments

Comments

@jasonhansel
Copy link

jasonhansel commented Jan 9, 2018

Currently, aconfmgr does not upgrade packages to the latest version when running aconfmgr apply. This means that running aconfmgr apply on two different systems can result in inconsistent states, since the systems might have different versions of the same package. It would be nice if aconfmgr automatically kept packages up-to-date.

One way would be to run pacman --sync --needed for every package in the configuration, rather than trying to determine manually which packages are already installed. Of course, it would also be necessary to run pacman --sync --refresh first.

I think this would also be a significant performance win. Instead of calling pacman once for every package, one could just use something like:

PrintArray packages | xargs -s 1024 pacman --sync --needed

Thanks for taking a look at this! I may have time to implement this myself, if there's interest.

@CyberShadow
Copy link
Owner

Good observation, but I don't think it is aconfmgr's job to update the system.

In fact, I'm aware of at least one situation where updating the system is not wanted: when recording changes to the configuration of a system which is not up-to-date. Arch Linux regularly replaces some packages with others, and updating packages can change files in the aconfmgr configuration, and these changes would then be unnecessarily difficult to sort out from those done by the user directly. Though this applies to save, running apply during or after tweaking the aconfmgr configuration can be done with the intent to apply the changes done in the configuration to the system, e.g. to discard the unnecessary ones.

Instead of calling pacman once for every package,

aconfmgr performs one pacman invocation to install all missing native packages:

sudo "${pacman_opts[@]}" --sync "${asdeps_arr[@]}" "${target_packages[@]}"

So, I'm not sure if there's anything worth changing in aconfmgr. The observation may warrant being documented. Additionally, you could probably add the pacman --sync commands to your configuration so they're executed automatically when aconfmgr is ran, though I wouldn't recommend this practice due to the implications described above.

@jasonhansel
Copy link
Author

Fair enough. I agree that aconfmgr save should keep packages at their current version, but I still think that this would be useful for aconfmgr apply. One alternative would be to have a separate command (e.g. PinVersion linux 4.6.2), used to specify a particular version of a package. PinVersion commands would be generated by aconfmgr save, and one could update the system simply by removing all of them (and thus "unpinning" the packages, allowing the latest version to be used). I myself might be interested in implementing this, since it would also preserve idempotency.

For the moment, I may just add pacman --sync --refresh to my configuration. Is there a way to make sure that this only happens on apply, and never on save?

@CyberShadow
Copy link
Owner

Is there a way to make sure that this only happens on apply, and never on save?

As of bf73896, you can check aconfmgr_action in your configuration.

As far as I can see, there are no actionable points left in this issue, so I'm going to close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants