From 5e5d16f425397fd7cb1b42256a0dc25e76e1b4bc Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 3 May 2017 14:04:47 +0200 Subject: [PATCH] R: import upstream patch to fix broken "R CMD Sweave" command The command "R CMD Sweave" always exits with error code "1", even if the command was successful. This upstream patch remedies this issue. --- pkgs/applications/science/math/R/default.nix | 4 +- .../science/math/R/fix-sweave-exit-code.patch | 52 +++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 pkgs/applications/science/math/R/fix-sweave-exit-code.patch diff --git a/pkgs/applications/science/math/R/default.nix b/pkgs/applications/science/math/R/default.nix index 20ae791c31b..285673baa3c 100644 --- a/pkgs/applications/science/math/R/default.nix +++ b/pkgs/applications/science/math/R/default.nix @@ -1,7 +1,7 @@ { stdenv, fetchurl, bzip2, gfortran, libX11, libXmu, libXt, libjpeg, libpng , libtiff, ncurses, pango, pcre, perl, readline, tcl, texLive, tk, xz, zlib , less, texinfo, graphviz, icu, pkgconfig, bison, imake, which, jdk, openblas -, curl, Cocoa, Foundation, cf-private, libobjc, tzdata +, curl, Cocoa, Foundation, cf-private, libobjc, tzdata, fetchpatch , withRecommendedPackages ? true , enableStrictBarrier ? false }: @@ -21,7 +21,7 @@ stdenv.mkDerivation rec { ] ++ stdenv.lib.optionals (!stdenv.isDarwin) [ tcl tk ] ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa Foundation cf-private libobjc ]; - patches = [ ./no-usr-local-search-paths.patch ]; + patches = [ ./no-usr-local-search-paths.patch ./fix-sweave-exit-code.patch ]; preConfigure = '' configureFlagsArray=( diff --git a/pkgs/applications/science/math/R/fix-sweave-exit-code.patch b/pkgs/applications/science/math/R/fix-sweave-exit-code.patch new file mode 100644 index 00000000000..8ca1be750a5 --- /dev/null +++ b/pkgs/applications/science/math/R/fix-sweave-exit-code.patch @@ -0,0 +1,52 @@ +From 0ff560ba912fad126576818519035c8d3c693bed Mon Sep 17 00:00:00 2001 +From: maechler +Date: Mon, 24 Apr 2017 14:24:11 +0000 +Subject: [PATCH] R CMD Sweave status bug fix + +git-svn-id: https://svn.r-project.org/R/trunk@72612 00db46b3-68df-0310-9c12-caf00c1e9a41 + +diff --git a/src/library/utils/R/Sweave.R b/src/library/utils/R/Sweave.R +index 2beb094..8d4950b 100644 +--- a/src/library/utils/R/Sweave.R ++++ b/src/library/utils/R/Sweave.R +@@ -1,7 +1,7 @@ + # File src/library/utils/R/Sweave.R + # Part of the R package, https://www.R-project.org + # +-# Copyright (C) 1995-2016 The R Core Team ++# Copyright (C) 1995-2017 The R Core Team + # + # This program is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by +@@ -452,10 +452,10 @@ SweaveHooks <- function(options, run = FALSE, envir = .GlobalEnv) + } + do_exit <- + if(no.q) +- function(status = 1L) (if(status) stop else message)( ++ function(status = 0L) (if(status) stop else message)( + ".Sweave() exit status ", status) + else +- function(status = 1L) q("no", status = status, runLast = FALSE) ++ function(status = 0L) q("no", status = status, runLast = FALSE) + + if (!length(args)) { + Usage() +@@ -577,16 +577,15 @@ SweaveHooks <- function(options, run = FALSE, envir = .GlobalEnv) + } + do_exit <- + if(no.q) +- function(status = 1L) (if(status) stop else message)( ++ function(status = 0L) (if(status) stop else message)( + ".Stangle() exit status ", status) + else +- function(status = 1L) q("no", status = status, runLast = FALSE) ++ function(status = 0L) q("no", status = status, runLast = FALSE) + + if (!length(args)) { + Usage() + do_exit(1L) + } +- + file <- character() + encoding <- options <- "" + engine <- NULL