Skip to content

Commit cc2c565

Browse files
committed
update libexec for pkgx^2
no longer produces `v*`.
1 parent 552d4b6 commit cc2c565

File tree

15 files changed

+52
-32
lines changed

15 files changed

+52
-32
lines changed

.github/workflows/ci.actions.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v4
2323
with:
24-
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
24+
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
2525

26-
- uses: pkgxdev/setup@v2
26+
- uses: pkgxdev/setup@v4
2727

2828
- uses: ./co/build
2929
id: build
@@ -54,8 +54,8 @@ jobs:
5454
steps:
5555
- uses: actions/checkout@v4
5656
with:
57-
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
58-
- uses: pkgxdev/setup@v2
57+
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
58+
- uses: pkgxdev/setup@v4
5959
- uses: ./co/download-build-artifact
6060
with:
6161
pkg: ${{ needs.build.outputs.pkg }}
@@ -77,8 +77,8 @@ jobs:
7777
steps:
7878
- uses: actions/checkout@v4
7979
with:
80-
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
81-
- uses: pkgxdev/setup@v2
80+
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
81+
- uses: pkgxdev/setup@v4
8282
- uses: ./co/download-build-artifact
8383
with:
8484
pkg: ${{ needs.build.outputs.pkg }}
@@ -100,9 +100,9 @@ jobs:
100100
steps:
101101
- uses: actions/checkout@v4
102102
with:
103-
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
103+
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
104104

105-
- uses: pkgxdev/setup@v2
105+
- uses: pkgxdev/setup@v4
106106

107107
- uses: ./co/download-build-artifact
108108
id: dl
@@ -119,14 +119,14 @@ jobs:
119119

120120
- uses: actions/upload-artifact@v4
121121
with:
122-
path: ${{ steps.bottle.outputs.filename }}
123-
name: ${{ steps.bottle.outputs.name }}
122+
path: ${{ steps.bottle.outputs.filename }}
123+
name: ${{ steps.bottle.outputs.name }}
124124

125125
unavailable:
126126
runs-on: ubuntu-latest
127127
steps:
128128
- uses: actions/checkout@v4
129-
- uses: pkgxdev/setup@v2
129+
- uses: pkgxdev/setup@v4
130130

131131
- uses: ./build
132132
id: build
@@ -148,7 +148,7 @@ jobs:
148148
pkgs: ${{ steps.id.outputs.pkgs }}
149149
steps:
150150
- uses: actions/checkout@v4
151-
- uses: pkgxdev/setup@v2
151+
- uses: pkgxdev/setup@v4
152152
- uses: ./id
153153
id: id
154154
with:

.github/workflows/ci.cli.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
container: ${{ matrix.platform.img }}
3535
steps:
3636
- uses: actions/checkout@v4
37-
- uses: pkgxdev/setup@v2
37+
- uses: pkgxdev/setup@v4
3838

3939
# otherwise, we're getting some weird race conditions on CI
4040
- run: pkgx --sync
@@ -47,7 +47,7 @@ jobs:
4747
runs-on: ubuntu-latest
4848
steps:
4949
- uses: actions/checkout@v4
50-
- uses: pkgxdev/setup@v2
50+
- uses: pkgxdev/setup@v4
5151
- uses: ./.github/modify-pantry
5252
- run: test $(bin/bk status) = stark.com/foo
5353
- run: bin/bk build
@@ -71,7 +71,7 @@ jobs:
7171
runs-on: ubuntu-latest
7272
steps:
7373
- uses: actions/checkout@v4
74-
- uses: pkgxdev/setup@v2
74+
- uses: pkgxdev/setup@v4
7575
- run: pkgx --sync # FIXME PKGX_PANTRY_PATH causes auto sync to fail
7676
- name: build
7777
run: |

build/build.ts

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ await rsync(config.path.yaml.parent(), config.path.build.join("props"))
8181
// }), force: true })
8282

8383
/// create toolchain if necessary
84-
const toolchain_PATH = make_toolchain()
84+
const toolchain_PATH = await make_toolchain()
8585

8686
if (toolchain_PATH) {
8787
await gum('toolchain')
@@ -173,7 +173,7 @@ if (ghout) {
173173
}
174174

175175
///////////////////////////////////////////////////////////////////
176-
function make_toolchain() {
176+
async function make_toolchain() {
177177
if (yml?.build?.skip === 'shims' || yml?.build?.skip?.includes?.('shims')) {
178178
return
179179
}
@@ -185,13 +185,33 @@ function make_toolchain() {
185185
const has_llvm = deps.has('llvm.org')
186186
const has_binutils = deps.has('gnu.org/binutils')
187187

188+
// ensure default compiler is installed before creating toolchain symlinks
189+
if (!has_gcc && !has_llvm) {
190+
const rv = await new Deno.Command('pkgx', { args: ['+llvm.org', '--', 'true'] }).output()
191+
if (!rv.success) throw new Error('failed to install default llvm')
192+
}
193+
188194
// rm ∵ // https://github.com/pkgxdev/brewkit/issues/303
189195
const d = config.path.home.join('toolchain').rm({ recursive: true }).mkdir('p')
190196
const prefix = useConfig().prefix
191197

192-
const llvm = (bin: string) => prefix.join('llvm.org/v*/bin', bin)
193-
const gcc = (bin: string) => prefix.join('gnu.org/gcc/v*/bin', bin)
194-
const binutils = (bin: string) => prefix.join('gnu.org/binutils/v*/bin', bin)
198+
const dep_bin = (project: string, bin: string): Path => {
199+
const dep = config.deps.gas.find(x => x.pkg.project === project)
200+
if (dep) return dep.path.join('bin', bin)
201+
// fallback: resolve from installed versions
202+
const dir = prefix.join(project)
203+
if (dir.isDirectory()) {
204+
const versions = [...Deno.readDirSync(dir.string)]
205+
.filter(e => e.isDirectory && e.name.startsWith('v'))
206+
.sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true }))
207+
if (versions.length) return dir.join(versions.at(-1)!.name, 'bin', bin)
208+
}
209+
throw new Error(`cannot find ${project} installation`)
210+
}
211+
212+
const llvm = (bin: string) => dep_bin('llvm.org', bin)
213+
const gcc = (bin: string) => dep_bin('gnu.org/gcc', bin)
214+
const binutils = (bin: string) => dep_bin('gnu.org/binutils', bin)
195215

196216
const symlink = (names: string[], target: Path) => {
197217
for (const name of names) {

libexec/autoconf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ -x /usr/local/bin/pkgx ]; then
55
pkgx=/usr/local/bin/pkgx
66
else
77
# probs this is running in pkgx CI/CD
8-
pkgx="${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v*/bin/pkgx"
8+
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
99
fi
1010

1111
exec "$pkgx" +gnu.org/autoconf -- autoconf "$@"

libexec/automake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ -x /usr/local/bin/pkgx ]; then
55
pkgx=/usr/local/bin/pkgx
66
else
77
# probs this is running in pkgx CI/CD
8-
pkgx="${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v*/bin/pkgx"
8+
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
99
fi
1010

1111
exec "$pkgx" +gnu.org/automake -- automake "$@"

libexec/curl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ -x /usr/local/bin/pkgx ]; then
55
pkgx=/usr/local/bin/pkgx
66
else
77
# probs this is running in pkgx CI/CD
8-
pkgx="${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v*/bin/pkgx"
8+
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
99
fi
1010

1111
exec "$pkgx" +curl.se -- curl "$@"

libexec/git

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ -x /usr/local/bin/pkgx ]; then
55
pkgx=/usr/local/bin/pkgx
66
else
77
# probs this is running in pkgx CI/CD
8-
pkgx="${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v*/bin/pkgx"
8+
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
99
fi
1010

1111
exec "$pkgx" +git-scm.org -- git "$@"

libexec/install

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ -x /usr/local/bin/pkgx ]; then
55
pkgx=/usr/local/bin/pkgx
66
else
77
# probs this is running in pkgx CI/CD
8-
pkgx="${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v*/bin/pkgx"
8+
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
99
fi
1010

1111
exec "$pkgx" +gnu.org/coreutils -- install "$@"

libexec/libtool

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if [ -x /usr/local/bin/pkgx ]; then
1010
pkgx=/usr/local/bin/pkgx
1111
else
1212
# probs this is running in pkgx CI/CD
13-
pkgx="${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v*/bin/pkgx"
13+
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
1414
fi
1515

1616
exec "$pkgx" +gnu.org/libtool -- libtool "$@"

libexec/make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ elif [ -x /usr/local/bin/pkgx ]; then
77
pkgx=/usr/local/bin/pkgx
88
else
99
# probs this is running in pkgx CI/CD
10-
pkgx="${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v*/bin/pkgx"
10+
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
1111
fi
1212

1313
exec "$pkgx" +gnu.org/make -- make "$@"

0 commit comments

Comments
 (0)