Skip to content

Commit

Permalink
[Rscape] use .gitattributes to preserve CRLF line endings in patch (#…
Browse files Browse the repository at this point in the history
…5385)

[skip ci]
  • Loading branch information
marcom authored Aug 27, 2022
1 parent 6bed3c2 commit 5d5ef64
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 20 deletions.
1 change: 1 addition & 0 deletions R/Rscape/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bundled/patches/allow-env-var-override-of-dirs.patch -text diff
7 changes: 0 additions & 7 deletions R/Rscape/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ cd $WORKSPACE/srcdir/rscape*/
# variables to override default directories for finding data params at
# runtime instead of a hardcoded path (which doesn't work because that
# is set to the srcdir during build)
#
# first convert src/msatree.c to LF line endings (from CRLF),
# otherwise the patch doesn't apply
cp src/msatree.c src/msatree.c.bak
tr -d '\015' < src/msatree.c.bak > src/msatree.c
#
# now apply the patch
atomic_patch -p1 ../patches/allow-env-var-override-of-dirs.patch
update_configure_scripts
Expand Down
26 changes: 13 additions & 13 deletions R/Rscape/bundled/patches/allow-env-var-override-of-dirs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,19 @@ index a5e268e..b2691ba 100644
--- a/src/msatree.c
+++ b/src/msatree.c
@@ -122,8 +122,11 @@ Tree_CreateExtFile(const ESL_MSA *msa, char **ret_treefile, char *errbuf, int ve
if ((status = esl_msafile_Write(msafp, (ESL_MSA *)msa, eslMSAFILE_AFA)) != eslOK) ESL_XFAIL(status, errbuf, "Failed to write AFA file\n");
fclose(msafp);

- if (RSCAPE_BIN) // look for the installed executable
- esl_sprintf(&cmd, "%s/FastTree", RSCAPE_BIN);
+ // override default RSCAPE_BIN with environment variable if it is set
+ char *env_rscape_bin = getenv("RSCAPE_BIN");
+ char *rscape_bin = env_rscape_bin ? env_rscape_bin : RSCAPE_BIN;
+ if (rscape_bin) // look for the installed executable
+ esl_sprintf(&cmd, "%s/FastTree", rscape_bin);
else
ESL_XFAIL(status, errbuf, "Failed to find FASTTREE executable\n");

if ((status = esl_msafile_Write(msafp, (ESL_MSA *)msa, eslMSAFILE_AFA)) != eslOK) ESL_XFAIL(status, errbuf, "Failed to write AFA file\n");
fclose(msafp);

- if (RSCAPE_BIN) // look for the installed executable
- esl_sprintf(&cmd, "%s/FastTree", RSCAPE_BIN);
+ // override default RSCAPE_BIN with environment variable if it is set
+ char *env_rscape_bin = getenv("RSCAPE_BIN");
+ char *rscape_bin = env_rscape_bin ? env_rscape_bin : RSCAPE_BIN;
+ if (rscape_bin) // look for the installed executable
+ esl_sprintf(&cmd, "%s/FastTree", rscape_bin);
else
ESL_XFAIL(status, errbuf, "Failed to find FASTTREE executable\n");

diff --git a/src/r2rdepict.c b/src/r2rdepict.c
index b920439..ea3a9ba 100644
--- a/src/r2rdepict.c
Expand Down

0 comments on commit 5d5ef64

Please sign in to comment.