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

Add the feature to update renv.lock provided as an input #18

Merged
merged 23 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ builds:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
# - darwin
# - windows
walkowif marked this conversation as resolved.
Show resolved Hide resolved
goarch:
- amd64
- arm64
# - arm64
ldflags:
- -s -w
- -X go.szostok.io/version.version={{.Version}}
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ help: ## Show this help menu

devdeps: ## Install development dependencies
@printf "Executing target: [$@] 🎯\n"
@which -a golangci-lint > /dev/null || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH) v1.55.0
@which -a golangci-lint > /dev/null || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH) v1.55.2
@which -a typex > /dev/null || go install github.com/dtgorski/typex@latest
@which -a goreleaser > /dev/null || go install github.com/goreleaser/goreleaser@latest
@which -a gocover-cobertura > /dev/null || go install github.com/boumenot/gocover-cobertura@latest
Expand Down Expand Up @@ -60,7 +60,7 @@ format: ## Format source code

lint: devdeps spell ## Lint source code
@printf "Executing target: [$@] 🎯\n"
@golangci-lint run --fast -c .golangci.yml
@golangci-lint run -c .golangci.yml

test: clean tidy devdeps spell ## Run unit tests and generate reports
@printf "Executing target: [$@] 🎯\n"
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ as opposed to `inputPackageList` and `inputRepositoryList` CLI flags/YAML keys.
Additionally, `inputPackageList`/`inputRepositoryList` CLI flags take precendence over
`inputPackages`/`inputRepositories` YAML keys.

Please note that package repository URLs should be provided without the trailing `/`.

## Environment variables

`locksmith` reads environment variables with `LOCKSMITH_` prefix and tries to match them with CLI
Expand All @@ -100,7 +102,7 @@ CLI flag → environment variable → configuration file → default value.

## Binary dependencies

For `locksmith` in order to generate an `renv.lock` with binary R packages,
If `locksmith` should generate an `renv.lock` with binary R packages,
it is necessary to provide URLs to binary repositories via `inputRepositories`/`inputRepositoryList`.

Examples illustrating the expected format of URLs to repositories with binary packages:
Expand All @@ -120,7 +122,7 @@ Examples illustrating the expected format of URLs to repositories with binary pa

where `<r-version>` is e.g. `4.2`, `4.3` etc.

In all cases the URL points to a directory where the `PACKAGES` file is located.
In all cases the URL points to a directory where the `PACKAGES` file is located, without the trailing `/`.

As a result, the configuration file could look like this:

Expand Down Expand Up @@ -152,6 +154,10 @@ Simply list the types of dependencies which should not cause the `renv.lock` gen
locksmith --allowIncompleteRenvLock 'Imports,Depends,Suggests,LinkingTo'
```

## Updating existing `renv.lock`

TODO

## Development

This project is built with the [Go programming language](https://go.dev/).
Expand Down
4 changes: 2 additions & 2 deletions cmd/construct.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func ConstructOutputPackageList(packages []PackageDescription, packagesFiles map
outputPackageList = append(outputPackageList, PackageDescription{
p.Package, p.Version, p.Source, "", []Dependency{},
p.RemoteType, p.RemoteHost, p.RemoteUsername, p.RemoteRepo, p.RemoteSubdir,
p.RemoteRef, p.RemoteSha,
p.RemoteRef, p.RemoteSha, []string{},
})
}
for _, p := range packages {
Expand Down Expand Up @@ -120,7 +120,7 @@ func ResolveDependenciesRecursively(outputList *[]PackageDescription, name strin
// during the processing of output package list into renv.lock file.
*outputList = append(*outputList, PackageDescription{
p.Package, p.Version, "Repository", r, []Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
})
for _, d := range p.Dependencies {
if d.DependencyType == "Depends" || d.DependencyType == "Imports" ||
Expand Down
66 changes: 33 additions & 33 deletions cmd/construct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func Test_ConstructOutputPackageList(t *testing.T) {
"",
},
},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package4",
Expand All @@ -146,14 +146,14 @@ func Test_ConstructOutputPackageList(t *testing.T) {
"",
},
},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package11",
"0.7.8",
"", "",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package14",
Expand All @@ -173,28 +173,28 @@ func Test_ConstructOutputPackageList(t *testing.T) {
"2.2",
},
},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package16",
"2.4.5",
"", "",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package6",
"3.0.1",
"", "",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package10",
"3.0.2",
"", "",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
},
}
Expand Down Expand Up @@ -224,21 +224,21 @@ func Test_ConstructOutputPackageList(t *testing.T) {
"",
},
},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package5",
"3.2.0",
"", "",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package7",
"1.6.2",
"", "",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package9",
Expand All @@ -252,28 +252,28 @@ func Test_ConstructOutputPackageList(t *testing.T) {
"3.6",
},
},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package11",
"5.4.7",
"", "",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package12",
"1.2.3",
"", "",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package15",
"3.3.4.5",
"", "",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
},
}
Expand All @@ -284,7 +284,7 @@ func Test_ConstructOutputPackageList(t *testing.T) {
"1.9.2",
"", "",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
},
}
Expand Down Expand Up @@ -339,7 +339,7 @@ func Test_ConstructOutputPackageList(t *testing.T) {
"1.0.0",
},
},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package2",
Expand Down Expand Up @@ -390,7 +390,7 @@ func Test_ConstructOutputPackageList(t *testing.T) {
"",
},
},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
},
packagesFiles, repositoryList,
Expand All @@ -407,23 +407,23 @@ func Test_ConstructOutputPackageList(t *testing.T) {
"GitHub",
"",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package2",
"2.3.4",
"GitHub",
"",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package3",
"1.2.0",
"Repository",
"https://repo1.example.com/ExampleRepo1",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
// package11 removed from here
Expand All @@ -432,103 +432,103 @@ func Test_ConstructOutputPackageList(t *testing.T) {
// However afterwards, package4 requested package11 >= 4.5
// so it had to be retrieved from repo2.
// The reference to repo1 was overwritten here.
"", "", "", "", []Dependency{}, "", "", "", "", "", "", "",
"", "", "", "", []Dependency{}, "", "", "", "", "", "", "", []string{},
},
{
"package12",
"1.2.3",
"Repository",
"https://repo2.example.com/ExampleRepo2",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package4",
"1.1.1",
"Repository",
"https://repo2.example.com/ExampleRepo2",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package11",
"5.4.7",
"Repository",
"https://repo2.example.com/ExampleRepo2",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package14",
"2.5.8",
"Repository",
"https://repo1.example.com/ExampleRepo1",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package15",
"3.3.4.5",
"Repository",
"https://repo2.example.com/ExampleRepo2",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package16",
"2.4.5",
"Repository",
"https://repo1.example.com/ExampleRepo1",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package5",
"3.2.0",
"Repository",
"https://repo2.example.com/ExampleRepo2",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package6",
"3.0.1",
"Repository",
"https://repo1.example.com/ExampleRepo1",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package7",
"1.6.2",
"Repository",
"https://repo2.example.com/ExampleRepo2",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package8",
"1.9.2",
"Repository",
"https://repo3.example.com/ExampleRepo3",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package9",
"2.4",
"Repository",
"https://repo2.example.com/ExampleRepo2",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
{
"package10",
"3.0.2",
"Repository",
"https://repo1.example.com/ExampleRepo1",
[]Dependency{},
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", []string{},
},
},
)
Expand Down
Loading
Loading