pocmatos
2018-9-25 09:41:39

Is there a way to get raco to install and setup the dependencies of a package but not the package itself? For development purposes I don’t want to setup my package, I want to just link it. However, if I do raco pkg install --auto --link --no-setup --name s10, then I get the dependencies but they have not been setup which means for example that rosette does not install z3. On the other hand, I can install and setup everything including my pkg and then remove the zos for my package but that’s a sad workaround and I would prefer to have a better solution.


pocmatos
2018-9-25 10:33:16

@willghatch a question on rash, I have skimmed the documentation but haven’t found a reference to this, can I write a rash file with bash like command lines and require this into a racket file to execute it when I want? Maybe the rash lang automatically provides a function that executes the commands in the file?


greg
2018-9-25 14:37:13

@pocmatos I don’t know an elegant way, but just spitballing: How about making a dummy project that’s just an info.rkt with the deps and build-deps values from the real project? (Might even work to symlink the real info.rkt, so no copypasta.)


samth
2018-9-25 15:59:18

@pocmatos can you just run raco setup rosette after that command?


notjack
2018-9-25 17:02:48

@samth I have this same problem, and I suspect it’s for the same use case: docker layer caching. If you setup dependency code and your packages code in the same command, you have to rebuild your dependencies whenever your package’s source changes


samth
2018-9-25 17:03:53

I think a new flag to install would be reasonable to add


samth
2018-9-25 17:04:31

I’ve also wondered about a raco build command that worked on the local directory without it being installed (and installed needed deps)


notjack
2018-9-25 17:06:12

like, where it figured out what packages to install based on what modules are used in the local directory?


samth
2018-9-25 17:07:36

no, based on an info.rkt file


samth
2018-9-25 17:07:47

but didn’t require installing the directory as a package


samth
2018-9-25 17:08:04

which seems to be something people avoid for reasons I don’t always understand


notjack
2018-9-25 17:12:34

ah yes, that would be helpful


greg
2018-9-25 18:02:31

@notjack I only have one Racket Dockerfile worth of experience, and haven’t tweaked this in many months. But: I have something like this Dockerfile snippet: WORKDIR /app/ # First just copy over Makefile and info.rkt, and run make install. # This way we get a docker layer with our Racket dependencies cached, # that remains valid until/unless Makefile or info.rkt is changed. COPY Makefile info.rkt /app/ RUN make install # Finally this layer adds our actual application files. So long as # info.rkt hasn't changed, this can reuse the previous layer. COPY . /app/ RUN make setup and this Makefile snippet: DEPS-FLAGS=--check-pkg-deps --unused-pkg-deps # Installs dependencies as well as linking this as a package. install: raco pkg install --deps search-auto # Primarily for day-to-day dev. # Note: Also checks deps. # Note: Does NOT build docs. setup: raco setup --no-docs --tidy $(DEPS-FLAGS) --pkgs $(PACKAGE-NAME) And the deps layer doesn’t get rebuilt unless I change Makefile or info.rkt.


greg
2018-9-25 18:03:46

(This is for https://deals.extramaze.com and the repo is private, is why I’m just sharing snippets)


greg
2018-9-25 18:05:59

(I guess you could also just inline those Makefile commands into the Dockerfile, but I have a Makefile usually for a variety of things anyway.)


greg
2018-9-25 18:06:53

Take this with a big grain of salt. When it comes to Docker I’m just at a “it works” stage.


notjack
2018-9-25 18:09:18

@greg that’s about what I end up doing too, and it seems to work okay so far


pocmatos
2018-9-25 20:49:51

Thanks for the replies.


pocmatos
2018-9-25 20:51:04

I have about 9 packages my application/package depends on therefore doing something like @samth suggested doesn’t work very well. I would need to end up reading the info.rkt file and issuing raco pkg install for each of them.


pocmatos
2018-9-25 20:53:14

I need this because my package has a few compile time configuration options passed through environment variables. I cannot raco install --auto --link ... my package without passing the compile time options, however it’s too soon to do it when I am doing CI. I would like to delay the setup of my application and just install the dependencies.


pocmatos
2018-9-25 20:53:30

Maybe we need an alternative to --link like --deps-only.


pocmatos
2018-9-25 20:54:59

With this I could install the deps. Then I could do raco pkg install --no-setup --link ... on my package and later I could issue the compilation script with the options. This would also allow me to cache my project dependencies during CI between pipeline runs.


pocmatos
2018-9-25 20:55:34

ok… let me take a look at the raco pkg install code, maybe it’s not even that hard to implement. :slightly_smiling_face:


abmclin
2018-9-25 21:03:42

@pocmatos What about setting PLTADDONDIR to a directory which becomes the new location for user scope packages. raco pkg install will install your packages and all of its dependencies into the addon directory. Then you can delete your package from that directory. You can either then leave it as-is or unset PLTADDONDIR and rerun raco pkg install again over each package directory already in the formerly addon directory to ensure they are installed into the standard user scope location.


notjack
2018-9-26 00:07:19

@pocmatos the pkg/lib module provides a racket API to all of raco pkg - you might have better luck writing a racket script to install things just right


david.alkire
2018-9-26 01:04:33

When creating a Maybe type, how do I pull the value out of the Some struct? (struct None ()) (struct (a) Some ([v : a])) (define-type (Maybe a) (U None (Some a))) With a function like the following: (: div (-> Integer Integer (Maybe Exact-Rational))) (define (div x y) (if (equal? 0 y) (None) (Some (/ x y)))) I get the following result, but I cant crack it open. If it were (Some 12345), I could do (Some-v (Some 12345)) to get 12345. What can I do to get to the value? I also tried (Some-v (cast (div 3 4) (Some Exact-Rational)) but no luck: (div 3 4) - : (U (Some Exact-Rational) None) #<Some>


samth
2018-9-26 02:15:21

@david.alkire try using Some? or pattern matching


pocmatos
2018-9-26 06:09:02

@abmclin that solution looks like it could work but way too complex, racket should really offer something easier but as a workaround it seems doable. thanks.


pocmatos
2018-9-26 06:09:20

@notjack didn’t know about pkg/lib, will take a look, thnaks.


pocmatos
2018-9-26 06:46:58

@samth i should point out that I totally agree on a raco build that builds your application and compiles dependencies without forcing you to install your package.