Re: [racket-dev] collects search order

2014-12-12 Thread Sam Tobin-Hochstadt
On Fri, Dec 12, 2014 at 8:46 AM, Matthew Flatt  wrote:
> At Thu, 11 Dec 2014 17:00:14 -0800, Dan Liebgold wrote:
>> If I use the -X and -S command line parameters to Racket to make my local
>> collects dir the first one searched, it makes it so I can't do (require
>> srfi/1).
>
> Yes, this is subtle and confusing.
>
>> Is there something special about the srfi package? (it's layout seems
>> different)
>
> The `srfi/1` library is installed as a package, so it's not in the main
> "collects" tree. Package paths are registered in "etc/config.rktd".
> When that file isn't present or doesn't explicitly list the location of
> packages, then the default location is within the "share" directory.
> The default location of the "share" directory, in turn, is "../share".
>
> (I'm using paths for an in-place installation; the details vary for a
> Unix-style installation, or I may have a detail slightly wrong, but
> it's about the same.)
>
> The "../share" path is relative... to what? It turns out that it's
> relative to the main "collects" directory. So, when you provide `-X`,
> you're also changing the location of package installations.
>
> It may seem odd that the default location of packages (and even the
> configuration file) is derived from the main "collects" path, but it's
> part of a delicate balance of configuration options that keeps many old
> things working, enables `make` in the top-level of the Racket
> repository, and so on. The default paths are convenient for some
> purposes and inconvenient for others.
>
>
> To take control of the various paths, create a configuration file as
> "config.rktd", and then point Racket at that file's directory using
> `-G`. For example, if I copy the "collects" directory of my
> installation to "/tmp/collects", then
>
>   racket -X /tmp/collects -l srfi/1
>
> fails, as you say. But if I create "/tmp/etc/config.rktd" with the
> content
>
>  #hash((share-dir . "/original/path/to/racket/share"))

I have a couple follow-ups to this answer (which was very helpful for
things I want to do).

If I use a special "config.rktd" file, perhaps like:

#hash((pkgs-search-dirs . ("/tmp/pkgs" #f)))

so that I can install some packages without affecting the main Racket
installation, what will be different when running `racket -G /tmp/etc`
versus running plain `racket`? In particular, will there be packages,
links, or collections that I can `require` with plain `racket` that I
won't find with `-G /tmp/etc`? I see that the "installation-name" is
different, and the default pkg scope is different, and the result of
`(pkg-config-catalogs)` is now missing
"file:///home/samth/sw/plt/racket/share/pkgs-catalog". Is there
anything else I'll lose? Is the best way to keep this information to
read the original config.rktd, turn paths into absolute paths, and
then add that contents to the new config.rktd that I create?

Sam
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] collects search order

2014-12-12 Thread Matthew Flatt
At Thu, 11 Dec 2014 17:00:14 -0800, Dan Liebgold wrote:
> If I use the -X and -S command line parameters to Racket to make my local
> collects dir the first one searched, it makes it so I can't do (require
> srfi/1).

Yes, this is subtle and confusing.

> Is there something special about the srfi package? (it's layout seems
> different)

The `srfi/1` library is installed as a package, so it's not in the main
"collects" tree. Package paths are registered in "etc/config.rktd".
When that file isn't present or doesn't explicitly list the location of
packages, then the default location is within the "share" directory.
The default location of the "share" directory, in turn, is "../share".

(I'm using paths for an in-place installation; the details vary for a
Unix-style installation, or I may have a detail slightly wrong, but
it's about the same.)

The "../share" path is relative... to what? It turns out that it's
relative to the main "collects" directory. So, when you provide `-X`,
you're also changing the location of package installations.

It may seem odd that the default location of packages (and even the
configuration file) is derived from the main "collects" path, but it's
part of a delicate balance of configuration options that keeps many old
things working, enables `make` in the top-level of the Racket
repository, and so on. The default paths are convenient for some
purposes and inconvenient for others.


To take control of the various paths, create a configuration file as
"config.rktd", and then point Racket at that file's directory using
`-G`. For example, if I copy the "collects" directory of my
installation to "/tmp/collects", then

  racket -X /tmp/collects -l srfi/1

fails, as you say. But if I create "/tmp/etc/config.rktd" with the
content

 #hash((share-dir . "/original/path/to/racket/share"))

then

  racket -X /tmp/collects -G /tmp/etc -l srfi/1

works.

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] collects search order

2014-12-12 Thread Jay McCarthy
I don't know the answer to the -X/-S question, but the best way to add
more collects is to use "raco link" or "raco pkg". If you want to
OVERRIDE a collect that would normally be part of racket/collects is
more complicated though.

On Thu, Dec 11, 2014 at 8:00 PM, Dan Liebgold  wrote:
> If I use the -X and -S command line parameters to Racket to make my local
> collects dir the first one searched, it makes it so I can't do (require
> srfi/1).
>
> Is there something special about the srfi package? (it's layout seems
> different)
>
> Is there a better way to prioritize my local collects dir per invocation?
>
> --
> Dan Liebgold[dan.liebg...@gmail.com]
>
> _
>   Racket Developers list:
>   http://lists.racket-lang.org/dev
>



-- 
Jay McCarthy
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D&C 64:33
_
  Racket Developers list:
  http://lists.racket-lang.org/dev