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

Do not use the alternative Archive URL on PPM #623

Closed
gaborcsardi opened this issue May 2, 2024 · 5 comments
Closed

Do not use the alternative Archive URL on PPM #623

gaborcsardi opened this issue May 2, 2024 · 5 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@gaborcsardi
Copy link
Member

gaborcsardi commented May 2, 2024

Because sometimes PPM serves a source package there, while serving a binary at the proper URL:

! error in pak subprocess
Caused by error in `verify_extracted_package(filename, pkg_cache)`:
! 
'/tmp/RtmpraRRfO/file10aed93d50/src/contrib/x86_64-pc-linux-gnu-ubuntu-22.04/4.4/later_1.3.2.tar.gz'
is not a valid binary, it is missing later/Meta/package.rds.

pak only uses the alternative URL for a repo named 'CRAN', so a workaround is to name your repo something else, e.g. 'PPM' seems appropriate.

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label May 2, 2024
@gaborcsardi
Copy link
Member Author

We only use it if the repo is called CRAN, but that's not enough, because people sometimes use PPM with the name CRAN.

@gaborcsardi
Copy link
Member Author

This needs to be fixed somewhere here: https://github.com/r-lib/pkgcache/blob/c227fe90b20959ac0d3f4e8a2897ed9117f70ee0/R/packages-gz.R#L311
Maybe we can filter based on the URL, e.g. if the URL contains __linux__. It should only matter on Linux, on other platforms we don't use the Archive.

@alethor
Copy link

alethor commented May 3, 2024

I'm slightly confused about how this workaround works, could you give a concrete example?

@gaborcsardi
Copy link
Member Author

@alethor

> options(repos = c(CRAN = "https://packagemanager.posit.co/cran/__linux__/jammy/latest"))

> pak::pkg_install("hommel")
✔ Updated metadata database: 3.70 MB in 9 files.
✔ Updating metadata database ... done

→ Will install 1 package.
→ Will download 1 package with unknown size.
+ hommel   1.6 [dl]

ℹ Getting 1 pkg with unknown size
✔ Got hommel 1.6 (x86_64-pc-linux-gnu-ubuntu-22.04) (11.43 kB)
✔ Downloaded 1 package (11.43 kB) in 1.3s
Error:
! error in pak subprocess
Caused by error in `verify_extracted_package(filename, pkg_cache)`:
! /tmp/RtmpZFurxM/file31416a7e1f/src/contrib/x86_64-pc-linux-gnu-ubuntu-22.04/4.4/hommel_1.6.tar.gz is not a valid binary, it is
missing hommel/Meta/package.rds.
Type .Last.error to see the more details.

OTOH:

> options(repos = c(PPM = "https://packagemanager.posit.co/cran/__linux__/jammy/latest"))
> pak::pkg_install("hommel")
✔ Updated metadata database: 4.79 MB in 4 files.
✔ Updating metadata database ... done

→ Will install 1 package.
→ Will download 1 package with unknown size.
+ hommel   1.6 [dl]

ℹ Getting 1 pkg with unknown size
✔ Got hommel 1.6 (x86_64-pc-linux-gnu-ubuntu-22.04) (206.95 kB)
✔ Downloaded 1 package (206.95 kB) in 1.1s
✔ Installed hommel 1.6  (1s)
✔ 1 pkg + 1 dep: kept 1, added 1, dld 1 (206.95 kB) [10.9s]

gaborcsardi added a commit to r-lib/pkgcache that referenced this issue May 3, 2024
gaborcsardi added a commit that referenced this issue May 3, 2024
@gaborcsardi
Copy link
Member Author

This is now fixed in the nightly builds, install like this: https://pak.r-lib.org/reference/install.html#nightly-builds

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Oct 21, 2024
# pkgcache 2.2.3

* The metadata cache now does not use source URLs for packages in `Archive`
  on Posit Package Manager repositories. This URLs may serve a different
  package, even a source package when the main URL for the same package
  serves a binary package. The alternative URLs are not needed on PPM,
  anyway, because PPM is in a consistent state w.r.t. metadata and
  package files (r-lib/pak#623).

* `parse_packages()` now does not throw a warning for empty `PACKAGES*`
  files (#107).

* `repo_set()` and the `ppm_*()` functions, e.g. `ppm_snapshots()`, now
  work again after the PPM API changes (#110, #115).

# pkgcache 2.2.2

* pkgcache now treats R 4.5.x (current R-devel) macOS binaries
  correctly. It is also more robust to changes the in macOS platform.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants