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

add archname to PERL5LIB #1327

Merged
merged 2 commits into from Nov 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/cpan-installer.ts
Expand Up @@ -82,7 +82,10 @@ export async function install(opt: Options): Promise<void> {

// configure environment values
core.addPath(path.join(cachePath, "bin"));
core.exportVariable("PERL5LIB", path.join(cachePath, "lib", "perl5") + path.delimiter + process.env["PERL5LIB"]);
const archName = await getArchName(opt);
const libPath = path.join(cachePath, "lib", "perl5");
const libArchPath = path.join(cachePath, "lib", "perl5", archName);
core.exportVariable("PERL5LIB", libPath + path.delimiter + libArchPath + path.delimiter + process.env["PERL5LIB"]);

if (opt.enable_modules_cache) {
// save cache
Expand Down Expand Up @@ -219,6 +222,13 @@ async function installWithCarton(opt: Options): Promise<void> {
}
}

// getArchName gets the arch name such as x86_64-linux, darwin-thread-multi-2level, etc.
async function getArchName(opt: Options): Promise<string> {
const perl = path.join(opt.toolPath, "bin", "perl");
const out = await exec.getExecOutput(perl, ["-MConfig", "-E", "print $Config{archname}"]);
return out.stdout;
}

async function exists(path: string): Promise<boolean> {
return new Promise((resolve, reject) => {
fs.stat(path, (err) => {
Expand Down