Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow default CURIs to be disabled #5338

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

ugexe
Copy link
Member

@ugexe ugexe commented Aug 12, 2023

Previously there was no convenient way to disable the e.g. site, vendor, and core repositories. But when developing with application specific module install locations one might not want for modules to be used outside of that location. This add a new environment variables, RAKU_DISABLE_DEFAULT_CURIS, which can be set to anything to prevent the default repositories from being added to the repo chain itself. Note that it does still register those repositories with the registry.

Previously there was no convenient way to disable the e.g. site,
vendor, and core repositories. But when developing with application
specific module install locations one might not want for modules
to be used outside of that location. This add a new environment
variables, RAKU_DISABLE_DEFAULT_CURIS, which can be set to anything
to prevent the default repositories from being added to the repo
chain itself. Note that it does still register those repositories
with the registry.
@ugexe ugexe marked this pull request as draft August 12, 2023 23:24
@ugexe
Copy link
Member Author

ugexe commented Aug 12, 2023

Allow disabling default CURIs

One pattern developers might want to follow is to install all application dependencies into an app-specific location i.e. ./local/inst. They might want to be sure that their application only runs with the dependencies installed to ./local/inst, and thus set RAKULIB="./local/inst". However, that only adds the repository to the front of the repo chain. By default there are 4 other CompUnit::Repository::Installation behind whatever is set by e.g. RAKULIB:

inst#/Users/nlogan/.raku
inst#/Users/nlogan/.rakubrew/versions/moar-blead/install/share/perl6/site 
inst#/Users/nlogan/.rakubrew/versions/moar-blead/install/share/perl6/vendor 
inst#/Users/nlogan/.rakubrew/versions/moar-blead/install/share/perl6/core

But when a module isn't found by ./local/inst I don't want it to check these other repositories. I want to be sure that the modules used by the application are self contained to ./local/inst only. For example:

$ RAKU_DISABLE_DEFAULT_CURIS="1" ./install/bin/rakudo -e 'use Test; say 42'
===SORRY!=== Error while compiling -e
Could not find Test in:
    CompUnit::Repository::AbsolutePath<6433162664288>
    CompUnit::Repository::NQP<6433121507744>
    CompUnit::Repository::Perl5<6433121507784>
at -e:1

$ RAKU_DISABLE_DEFAULT_CURIS="1" RAKULIB="./local/inst" ./install/bin/rakudo -e 'use Test; say 42'
42

@ugexe
Copy link
Member Author

ugexe commented Aug 12, 2023

I haven't thought too much on how to best implement this, but this PR is one way to do it.

@hythm7
Copy link

hythm7 commented Aug 13, 2023

Looks like this will disable the core repo as well, which includes essential modules, like NativeCall, I haven't tested this, but wouldn't that break modules that depend on NativeCall?

And if that is the case, I think it will be better to allow disabling indvidual repos (eg. home or home,site).

Another option may be have a generic env var to specify the allowed repos and their order in the repo chain, for example site,home,core,nqp should build the repo chain as, first repo is site, next repo home, next core and last repo nqp.

@ugexe
Copy link
Member Author

ugexe commented Aug 13, 2023

In a self contained environment as described one would also install the core modules. Just because NativeCall doesn’t exist in an ecosystem doesn’t mean something like zef —contained option can’t obtain it from somewhere else (like the current rakudo installation)

@ugexe
Copy link
Member Author

ugexe commented Aug 13, 2023

You can accomplish custom repo chain by just disabling them all (as in this PR) and set RAKULIB. I was originally going to write such a custom repo chain mechanism, but this seemed cleaner to me, and far easier to implement.

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.

None yet

2 participants