Skip to content

Commit

Permalink
build: add filles and update scripts to generate geospatial-dev-osgeo…
Browse files Browse the repository at this point in the history
… Dockerfile
  • Loading branch information
eitsupi committed Apr 28, 2024
1 parent 7427de3 commit 07e82a0
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 17 deletions.
17 changes: 0 additions & 17 deletions build/scripts/generate-args.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,6 @@ latest_ctan_url <- function(date) {
}


#' Get the latest version from Git remote tags
#' @param remote_repo A single character of Git remote repository URL.
#' @return A character of the latest version.
#' @examples
#' latest_version_of_git_repo("https://github.com/OSGeo/PROJ.git")
latest_version_of_git_repo <- function(remote_repo) {
gert::git_remote_ls(remote = remote_repo) |>
dplyr::pull(ref) |>
stringr::str_subset(r"(^refs/tags/v?(\d+\.){2}\d+$)") |>
stringr::str_extract(r"((\d+\.)*\d+$)") |>
package_version() |>
sort() |>
utils::tail(1) |>
as.character()
}


#' Paste each element of vectors in a cartesian product
#' @param ... Dynamic dots. Character vectors to paste.
#' @return A character vector.
Expand Down
16 changes: 16 additions & 0 deletions build/scripts/generate-dockerfiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,19 @@ tibble::tibble(
)
}
)


tibble::tibble(
r_version = readr::read_tsv("build/variables/r-versions.tsv", show_col_types = FALSE)$r_version |>
dplyr::last(),
proj_version = readr::read_tsv("build/variables/proj-versions.tsv", show_col_types = FALSE)$proj_version |>
dplyr::last(),
gdal_version = readr::read_tsv("build/variables/gdal-versions.tsv", show_col_types = FALSE)$gdal_version |>
dplyr::last(),
geos_version = readr::read_tsv("build/variables/geos-versions.tsv", show_col_types = FALSE)$geos_version |>
dplyr::last()
) |>
write_dockerfiles(
dockerfile_template = readr::read_file("build/templates/dockerfiles/geospatial-dev-osgeo.Dockerfile.txt"),
path_template = "dockerfiles/geospatial-dev-osgeo.Dockerfile"
)
36 changes: 36 additions & 0 deletions build/scripts/generate-variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,23 @@ get_github_commit_date <- function(commit_url) {
}


#' Get the latest version from Git remote tags
#' @param remote_repo A single character of Git remote repository URL.
#' @return A character of the latest version.
#' @examples
#' latest_version_of_git_repo("https://github.com/OSGeo/PROJ.git")
latest_version_of_git_repo <- function(remote_repo) {
gert::git_remote_ls(remote = remote_repo) |>
dplyr::pull(ref) |>
stringr::str_subset(r"(^refs/tags/v?(\d+\.){2}\d+$)") |>
stringr::str_extract(r"((\d+\.)*\d+$)") |>
package_version() |>
sort() |>
utils::tail(1) |>
as.character()
}


r_versions_with_freeze_dates() |>
readr::write_tsv("build/variables/r-versions.tsv", na = "")

Expand All @@ -103,3 +120,22 @@ ubuntu_lts_versions() |>

rstudio_versions() |>
readr::write_tsv("build/variables/rstudio-versions.tsv", na = "")


# geospatial-dev-osgeo's variables
tibble::tibble(
proj_version = latest_version_of_git_repo("https://github.com/OSGeo/PROJ.git")
) |>
readr::write_tsv("build/variables/proj-versions.tsv", na = "")


tibble::tibble(
gdal_version = latest_version_of_git_repo("https://github.com/OSGeo/gdal.git")
) |>
readr::write_tsv("build/variables/gdal-versions.tsv", na = "")


tibble::tibble(
geos_version = latest_version_of_git_repo("https://github.com/libgeos/geos.git")
) |>
readr::write_tsv("build/variables/geos-versions.tsv", na = "")
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM rocker/verse:{{r_version}}

ENV PROJ_VERSION="{{proj_version}}"
ENV GDAL_VERSION="{{gdal_version}}"
ENV GEOS_VERSION="{{geos_version}}"

COPY scripts/experimental/install_dev_osgeo.sh /rocker_scripts/experimental/install_dev_osgeo.sh
RUN /rocker_scripts/experimental/install_dev_osgeo.sh
2 changes: 2 additions & 0 deletions build/variables/gdal-versions.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gdal_version
3.8.5
2 changes: 2 additions & 0 deletions build/variables/geos-versions.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
geos_version
3.12.1
2 changes: 2 additions & 0 deletions build/variables/proj-versions.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
proj_version
9.4.0

0 comments on commit 07e82a0

Please sign in to comment.