From 86e39664b834a8f8c4ded96fcd851fe608255ce7 Mon Sep 17 00:00:00 2001 From: Chris Black Date: Mon, 30 Sep 2024 01:21:40 -0700 Subject: [PATCH 1/3] Fixes in PEcAn.all * avoid leaving temp variables behind in package datasets * save an expensive extra call to package_info * Make did not need to be treating all other packages as prereqs for check/test/doc * A little more cleanup of check messages --- Makefile | 6 ----- base/all/DESCRIPTION | 3 +-- base/all/R/pecan_version.R | 24 +++++++---------- base/all/data/pecan_version_history.R | 5 ++++ base/all/tests/Rcheck_reference.log | 39 --------------------------- 5 files changed, 16 insertions(+), 61 deletions(-) diff --git a/Makefile b/Makefile index 273592d6e67..4160b751007 100644 --- a/Makefile +++ b/Makefile @@ -132,12 +132,6 @@ $(subst .doc/models/template,,$(MODELS_D)): .install/models/template ### Order-only dependencies # (i.e. prerequisites must exist before building target, but # target need not be rebuilt when a prerequisite changes) - -.doc/base/all: | $(ALL_PKGS_D) -.install/base/all: | $(ALL_PKGS_I) -.check/base/all: | $(ALL_PKGS_C) -.test/base/all: | $(ALL_PKGS_T) - include Makefile.depends clean: diff --git a/base/all/DESCRIPTION b/base/all/DESCRIPTION index 6d77c125a9f..2cad68114e2 100644 --- a/base/all/DESCRIPTION +++ b/base/all/DESCRIPTION @@ -1,7 +1,6 @@ Package: PEcAn.all Type: Package -Title: PEcAn functions used for ecological forecasts and - reanalysis +Title: PEcAn Functions Used for Ecological Forecasts and Reanalysis Version: 1.8.0.9000 Authors@R: c(person("Mike", "Dietze", role = c("aut"), email = "dietze@bu.edu"), diff --git a/base/all/R/pecan_version.R b/base/all/R/pecan_version.R index 85c9fc346db..9f6dd63977b 100644 --- a/base/all/R/pecan_version.R +++ b/base/all/R/pecan_version.R @@ -55,23 +55,18 @@ pecan_version <- function(version = max(PEcAn.all::pecan_releases$version), all_pkgs <- sessioninfo::package_info(pkgs = "installed", dependencies = FALSE) our_pkgs <- all_pkgs[grepl("PEcAn", all_pkgs$package),] - all_loaded <- sessioninfo::package_info(pkgs = "loaded", dependencies = FALSE) - our_loaded <- all_loaded[grepl("PEcAn", all_loaded$package),] - - unloaded <- our_pkgs[!our_pkgs$package %in% our_loaded$package,] - our_pkgs <- rbind(our_loaded, unloaded) - our_pkgs <- our_pkgs[order(our_pkgs$package),] - - # TODO: consider using package_info's callouts of packages where loaded and # installed versions mismatch -- it's a more elegant version of what we # were trying for with the "multiple rows for packages with multiple # versions found" behavior. - our_pkgs$installed <- ifelse( - test = is.na(our_pkgs$loadedversion), - yes = our_pkgs$ondiskversion, - no = our_pkgs$loadedversion) - our_pkgs <- our_pkgs[, c("package", "installed", "source")] + our_pkgs <- merge( + x = our_pkgs[,c("package", "ondiskversion", "source")], + y = our_pkgs[!is.na(our_pkgs$loadedversion), c("package", "loadedversion")], + by.x = c("package", "ondiskversion"), + by.y = c("package", "loadedversion"), + all = TRUE, + sort = TRUE) + colnames(our_pkgs) <- c("package", "installed", "source") our_pkgs$installed <- package_version(our_pkgs$installed) } else { @@ -89,7 +84,8 @@ pecan_version <- function(version = max(PEcAn.all::pecan_releases$version), package = names(our_loaded), installed = sapply(our_loaded, `[[`, "Version")) our_loaded$installed <- package_version(our_loaded$installed) - our_pkgs <- merge(our_pkgs, our_loaded, all = TRUE) + our_pkgs <- merge(our_pkgs, our_loaded, all = TRUE, sort = TRUE) + our_pkgs <- our_pkgs[!duplicated(our_pkgs),] } diff --git a/base/all/data/pecan_version_history.R b/base/all/data/pecan_version_history.R index 58f77d31170..09e81860e1a 100644 --- a/base/all/data/pecan_version_history.R +++ b/base/all/data/pecan_version_history.R @@ -23,3 +23,8 @@ for (col in colnames(pecan_version_history)) { strict = strict) } } + +# Now remove local vars +# Yes, this really is needed: _all_ objects left defined at end of script +# will be added to the package data list! +rm(strict, na_version, col) \ No newline at end of file diff --git a/base/all/tests/Rcheck_reference.log b/base/all/tests/Rcheck_reference.log index c03d9bb902b..30cecf2ff34 100644 --- a/base/all/tests/Rcheck_reference.log +++ b/base/all/tests/Rcheck_reference.log @@ -14,38 +14,6 @@ New submission Version contains large components (1.7.2.9000) -License components with restrictions and base license permitting such: - BSD_3_clause + file LICENSE -File 'LICENSE': - University of Illinois/NCSA Open Source License - - Copyright (c) 2012, University of Illinois, NCSA. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal with the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimers. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - Neither the names of University of Illinois, NCSA, nor the names - of its contributors may be used to endorse or promote products - derived from this Software without specific prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR - ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. - Strong dependencies not in mainstream repositories: PEcAn.DB, PEcAn.settings, PEcAn.MA, PEcAn.logger, PEcAn.utils, PEcAn.uncertainty, PEcAn.data.atmosphere, PEcAn.data.land, @@ -54,13 +22,6 @@ Strong dependencies not in mainstream repositories: Suggests or Enhances not in mainstream repositories: PEcAn.ED2, PEcAn.SIPNET, PEcAn.BIOCRO, PEcAn.DALEC, PEcAn.LINKAGES, PEcAn.allometry, PEcAn.photosynthesis - -The Title field should be in title case. Current version is: -‘PEcAn functions used for ecological forecasts and reanalysis’ -In title case that is: -‘PEcAn Functions Used for Ecological Forecasts and Reanalysis’ - -The Date field is over a month old. * checking package namespace information ... OK * checking package dependencies ... NOTE Depends: includes the non-default packages: From 7b31d0f5e01c1273e22b429a4c4a8e740bd07642 Mon Sep 17 00:00:00 2001 From: Chris Black Date: Mon, 30 Sep 2024 01:31:06 -0700 Subject: [PATCH 2/3] whitespace --- base/all/data/pecan_version_history.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/all/data/pecan_version_history.R b/base/all/data/pecan_version_history.R index 09e81860e1a..5e30bcb3460 100644 --- a/base/all/data/pecan_version_history.R +++ b/base/all/data/pecan_version_history.R @@ -27,4 +27,4 @@ for (col in colnames(pecan_version_history)) { # Now remove local vars # Yes, this really is needed: _all_ objects left defined at end of script # will be added to the package data list! -rm(strict, na_version, col) \ No newline at end of file +rm(strict, na_version, col) From f62c8ec17e50909540f9cf9e78221ccc657a479f Mon Sep 17 00:00:00 2001 From: Chris Black Date: Tue, 1 Oct 2024 00:07:53 -0700 Subject: [PATCH 3/3] ok we did need the second package_info call --- base/all/R/pecan_version.R | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/base/all/R/pecan_version.R b/base/all/R/pecan_version.R index 9f6dd63977b..4563a4cfdfd 100644 --- a/base/all/R/pecan_version.R +++ b/base/all/R/pecan_version.R @@ -55,15 +55,21 @@ pecan_version <- function(version = max(PEcAn.all::pecan_releases$version), all_pkgs <- sessioninfo::package_info(pkgs = "installed", dependencies = FALSE) our_pkgs <- all_pkgs[grepl("PEcAn", all_pkgs$package),] + # Why do we need this when `pkgs = "installed"` usually shows loaded too? + # Because there are times a package is loaded but not installed + # (e.g. notably during R CMD check) + all_loaded <- sessioninfo::package_info(pkgs = "loaded", dependencies = FALSE) + our_loaded <- all_loaded[grepl("PEcAn", all_loaded$package),] + # TODO: consider using package_info's callouts of packages where loaded and # installed versions mismatch -- it's a more elegant version of what we # were trying for with the "multiple rows for packages with multiple # versions found" behavior. our_pkgs <- merge( - x = our_pkgs[,c("package", "ondiskversion", "source")], - y = our_pkgs[!is.na(our_pkgs$loadedversion), c("package", "loadedversion")], - by.x = c("package", "ondiskversion"), - by.y = c("package", "loadedversion"), + x = our_pkgs[, c("package", "ondiskversion", "source")], + y = our_loaded[, c("package", "loadedversion", "source")], + by.x = c("package", "ondiskversion", "source"), + by.y = c("package", "loadedversion", "source"), all = TRUE, sort = TRUE) colnames(our_pkgs) <- c("package", "installed", "source")