rig
rig copied to clipboard
Masquerade PopOS as Ubuntu
Issue: #277
Changes
PopOS is not supported by api.r-hub.io yet but it should essentially be the same as Ubuntu (in the context of installing R) so I'm masquerading it as that here.
Related
There's a workaround discussed here where you set the RIG_PLATFORM environment variable.
Before I came across that I was looking through the code and saw a tweak for opensuse-leap that seemed like precedent for adding some tweaks to actual vs extracted/determined distro. I've added a match and a simple test for this where you could add any number of other 'masquerade as' default rules to save people having to discover/set RIG_PLATFORM.
@gaborcsardi I don't have permissions to add you as a reviewer so commenting instead.
The redhat build checks seem to be failing but this looks like some kind of OS registration issue.
If you like this PR (in principle at least) let me know if there's anything else you'd like added (e2e testing etc).
Thanks! It would be nice to have a generic mechanism for this. PopOS has this, for 22.04 at least:
root@bfc97b39f8b1:~# cat /etc/os-release
NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os
So maybe we could parse the ID_LIKE field as well. I am not sure why they put both ubuntu and debian there, if it is based on ubuntu, but we can break on spaces and take the first expression.
The difficulty is that we would first try pop and fall back on ubuntu, which means that we would do two HTTP requests.
So maybe we could parse the
ID_LIKEfield as well. I am not sure why they put both ubuntu and debian there, if it is based on ubuntu, but we can break on spaces and take the first expression.
Oh I like the idea of using ID_LIKE 👌🏻 I should have noticed that! The ID_LIKE definition here is:
""" It should list identifiers of operating systems that are closely related to the local operating system in regards to packaging and programming interfaces, for example listing one or more OS identifiers the local OS is a derivative from. An OS should generally only list other OS identifiers it itself is a derivative of, and not any OSes that are derived from it, though symmetric relationships are possible. ... """
That seems to fit the bill 👍🏻
The difficulty is that we would first try
popand fall back onubuntu, which means that we would do two HTTP requests.
What if we just encode the list of officially supported distros as a constant and if we get an ID that doesn't fit those we fallback to using ID_LIKE? Then we still only do one HTTP request.