Update the location of R packagemanager

Fixes #1272
pull/1273/head
Kacper Kowalik (Xarthisius) 2023-05-22 12:55:50 -05:00
rodzic d3c74414cf
commit 7bf02d8101
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 5D21B852895192F9
4 zmienionych plików z 16 dodań i 16 usunięć

Wyświetl plik

@ -66,11 +66,11 @@ by adding a :ref:`install.R<install.R>` file to your repo. RStudio and IRKernel
installed by default for all R versions. installed by default for all R versions.
If you request R 4.1 or later, or specify a snapshot date newer than If you request R 4.1 or later, or specify a snapshot date newer than
``2022-01-01``, `packagemanager.rstudio.com <https://packagemanager.rstudio.com/client/#/>`_ ``2022-01-01``, `packagemanager.posit.co <https://packagemanager.posit.co/client/#/>`_
will be used to provide much faster installations via `binary packages <https://www.rstudio.com/blog/package-manager-v1-1-no-interruptions/>`_. will be used to provide much faster installations via `binary packages <https://www.rstudio.com/blog/package-manager-v1-1-no-interruptions/>`_.
For *some* packages, this might require you install underlying system libraries For *some* packages, this might require you install underlying system libraries
using :ref:`apt.txt` - look at the page for the CRAN package you are interested in at using :ref:`apt.txt` - look at the page for the CRAN package you are interested in at
`packagemanager.rstudio.com <https://packagemanager.rstudio.com/client/#/>`_ to find `packagemanager.posit.co <https://packagemanager.posit.co/client/#/>`_ to find
a list. a list.
For older R versions with an older snapshot date, `MRAN <https://mran.microsoft.com/>`_ For older R versions with an older snapshot date, `MRAN <https://mran.microsoft.com/>`_

Wyświetl plik

@ -22,8 +22,8 @@ class RBuildPack(PythonBuildPack):
Where 'year', 'month' and 'date' refer to a specific Where 'year', 'month' and 'date' refer to a specific
date whose CRAN snapshot we will use to fetch packages. date whose CRAN snapshot we will use to fetch packages.
Uses https://packagemanager.rstudio.com, or MRAN if no snapshot Uses https://packagemanager.posit.co, or MRAN if no snapshot
is found on packagemanager.rstudio.com is found on packagemanager.posit.co
2. A `DESCRIPTION` file signaling an R package 2. A `DESCRIPTION` file signaling an R package
@ -204,7 +204,7 @@ class RBuildPack(PythonBuildPack):
def get_rspm_snapshot_url(self, snapshot_date, max_days_prior=7): def get_rspm_snapshot_url(self, snapshot_date, max_days_prior=7):
for i in range(max_days_prior): for i in range(max_days_prior):
snapshots = requests.post( snapshots = requests.post(
"https://packagemanager.rstudio.com/__api__/url", "https://packagemanager.posit.co/__api__/url",
# Ask for midnight UTC snapshot # Ask for midnight UTC snapshot
json={ json={
"repo": "all", "repo": "all",
@ -216,11 +216,11 @@ class RBuildPack(PythonBuildPack):
# Construct a snapshot URL that will give us binary packages for Ubuntu Bionic (18.04) # Construct a snapshot URL that will give us binary packages for Ubuntu Bionic (18.04)
if "upsi" in snapshots: if "upsi" in snapshots:
return ( return (
"https://packagemanager.rstudio.com/all/__linux__/bionic/" "https://packagemanager.posit.co/all/__linux__/bionic/"
+ snapshots["upsi"] + snapshots["upsi"]
) )
raise ValueError( raise ValueError(
"No snapshot found for {} or {} days prior in packagemanager.rstudio.com".format( "No snapshot found for {} or {} days prior in packagemanager.posit.co".format(
snapshot_date.strftime("%Y-%m-%d"), max_days_prior snapshot_date.strftime("%Y-%m-%d"), max_days_prior
) )
) )
@ -229,7 +229,7 @@ class RBuildPack(PythonBuildPack):
def get_mran_snapshot_url(self, snapshot_date, max_days_prior=7): def get_mran_snapshot_url(self, snapshot_date, max_days_prior=7):
for i in range(max_days_prior): for i in range(max_days_prior):
try_date = snapshot_date - datetime.timedelta(days=i) try_date = snapshot_date - datetime.timedelta(days=i)
# Fall back to MRAN if packagemanager.rstudio.com doesn't have it # Fall back to MRAN if packagemanager.posit.co doesn't have it
url = f"https://mran.microsoft.com/snapshot/{try_date.isoformat()}" url = f"https://mran.microsoft.com/snapshot/{try_date.isoformat()}"
r = requests.head(url) r = requests.head(url)
if r.ok: if r.ok:
@ -258,11 +258,11 @@ class RBuildPack(PythonBuildPack):
devtools is part of our 'core' base install, so we should have some devtools is part of our 'core' base install, so we should have some
control over what version we install here. control over what version we install here.
""" """
# Picked from https://packagemanager.rstudio.com/client/#/repos/1/overview # Picked from https://packagemanager.posit.co/client/#/repos/1/overview
# Hardcoded rather than dynamically determined from a date to avoid extra API calls # Hardcoded rather than dynamically determined from a date to avoid extra API calls
# Plus, we can always use packagemanager.rstudio.com here as we always install the # Plus, we can always use packagemanager.posit.co here as we always install the
# necessary apt packages. # necessary apt packages.
return "https://packagemanager.rstudio.com/all/__linux__/bionic/2022-01-04+Y3JhbiwyOjQ1MjYyMTU7NzlBRkJEMzg" return "https://packagemanager.posit.co/all/__linux__/bionic/2022-01-04+Y3JhbiwyOjQ1MjYyMTU7NzlBRkJEMzg"
@lru_cache() @lru_cache()
def get_build_scripts(self): def get_build_scripts(self):

Wyświetl plik

@ -8,6 +8,6 @@ if (!(version$major == "4" && as.double(version$minor) >= 0 && as.double(version
} }
# The date we have chosen should give us an rspm mirror # The date we have chosen should give us an rspm mirror
if (!(startsWith(options()$repos["CRAN"], "https://packagemanager.rstudio.com"))) { if (!(startsWith(options()$repos["CRAN"], "https://packagemanager.posit.co"))) {
quit("yes", 1) quit("yes", 1)
} }

Wyświetl plik

@ -26,7 +26,7 @@ def test_version_completion(tmpdir):
tmpdir.chdir() tmpdir.chdir()
with open("runtime.txt", "w") as f: with open("runtime.txt", "w") as f:
f.write(f"r-3.6-2019-01-01") f.write("r-3.6-2019-01-01")
r = buildpacks.RBuildPack() r = buildpacks.RBuildPack()
assert r.r_version == "3.6.3" assert r.r_version == "3.6.3"
@ -52,7 +52,7 @@ def test_mran_date(tmpdir, runtime, expected):
def test_snapshot_rspm_date(): def test_snapshot_rspm_date():
test_dates = { test_dates = {
# Even though there is no snapshot specified in the interface at https://packagemanager.rstudio.com/client/#/repos/1/overview # Even though there is no snapshot specified in the interface at https://packagemanager.posit.co/client/#/repos/1/overview
# For 2021 Oct 22, the API still returns a valid URL that one can install # For 2021 Oct 22, the API still returns a valid URL that one can install
# packages from - probably some server side magic that repeats our client side logic. # packages from - probably some server side magic that repeats our client side logic.
# No snapshot for this date from # No snapshot for this date from
@ -65,7 +65,7 @@ def test_snapshot_rspm_date():
for requested, expected in test_dates.items(): for requested, expected in test_dates.items():
snapshot_url = r.get_rspm_snapshot_url(requested) snapshot_url = r.get_rspm_snapshot_url(requested)
assert snapshot_url.startswith( assert snapshot_url.startswith(
"https://packagemanager.rstudio.com/all/__linux__/bionic/" "https://packagemanager.posit.co/all/__linux__/bionic/"
+ expected.strftime("%Y-%m-%d") + expected.strftime("%Y-%m-%d")
) )