diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index b877db0..0d81007 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ -Version: 0.1.0 -Date: 2024-01-13 17:01:35 UTC -SHA: fd2f234b30b0a802fbed3cdad3ccbd4d22b6a58a +Version: 0.1.2 +Date: 2024-07-31 14:47:25 UTC +SHA: 6c89e6f5986430ea6f2556f4e628bbb62f8b2f5b diff --git a/b64.Rproj b/b64.Rproj deleted file mode 100644 index 69fafd4..0000000 --- a/b64.Rproj +++ /dev/null @@ -1,22 +0,0 @@ -Version: 1.0 - -RestoreWorkspace: No -SaveWorkspace: No -AlwaysSaveHistory: Default - -EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 -Encoding: UTF-8 - -RnwWeave: Sweave -LaTeX: pdfLaTeX - -AutoAppendNewline: Yes -StripTrailingWhitespace: Yes -LineEndingConversion: Posix - -BuildType: Package -PackageUseDevtools: Yes -PackageInstallArgs: --no-multiarch --with-keep.source -PackageRoxygenize: rd,collate,namespace diff --git a/configure b/configure index d656e00..0f4c1be 100755 --- a/configure +++ b/configure @@ -1,20 +1,3 @@ #!/usr/bin/env sh - -# https://github.com/eitsupi/prqlr/blob/main/configure -export PATH="$PATH:$HOME/.cargo/bin" - -if [ ! "$(command -v cargo)" ]; then - echo "----------------------- [RUST NOT FOUND]---------------------------" - echo "The 'cargo' command was not found on the PATH. Please install rustc" - echo "from: https://www.rust-lang.org/tools/install" - echo "" - echo "Alternatively, you may install cargo from your OS package manager:" - echo " - Debian/Ubuntu: apt-get install cargo" - echo " - Fedora/CentOS: dnf install cargo" - echo " - macOS: brew install rustc" - echo "-------------------------------------------------------------------" - echo "" - exit 1 -fi - -exit 0 +: "${R_HOME=`R RHOME`}" +"${R_HOME}/bin/Rscript" tools/msrv.R diff --git a/configure.win b/configure.win index d9b66ed..f1945ac 100644 --- a/configure.win +++ b/configure.win @@ -1,15 +1,2 @@ -#!/bin/sh - -# https://github.com/eitsupi/prqlr/blob/main/configure.win -export PATH="$PATH:$HOME/.cargo/bin" - -if [ ! "$(command -v cargo)" ]; then - echo "----------------------- [RUST NOT FOUND]---------------------------" - echo "The 'cargo' command was not found on the PATH. Please install rustc" - echo "from: https://www.rust-lang.org/tools/install" - echo "-------------------------------------------------------------------" - echo "" - exit 1 -fi - -exit 0 +#!/usr/bin/env sh +"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" tools/msrv.R diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..85fdf84 --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,7 @@ +## R CMD check results + +This release addresses failing CRAN checks. + +0 errors | 0 warnings | 1 note + +* This is a new release. diff --git a/src/Makevars.win b/src/Makevars.win index 3f07c56..cf434e5 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -13,13 +13,6 @@ CRAN_FLAGS=-j 2 --offline CARGOTMP = $(CURDIR)/.cargo VENDOR_DIR = $(CURDIR)/vendor -all: C_clean - -$(SHLIB): $(STATLIB) - -CRAN_FLAGS=-j 2 --offline -CARGOTMP = $(CURDIR)/.cargo - $(STATLIB): # uncompress vendored deps if [ -f ./rust/vendor.tar.xz ]; then \ diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index 43b6fb5..0b7ad75 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -25,9 +25,9 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "extendr-api" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0701db497d091675e50bb10ba870999742cd1e9a9d94cf3fb52f3ea9a7629c0" +checksum = "67505d96c7faa49d20e749dba7ba2447db52c40a788fd88cc2b6bef02c02277a" dependencies = [ "either", "extendr-macros", @@ -38,9 +38,9 @@ dependencies = [ [[package]] name = "extendr-macros" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d6b806beee182ab3e1105c822df137913b894847a13ec29dfbff9abfb6d1d2" +checksum = "81b58838056f294411d0b2c35ac1a2b24c507d6828b75f2c1e74f00ee9b99267" dependencies = [ "proc-macro2", "quote", @@ -58,8 +58,9 @@ dependencies = [ [[package]] name = "libR-sys" -version = "0.7.0" -source = "git+https://github.com/extendr/libR-sys?rev=976c56d396175f8d09548b0a1f0a77fc393018f2#976c56d396175f8d09548b0a1f0a77fc393018f2" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ac9752bc1e83f5a354a62b9e81bd8db4468b1008e29f262441e7f0e91e6bb3" [[package]] name = "once_cell" @@ -84,18 +85,18 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] [[package]] name = "syn" -version = "2.0.72" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -104,6 +105,6 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index 5046c0e..4387792 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -10,11 +10,9 @@ name = 'b64' [dependencies] base64 = "0.21.7" -extendr-api = { version = "0.7.0", features = ["either"] } +extendr-api = { version = "0.7.1", features = ["either"] } itertools = "0.12.0" -[patch.crates-io] -libR-sys = { git = "https://github.com/extendr/libR-sys", rev = "976c56d396175f8d09548b0a1f0a77fc393018f2" } [profile.release] lto = true diff --git a/src/rust/vendor-config.toml b/src/rust/vendor-config.toml index 9fc606b..0236928 100644 --- a/src/rust/vendor-config.toml +++ b/src/rust/vendor-config.toml @@ -1,10 +1,5 @@ [source.crates-io] replace-with = "vendored-sources" -[source."git+https://github.com/extendr/libR-sys?rev=976c56d396175f8d09548b0a1f0a77fc393018f2"] -git = "https://github.com/extendr/libR-sys" -rev = "976c56d396175f8d09548b0a1f0a77fc393018f2" -replace-with = "vendored-sources" - [source.vendored-sources] directory = "vendor" diff --git a/src/rust/vendor.tar.xz b/src/rust/vendor.tar.xz index fada1b0..e35dd74 100644 Binary files a/src/rust/vendor.tar.xz and b/src/rust/vendor.tar.xz differ diff --git a/tools/msrv.R b/tools/msrv.R new file mode 100644 index 0000000..baa33aa --- /dev/null +++ b/tools/msrv.R @@ -0,0 +1,116 @@ +# read the DESCRIPTION file +desc <- read.dcf("DESCRIPTION") + +if (!"SystemRequirements" %in% colnames(desc)) { + fmt <- c( + "`SystemRequirements` not found in `DESCRIPTION`.", + "Please specify `SystemRequirements: Cargo (Rust's package manager), rustc`" + ) + stop(paste(fmt, collapse = "\n")) +} + +# extract system requirements +sysreqs <- desc[, "SystemRequirements"] + +# check that cargo and rustc is found +if (!grepl("cargo", sysreqs, ignore.case = TRUE)) { + stop("You must specify `Cargo (Rust's package manager)` in your `SystemRequirements`") +} + +if (!grepl("rustc", sysreqs, ignore.case = TRUE)) { + stop("You must specify `Cargo (Rust's package manager), rustc` in your `SystemRequirements`") +} + +# split into parts +parts <- strsplit(sysreqs, ", ")[[1]] + +# identify which is the rustc +rustc_ver <- parts[grepl("rustc", parts)] + +# perform checks for the presence of rustc and cargo on the OS +no_cargo_msg <- c( + "----------------------- [CARGO NOT FOUND]--------------------------", + "The 'cargo' command was not found on the PATH. Please install Cargo", + "from: https://www.rust-lang.org/tools/install", + "", + "Alternatively, you may install Cargo from your OS package manager:", + " - Debian/Ubuntu: apt-get install cargo", + " - Fedora/CentOS: dnf install cargo", + " - macOS: brew install rustc", + "-------------------------------------------------------------------" +) + +no_rustc_msg <- c( + "----------------------- [RUST NOT FOUND]---------------------------", + "The 'rustc' compiler was not found on the PATH. Please install", + paste(rustc_ver, "or higher from:"), + "https://www.rust-lang.org/tools/install", + "", + "Alternatively, you may install Rust from your OS package manager:", + " - Debian/Ubuntu: apt-get install rustc", + " - Fedora/CentOS: dnf install rustc", + " - macOS: brew install rustc", + "-------------------------------------------------------------------" +) + +# Add {user}/.cargo/bin to path before checking +new_path <- paste0( + Sys.getenv("PATH"), + ":", + paste0(Sys.getenv("HOME"), "/.cargo/bin") +) + +# set the path with the new path +Sys.setenv("PATH" = new_path) + +# check for rustc installation +rustc_version <- tryCatch( + system("rustc --version", intern = TRUE), + error = function(e) { + stop(paste(no_rustc_msg, collapse = "\n")) + } +) + +# check for cargo installation +cargo_version <- tryCatch( + system("cargo --version", intern = TRUE), + error = function(e) { + stop(paste(no_cargo_msg, collapse = "\n")) + } +) + +# helper function to extract versions +extract_semver <- function(ver) { + if (grepl("\\d+\\.\\d+(\\.\\d+)?", ver)) { + sub(".*?(\\d+\\.\\d+(\\.\\d+)?).*", "\\1", ver) + } else { + NA + } +} + +# get the MSRV +msrv <- extract_semver(rustc_ver) + +# extract current version +current_rust_version <- extract_semver(rustc_version) + +# perform check +if (!is.na(msrv)) { + # -1 when current version is later + # 0 when they are the same + # 1 when MSRV is newer than current + is_msrv <- utils::compareVersion(msrv, current_rust_version) + if (is_msrv == 1) { + fmt <- paste0( + "\n------------------ [UNSUPPORTED RUST VERSION]------------------\n", + "- Minimum supported Rust version is %s.\n", + "- Installed Rust version is %s.\n", + "---------------------------------------------------------------" + ) + stop(sprintf(fmt, msrv, current_rust_version)) + } +} + +# print the versions +versions_fmt <- "Using %s\nUsing %s" +message(sprintf(versions_fmt, cargo_version, rustc_version))