Skip to content

Commit

Permalink
Merge pull request #269 from aminya/apt
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Aug 29, 2024
2 parents 12442d6 + c17f568 commit 56a945c
Show file tree
Hide file tree
Showing 36 changed files with 779 additions and 421 deletions.
13 changes: 7 additions & 6 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,20 @@ ignorePaths:
- .vscode/extensions.json
words:
- aarch
- hadolint
- aminya
- envosman
- applellvm
- biome
- biomejs
- bazel
- bazelisk
- biome
- biomejs
- buildtools
- caxa
- ccache
- choco
- clangd
- cmake
- iarna
- cobertura
- copr
- pnpx
- CPATH
- Cppcheck
- CPPFLAGS
Expand All @@ -43,13 +39,16 @@ words:
- DVCPKG
- dyld
- eabi
- envosman
- esmodule
- execa
- ftxui
- GCOV
- gcovr
- ghes
- Graphviz
- hadolint
- iarna
- inja
- isci
- isroot
Expand All @@ -61,6 +60,7 @@ words:
- libdw
- libstdc
- libtinfo
- memoizee
- msbuild
- msvc
- msvcrt
Expand All @@ -79,6 +79,7 @@ words:
- patha
- pipx
- pnpm
- pnpx
- pwsh
- pygments
- pypy
Expand Down
68 changes: 34 additions & 34 deletions dist/actions/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/actions/setup-cpp.js.map

Large diffs are not rendered by default.

68 changes: 34 additions & 34 deletions dist/legacy/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js.map

Large diffs are not rendered by default.

68 changes: 34 additions & 34 deletions dist/modern/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.js.map

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"@types/eslint": "^8.56.11",
"@types/iarna__toml": "~2.0.5",
"@types/jest": "^29.5.12",
"@types/memoizee": "^0.4.11",
"@types/node": "^12.20.55",
"@types/semver": "^7.5.8",
"@types/which": "^3.0.4",
Expand All @@ -86,10 +87,10 @@
"cspell": "^8.13.3",
"diagnostics_channel": "^1.1.0",
"dprint": "^0.47.2",
"envosman": "workspace:*",
"escape-path-with-spaces": "^1.0.2",
"escape-quotes": "^1.0.2",
"escape-string-regexp": "^5.0.0",
"setup-apt": "workspace:*",
"eslint": "^8.57.0",
"eslint-config-atomic": "^1.22.1",
"exec-powershell": "workspace:*",
Expand All @@ -98,14 +99,14 @@
"jest": "^29.7.0",
"lefthook": "^1.7.12",
"macos-release": "^3.3.0",
"micro-memoize": "^4.1.2",
"memoizee": "^0.4.17",
"mkdirp": "^3.0.1",
"mri": "^1.2.0",
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#c01f519bd995460228ed3dec4df51df92dc290fd",
"node-downloader-helper": "2.1.9",
"npm-check-updates": "^17.0.6",
"npm-run-all2": "^6.2.2",
"numerous": "1.0.3",
"envosman": "workspace:*",
"p-timeout": "^6.1.2",
"parcel": "2.0.0-canary.1717",
"path-exists": "^5.0.0",
Expand All @@ -115,8 +116,9 @@
"readme-md-generator": "^1.0.0",
"retry-as-promised": "^7.0.4",
"semver": "7.6.3",
"setup-python": "github:aminya/setup-python#a783db655c6e40317e2c0c96f9d162d9c9f4a751",
"setup-apt": "workspace:*",
"setup-brew": "workspace:*",
"setup-python": "github:aminya/setup-python#a783db655c6e40317e2c0c96f9d162d9c9f4a751",
"shx": "0.3.4",
"simple-update-notifier": "^2.0.0",
"terser-config-atomic": "^1.0.0",
Expand All @@ -129,8 +131,7 @@
"untildify-user": "workspace:*",
"util.types": "^0.0.2",
"web-streams-polyfill": "^4.0.0",
"which": "^4.0.0",
"node-downloader-helper": "2.1.9"
"which": "^4.0.0"
},
"productionDependencies": [
"@actions/core",
Expand All @@ -149,7 +150,7 @@
"exec-powershell",
"execa",
"is-url-online",
"micro-memoize",
"memoizee",
"mri",
"msvc-dev-cmd",
"node-downloader-helper",
Expand Down
6 changes: 4 additions & 2 deletions packages/envosman/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"ci-info": "^4.0.0",
"escape-path-with-spaces": "^1.0.2",
"escape-quotes": "^1.0.2",
"micro-memoize": "^4.1.2",
"memoizee": "^0.4.17",
"path-exists": "^5.0.0",
"ci-log": "workspace:*",
"exec-powershell": "workspace:*",
Expand All @@ -45,5 +45,7 @@
"unix",
"macos"
],
"devDependencies": {}
"devDependencies": {
"@types/memoizee": "0.4.11"
}
}
4 changes: 2 additions & 2 deletions packages/envosman/src/rc-file.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { promises } from "fs"
import { grantUserWriteAccess } from "admina"
import { info, warning } from "ci-log"
import memoize from "micro-memoize"
import memoize from "memoizee"
import { pathExists } from "path-exists"
import { untildifyUser } from "untildify-user"
const { appendFile, readFile, writeFile } = promises
Expand Down Expand Up @@ -38,7 +38,7 @@ async function sourceRCInRc_(options: RcOptions) {
/**
* handles adding conditions to source rc file from .bashrc and .profile
*/
export const sourceRCInRc = memoize(sourceRCInRc_, { isPromise: true })
export const sourceRCInRc = memoize(sourceRCInRc_, { promise: true })

async function addRCHeader(options: RcOptions) {
// a variable that prevents source rc from being called from .bashrc and .profile
Expand Down
59 changes: 53 additions & 6 deletions packages/setup-apt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ Install a package using apt

**returns:** Promise<InstallationInfo>

```ts
await installAptPack([{ name: "ca-certificates" }, { name: "gnupg" }])
```

```ts
await installAptPack([
{
name: "gcc",
version,
repository: "ppa:ubuntu-toolchain-r/test",
key: { key: "1E9377A2BA9EF27F", fileName: "ubuntu-toolchain-r-test.gpg" },
},
])
```

### `hasNala` (function)

Check if nala is installed
Expand All @@ -123,26 +138,58 @@ Get the environment variables to use for the apt command

**returns:** ProcessEnv

### `AddAptKeyOptions` (type)

### `addAptKey` (function)

Add an apt key

**Parameters:**

- options (`AddAptKeyOptions`) - The options for adding the key

**returns:** Promise<string>

```ts
await addAptKey({
key: "3B4FE6ACC0B21F32"
fileName: "bazel-archive-keyring.gpg",
})
```

```ts
await addAptKey({
keyUrl: "https://bazel.build/bazel-release.pub.gpg",
fileName: "bazel-archive-keyring.gpg",
})
```

### `defaultKeyStorePath` (variable)

### `KeyServerOptions` (type)

### `defaultKeyServer` (variable)

### `addAptKeyViaServer` (function)

Add an apt key via a keyserver

**Parameters:**

- keys (`string[]`) - The keys to add
- name (`string`) - The name of the key
- server (`string`) - The keyserver to use (Defaults to `keyserver.ubuntu.com`)
- { key, keyServer = defaultKeyServer, fileName, keyStorePath = defaultKeyServer } (`KeyServerOptions`)

**returns:** Promise<string>

### `addAptKeyViaDownload` (function)
### `KeyUrl` (type)

### `addAptKeyViaURL` (function)

Add an apt key via a download

**Parameters:**

- name (`string`) - The name of the key
- url (`string`) - The URL of the key
- options - The options for adding the key
- { keyUrl, fileName, keyStorePath = defaultKeyStorePath } (`KeyUrl`)

**returns:** Promise<string>

Expand Down
9 changes: 6 additions & 3 deletions packages/setup-apt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-apt",
"version": "1.0.1",
"version": "2.0.0",
"description": "Setup apt packages and repositories in Debian/Ubuntu-based distributions",
"repository": "https://github.com/aminya/setup-cpp",
"homepage": "https://github.com/aminya/setup-cpp/tree/master/packages/setup-apt",
Expand All @@ -26,7 +26,8 @@
"which": "4.0.0",
"execa": "^7.2.0",
"escape-string-regexp": "^5.0.0",
"node-downloader-helper": "2.1.9"
"node-downloader-helper": "2.1.9",
"memoizee": "^0.4.17"
},
"engines": {
"node": ">=12"
Expand All @@ -48,5 +49,7 @@
"package",
"apt-key"
],
"devDependencies": {}
"devDependencies": {
"@types/memoizee": "0.4.11"
}
}
21 changes: 21 additions & 0 deletions packages/setup-apt/src/apt-env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Get the environment variables to use for the apt command
* @param apt The apt command to use
* @private Used internally
*/

export function getAptEnv(apt: string) {
const env: NodeJS.ProcessEnv = { ...process.env, DEBIAN_FRONTEND: "noninteractive" }

if (apt === "nala") {
// if LANG/LC_ALL is not set, enable utf8 otherwise nala fails because of ASCII encoding
if (env.LANG === undefined) {
env.LANG = "C.UTF-8"
}
if (env.LC_ALL === undefined) {
env.LC_ALL = "C.UTF-8"
}
}

return env
}
Loading

0 comments on commit 56a945c

Please sign in to comment.