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

Cannot parse multiple git:: Remotes #318

Closed
lgaborini opened this issue May 23, 2023 · 1 comment
Closed

Cannot parse multiple git:: Remotes #318

lgaborini opened this issue May 23, 2023 · 1 comment
Labels
bug an unexpected problem or unintended behavior

Comments

@lgaborini
Copy link

{pkgdepends} cannot parse DESCRIPTIONs with more than one git remote like these:

Package: pkgdepends-reprex
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R: 
    person("First", "Last", , "first.last@example.com", role = c("aut", "cre"),
           comment = c(ORCID = "YOUR-ORCID-ID"))
Description: What the package does (one paragraph).
License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a
    license
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Remotes:
    git::git@github.com:cran/falsy.git
    git::git@github.com:cran2/falsy.git

Reprex for the DESCRIPTION (for some reason I've had to add local:: to the package path, as opposed to other reprexes seen here)

temp_desc <- desc::desc("!new")
temp_desc$set_remotes(c(
   "git::git@github.com:cran/falsy.git",
   "git::git@github.com:cran2/falsy.git"
))
temp_desc_path <- tempfile()
temp_desc$write(temp_desc_path)

x <- pkgdepends::new_pkg_deps(paste0("local::", temp_desc_path), config = list(library = tempfile()))
x$solve()
x$get_solution()
#> <pkg_solution>
#> + result: FAILED
#> + refs:
#>   - local::C:\Users\LORENZ~1\AppData\Local\Temp\RtmpQJQC7I\file809c3a3e607a
#> + constraints (2):
#>   - `local::C:\Users\LORENZ~1\AppData\Local\Temp\RtmpQJQC7I\file809c3a3e607a` resolution failed
#>   - select NA exactly once
#> x failures:
#> * local::C:\Users\LORENZ~1\AppData\Local\Temp\RtmpQJQC7I\file809c3a3e607a: ! pkgdepends resolution error for
#> local::C:\Users\LORENZ~1\AppData\Local\Temp\RtmpQJQC7I\file809c3a3e607a.
#> Caused by error: 
#> ! the condition has length > 1

Created on 2023-05-23 with reprex v2.0.2

I think it boils down to the Remotes: section.
No issues while parsing one single Remote entry.

My goal is to pull from multiple private Azure repos via HTTPS (git::https://dev.azure.com/user/project/_git/pkg1).

Minimal reprex:

pkgdepends::parse_pkg_ref(
   "git::git@github.com:cran/falsy.git"
)
#> $package
#> [1] "falsy"
#> 
#> $protocol
#> [1] ""
#> 
#> $host
#> [1] "git@github.com:cran"
#> 
#> $path
#> [1] "/"
#> 
#> $repo
#> [1] "falsy"
#> 
#> $commitish
#> [1] "HEAD"
#> 
#> $ref
#> [1] "git::git@github.com:cran/falsy.git"
#> 
#> $type
#> [1] "git"
#> 
#> $dotgit
#> [1] ".git"
#> 
#> $url
#> [1] "://git@github.com:cran/falsy.git"
#> 
#> $params
#> character(0)
#> 
#> attr(,"class")
#> [1] "remote_ref_git" "remote_ref"     "list"
# outside GitHub, custom package name
pkgdepends::parse_pkg_ref(
   "Package1=git::https://dev.azure.com/user/project/_git/pkg1"
)
#> $package
#> [1] "Package1"
#> 
#> $protocol
#> [1] "https"
#> 
#> $host
#> [1] "dev.azure.com"
#> 
#> $path
#> [1] "/user/project/_git/"
#> 
#> $repo
#> [1] "pkg1"
#> 
#> $commitish
#> [1] "HEAD"
#> 
#> $ref
#> [1] "Package1=git::https://dev.azure.com/user/project/_git/pkg1"
#> 
#> $type
#> [1] "git"
#> 
#> $dotgit
#> [1] ""
#> 
#> $url
#> [1] "https://dev.azure.com/user/project/_git/pkg1"
#> 
#> $params
#> character(0)
#> 
#> attr(,"class")
#> [1] "remote_ref_git" "remote_ref"     "list"

pkgdepends::parse_pkg_refs(c(
   "git::git@github.com:cran/falsy.git",
   "git::git@github.com:cran/falsy2.git"
))
#> Error in if (grepl("[.]git$", pds$repo)) ".git" else "": the condition has length > 1

pkgdepends::parse_pkg_refs(c(
   "git::git@github.com:cran/falsy.git",
   "git::git@github.com:cran/falsy2.git",
   "Package1=git::https://dev.azure.com/user/project/_git/pkg1"
))
#> Error in if (grepl("[.]git$", pds$repo)) ".git" else "": the condition has length > 1

Created on 2023-05-23 with reprex v2.0.2

I'm already using the latest pkgdepends 0.5.0.9000 (github::r-lib/pkgdepends@72fa8f2).
Thanks!

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label May 23, 2023
@lgaborini
Copy link
Author

Amazing 🥂

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jan 25, 2024
# pak 0.7.1

* pak can now handle the case when `Config/Needs/*` dependencies
  are requested for package from a repository.

* pak uses safer `*printf()` format strings now.

# pak 0.7.0

* pak now correctly handles the latest GitHub release with
  the `@*release` notation (@pawelru,
  r-lib/pkgdepends#321)

* pak now correctly handles having multiple instances of the same
  package in the metadata, with different R version requirements
  (#534, #538, r-lib/pkgdepends#331).

* `git::` package references work better now for Azure DevOps
  (@jameslairdsmith, r-lib/pkgdepends#333,
  r-lib/pkgdepends#342).

* pak now does a better job at accepting installed packages, and
  avoids reinstalling more packages than needed when using a lock file
  (r-lib/actions#759,
  r-lib/pkgdepends#338).

# pak 0.6.0

* pak now requires R >= 3.5.0.

* Many improvements in system requirements support:
  - New functions:
    - `pkg_sysreqs()`: calculate system requirements of packages.
    - `sysreqs_db_list()`, `sysreqs_db_match()`, `sysreqs_db_update()`:
      query the system requirements database.
    - `sysreqs_list_system_packages()`, `sysreqs_check_installed()`,
      `sysreqs_fix_installed()`: query and install missing system packages.
    - `sysreqs_platforms()`: list supported platforms.
  - The installation proposal, printed before installation, now includes
    required and missing system packages, on supported platforms.
  - New `sysreqs_platform` configuration option to override the auto-detected
    platform.
  - Faster, asynchronous system requirements lookup.
  - pak now does not reinstall system requirements by default,
    if they are already installed. (You can force a reinstall/upgrade
    with the `sysreqs_update` configuration option.)

* New `gitlab::` package source to install packages from GitLab
  (r-lib/pkgdepends#315).

* pak now correctly parses multiple `git::` packages at once
  (r-lib/pkgdepends#318).

* `git::` package sources now support version 1 of the git protocol.
  E.g. the Bioconductor git repositories now work:
  `git::https://git.bioconductor.org/packages/limma`
  (r-lib/pkgdepends#314).

* The `platforms` config parameter now works correctly with `deps::`
  package sources (#522).

* New `include_linkingto` config parameter to always include `LinkingTo`
  packages in the solution, even for binaries
  (https://github.com/r-lib/pkgdepends/issues/485).

* `pkg_name_check()` now does not include Acromine results, because the web
  site was unstable.

* In `repo_add()` and `repo_resolve()` the `MRAN@` prefix is now deprecated
  and resolves to PPM, because MRAN will be retired soon. See more at
  <https://posit.co/blog/migrating-from-mran-to-posit-package-manager/>.

* The metadata cache now has `SystemRequirements` information for Bioconductor
  packages.
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