fix: do not use root for apk update

This commit is contained in:
Amin Yahyaabadi 2025-03-23 01:46:00 -07:00
parent 5a0bbafcb2
commit ba81f6ae16
9 changed files with 13 additions and 21 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -29,8 +29,7 @@
"ci-log": "workspace:*",
"envosman": "workspace:*",
"which": "4.0.0",
"escape-string-regexp": "^5.0.0",
"node-downloader-helper": "2.1.9",
"execa": "7.2.0",
"memoizee": "^0.4.17"
},
"engines": {

View File

@ -1,13 +1,9 @@
import { defaultExecOptions, execRootSync } from "admina"
import memoize from "memoizee"
import { filterAndQualifyApkPackages } from "./qualify-install.js"
import { updateApkMemoized } from "./update.js"
/** Install bash (usually missing from docker containers) */
export async function initApk() {
// Update the repos
await updateApkMemoized()
const toInstall = await filterAndQualifyApkPackages([
{ name: "bash" },
])

View File

@ -32,6 +32,9 @@ export async function installApkPackage(packages: ApkPackage[], update = false):
try {
// Update package index if requested
// init the apk
await initApkMemoized()
if (update) {
// Force update the repos
await updateApkMemoized.clear()
@ -39,9 +42,6 @@ export async function installApkPackage(packages: ApkPackage[], update = false):
// Update the repos if needed
await updateApkMemoized()
// init the apk
await initApkMemoized()
const packagesToInstall = await filterAndQualifyApkPackages(packages)
if (packagesToInstall.length === 0) {

View File

@ -1,7 +1,7 @@
import { execRoot } from "admina"
import { execa } from "execa"
import memoizee from "memoizee"
async function updateApk() {
await execRoot("apk", ["update"], { stdio: "inherit" })
await execa("apk", ["update"], { stdio: "inherit" })
}
export const updateApkMemoized = memoizee(updateApk, { promise: true })

View File

@ -384,15 +384,12 @@ importers:
envosman:
specifier: workspace:*
version: link:../envosman
escape-string-regexp:
specifier: ^5.0.0
version: 5.0.0
execa:
specifier: 7.2.0
version: 7.2.0
memoizee:
specifier: ^0.4.17
version: 0.4.17
node-downloader-helper:
specifier: 2.1.9
version: 2.1.9
path-exists:
specifier: ^5.0.0
version: 5.0.0