Skip to content

Conversation

@Valdimus
Copy link

Hello,

I'm using packrat.lock to restore my packrat, but since ac1a18c, when packrat::snapshot() is invoked no more 'Require' field is add to packrat.lock file. It would be great to add an option to let the user choose if I want to enable/disable recursive dependency search.

@kevinushey
Copy link
Contributor

Sorry for taking so long to respond here!

You should still see the 'Requires:' field populated even with the current GitHub master version of packrat; I just tested with a project containing the file deps.R:

library(rmarkdown)
library(data.table)

and attempting to snapshot this gave me fields like e.g.

Package: knitr
Source: CRAN
Version: 1.15.1
Requires: digest, evaluate, highr, markdown, stringr, yaml

Perhaps I'm misunderstanding something or the issue is more subtle?

@Valdimus
Copy link
Author

Valdimus commented Mar 19, 2017

Hi, I don't explain my use case correctly, sorry. I don't have any R script that load package that are installed in packrat. I use packrat for managing R packages at system level (see #357 for more information). So I have a R script that build a packrat from packrat.lock file. The problem is when I generate a packrat.lock file when a user ask me to create a new packrat from a list of desired packages or add packages to an existing one.

As example, if I have to create a packrat with bit64 in it I will do:

> library("packrat")

> # Create the packrat
> packrat::init()
Initializing packrat project in directory:
- "~/test"

Adding these packages to packrat:
            _         
    packrat   0.4.8-15

Fetching sources for packrat (0.4.8-15) ... OK (local current)
Snapshot written to '/home/christophe/test/packrat/packrat.lock'
Installing packrat (0.4.8-15) ... 
	OK (built source)
Initialization complete!
Packrat mode on. Using library in directory:
- "~/test/packrat/lib"

> # Install packages
> install.packages("bit64")
Installing package into ‘/home/christophe/test/packrat/lib/x86_64-pc-linux-gnu/3.2.3’
(as ‘lib’ is unspecified)
also installing the dependency ‘bit’

trying URL 'https://pbil.univ-lyon1.fr/CRAN/src/contrib/bit_1.1-12.tar.gz'
Content type 'application/x-gzip' length 53737 bytes (52 KB)
==================================================
downloaded 52 KB

trying URL 'https://pbil.univ-lyon1.fr/CRAN/src/contrib/bit64_0.9-5.tar.gz'
Content type 'application/x-gzip' length 121087 bytes (118 KB)
==================================================
downloaded 118 KB

* installing *source* package ‘bit’ ...
** package ‘bit’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c attrutil.c -o attrutil.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c bit.c -o bit.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c chunkutil.c -o chunkutil.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c clone.c -o clone.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c rle.c -o rle.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o bit.so attrutil.o bit.o chunkutil.o clone.o rle.o -L/usr/lib/R/lib -lR
installing to /home/christophe/test/packrat/lib/x86_64-pc-linux-gnu/3.2.3/bit/libs
** R
** exec
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (bit)
* installing *source* package ‘bit64’ ...
** package ‘bit64’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c bsearch.c -o bsearch.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c cache.c -o cache.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c hash64.c -o hash64.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c integer64.c -o integer64.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c sort64.c -o sort64.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c sortuse64.c -o sortuse64.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o bit64.so bsearch.o cache.o hash64.o integer64.o sort64.o sortuse64.o -L/usr/lib/R/lib -lR
installing to /home/christophe/test/packrat/lib/x86_64-pc-linux-gnu/3.2.3/bit64/libs
** R
** data
** exec
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (bit64)

The downloaded source packages are in
	‘/tmp/Rtmpgh4cU2/downloaded_packages’


> # Do a snapshot
> packrat::snapshot()

I obtain the corresponding packrat.lock file:

PackratFormat: 1.4
PackratVersion: 0.4.8.15
RVersion: 3.2.3
Repos: local=file:///home/christophe/repo/,
    CRAN=https://pbil.univ-lyon1.fr/CRAN

Package: bit
Source: CRAN
Version: 1.1-12
Hash: a4cdb11cf9fd6dd38f9f40c413b81e93

Package: bit64
Source: CRAN
Version: 0.9-5
Hash: efc07a32b683ff0c778c2c6868bfb655

Package: packrat
Source: local
Version: 0.4.8-15
Hash: 094cd7cc9712bb7bcff1f61be467b697

No Requires field for bit64 but it depends of bit, has I said.

If I do the same thing with the CRAN version of packrat, I obtain this packrat.lock file:

PackratFormat: 1.4
PackratVersion: 0.4.8.1
RVersion: 3.2.3
Repos: CRAN=http://cran.rstudio.com/

Package: bit
Source: CRAN
Version: 1.1-12
Hash: a4cdb11cf9fd6dd38f9f40c413b81e93

Package: bit64
Source: CRAN
Version: 0.9-5
Hash: efc07a32b683ff0c778c2c6868bfb655
Requires: bit

Package: packrat
Source: CRAN
Version: 0.4.8-1
Hash: 6ad605ba7b4b476d84be6632393f5765

Is my use case too specific? Can you consider adding an option as I asked previously?

Thanks

@Valdimus
Copy link
Author

Fix by #391

@Valdimus Valdimus closed this Aug 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants