From f48671b09ca11e5b4ebf7177125fa8995957faab Mon Sep 17 00:00:00 2001 From: Alexis Lucattini Date: Sat, 2 Mar 2019 16:16:18 +1100 Subject: [PATCH 1/7] Make sure that the DESCRIPTION file actually has data inside it before reading --- R/install.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/install.R b/R/install.R index 6ae38936..7a8d5a7c 100644 --- a/R/install.R +++ b/R/install.R @@ -323,6 +323,11 @@ load_pkg_description <- function(path) { stop("No description at ", path_desc, call. = FALSE) } + # Check description is not empty + if (file.info(path_desc)$size == 0){ + stop("Description filie is empty at ", path_desc, call. = FALSE) + } + desc <- as.list(readDcf(path_desc)[1, ]) names(desc) <- tolower(names(desc)) desc$path <- path From afb1f2bb0137a182cca3059aad9bd37701b63218 Mon Sep 17 00:00:00 2001 From: Alexis Lucattini Date: Mon, 7 Oct 2019 11:10:27 +1100 Subject: [PATCH 2/7] Extra verbosity on basedir if-else loop --- R/restore.R | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/R/restore.R b/R/restore.R index 1c2382b2..9550cf6c 100644 --- a/R/restore.R +++ b/R/restore.R @@ -292,10 +292,13 @@ getSourceForPkgRecord <- function(pkgRecord, # headers"); hide those suppressWarnings(untar(srczip, exdir = scratchDir, tar = "internal")) # Find the base directory - basedir <- if (length(dir(scratchDir)) == 1) - file.path(scratchDir, dir(scratchDir)) - else - scratchDir + if (length(dir(scratchDir)) == 1)({ + basedir <- file.path(scratchDir, dir(scratchDir)) + } else { + basedir <- scratchDir + }) + + print(basedir) if (!is.null(pkgRecord$gh_subdir)) basedir <- file.path(basedir, pkgRecord$gh_subdir) From 034338630440327f78e1a3d572df2ece1600bfa8 Mon Sep 17 00:00:00 2001 From: Alexis Lucattini Date: Mon, 7 Oct 2019 11:13:41 +1100 Subject: [PATCH 3/7] Extra verbosity on basedir if-else loop --- R/restore.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/restore.R b/R/restore.R index 9550cf6c..e4742e34 100644 --- a/R/restore.R +++ b/R/restore.R @@ -292,11 +292,11 @@ getSourceForPkgRecord <- function(pkgRecord, # headers"); hide those suppressWarnings(untar(srczip, exdir = scratchDir, tar = "internal")) # Find the base directory - if (length(dir(scratchDir)) == 1)({ + if (length(dir(scratchDir)) == 1){ basedir <- file.path(scratchDir, dir(scratchDir)) } else { basedir <- scratchDir - }) + } print(basedir) From ffb550ffe6b7bdfedc463798c28100e136c07117 Mon Sep 17 00:00:00 2001 From: Alexis Lucattini Date: Mon, 7 Oct 2019 11:16:32 +1100 Subject: [PATCH 4/7] Extra verbosity on basedir if-else loop --- R/restore.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/restore.R b/R/restore.R index e4742e34..1c11382c 100644 --- a/R/restore.R +++ b/R/restore.R @@ -297,7 +297,7 @@ getSourceForPkgRecord <- function(pkgRecord, } else { basedir <- scratchDir } - + print("All about that base!") print(basedir) if (!is.null(pkgRecord$gh_subdir)) From 379b441e12191d09c6ffec695bd0d98811747859 Mon Sep 17 00:00:00 2001 From: Alexis Lucattini Date: Mon, 7 Oct 2019 11:22:37 +1100 Subject: [PATCH 5/7] Extra verbosity on basedir if-else loop --- R/restore.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/restore.R b/R/restore.R index 1c11382c..5fef6c5d 100644 --- a/R/restore.R +++ b/R/restore.R @@ -303,6 +303,8 @@ getSourceForPkgRecord <- function(pkgRecord, if (!is.null(pkgRecord$gh_subdir)) basedir <- file.path(basedir, pkgRecord$gh_subdir) + print(list.files(basedir)) + if (!file.exists(file.path(basedir, 'DESCRIPTION'))) { stop('No DESCRIPTION file was found in the archive for ', pkgRecord$name) } From 270ce84c104c99ca79c56800e693f6103b9af846 Mon Sep 17 00:00:00 2001 From: Alexis Lucattini Date: Mon, 7 Oct 2019 11:25:18 +1100 Subject: [PATCH 6/7] Extra verbosity on basedir if-else loop --- R/restore.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/restore.R b/R/restore.R index 5fef6c5d..d45ac017 100644 --- a/R/restore.R +++ b/R/restore.R @@ -302,7 +302,8 @@ getSourceForPkgRecord <- function(pkgRecord, if (!is.null(pkgRecord$gh_subdir)) basedir <- file.path(basedir, pkgRecord$gh_subdir) - + print(pkgRecord) + print(basedir) print(list.files(basedir)) if (!file.exists(file.path(basedir, 'DESCRIPTION'))) { From be74d1cddc11776cb7de40bf59beab832f742e76 Mon Sep 17 00:00:00 2001 From: Alexis Lucattini Date: Mon, 7 Oct 2019 11:27:52 +1100 Subject: [PATCH 7/7] Extra verbosity on basedir if-else loop --- R/restore.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/restore.R b/R/restore.R index d45ac017..646bc612 100644 --- a/R/restore.R +++ b/R/restore.R @@ -300,7 +300,7 @@ getSourceForPkgRecord <- function(pkgRecord, print("All about that base!") print(basedir) - if (!is.null(pkgRecord$gh_subdir)) + if (!is.null(pkgRecord$gh_subdir) && !identical(pkgRecord$gh_subdir, character(0))) basedir <- file.path(basedir, pkgRecord$gh_subdir) print(pkgRecord) print(basedir)