Skip to content

Cannot parse multiple git:: Remotes #318

Closed

Description

@lgaborini

{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", , "[email protected]", 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::[email protected]:cran/falsy.git
    git::[email protected]: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::[email protected]:cran/falsy.git",
   "git::[email protected]: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::[email protected]:cran/falsy.git"
)
#> $package
#> [1] "falsy"
#> 
#> $protocol
#> [1] ""
#> 
#> $host
#> [1] "[email protected]:cran"
#> 
#> $path
#> [1] "/"
#> 
#> $repo
#> [1] "falsy"
#> 
#> $commitish
#> [1] "HEAD"
#> 
#> $ref
#> [1] "git::[email protected]:cran/falsy.git"
#> 
#> $type
#> [1] "git"
#> 
#> $dotgit
#> [1] ".git"
#> 
#> $url
#> [1] "://[email protected]: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::[email protected]:cran/falsy.git",
   "git::[email protected]:cran/falsy2.git"
))
#> Error in if (grepl("[.]git$", pds$repo)) ".git" else "": the condition has length > 1

pkgdepends::parse_pkg_refs(c(
   "git::[email protected]:cran/falsy.git",
   "git::[email protected]: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!

Activity

  1. added
    bug
    on May 23, 2023
  2. lgaborini commented on May 23, 2023

    @lgaborini
    Author

    Amazing 🥂

  3. added a commit that references this issue on Nov 2, 2024
    1a15779
  4. added a commit that references this issue on May 11, 2026
  5. added a commit that references this issue on May 14, 2026
  6. added a commit that references this issue on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions