Skip to content

Commit 482c881

Browse files
jhheidermxcl
andauthored
fix git packages (#222)
git checkouts require their `.git` directories (basically the whole point); can't omit them. --------- Co-authored-by: Max Howell <mxcl@me.com>
1 parent 6c4badd commit 482c881

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

.github/workflows/ci.cli.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
- pyapp.com/1
2929
- pyapp.com/2
3030
- stark.com/foo@1.2.3
31+
- git-clone.com
3132
runs-on: ${{ matrix.platform.os }}
3233
container: ${{ matrix.platform.img }}
3334
steps:

bin/cmd/build

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,21 @@ const yml = YAML.parse(await config.path.yaml.read()) as any
5858

5959
/// fetch
6060
await gum('fetch & extract')
61+
let fetched: undefined | 'git' | 'tarball'
6162
if (yml.distributable) {
62-
await fetch(config)
63+
fetched = await fetch(config)
6364
} else {
6465
console.log("no srcs, skipping fetch")
6566
}
6667

6768
/// rsync sources & props to build stage
6869
await gum('stage')
69-
if (yml.distributable) {
70+
if (fetched == 'git') {
71+
await rsync(config.path.src, config.path.build)
72+
} else if (fetched == 'tarball') {
7073
await rsync(config.path.src, config.path.build, ['--exclude=.git'])
7174
}
75+
7276
await rsync(config.path.yaml.parent(), config.path.build.join("props"))
7377

7478
/// write out pkgx.yaml

lib/porcelain/fetch.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export default async function fetch({pkg, path: {tarball_dir, src: dstdir}}: Pic
1717
}
1818

1919
if (type === "git") {
20-
return clone({ dst: dstdir, src: url, ref })
20+
await clone({ dst: dstdir, src: url, ref })
21+
return 'git'
2122
} else {
2223
const zipfile = await download(url, tarball_dir, pkg)
2324
await hooks.useSourceUnarchiver().unarchive({ dstdir, zipfile, stripComponents })
@@ -26,7 +27,7 @@ export default async function fetch({pkg, path: {tarball_dir, src: dstdir}}: Pic
2627
await new Deno.Command("git", {args: ["init"], cwd}).spawn().status
2728
await new Deno.Command("git", {args: ["add", "."], cwd}).spawn().status
2829
}
29-
return dstdir
30+
return 'tarball'
3031
}
3132
}
3233

projects/git-clone.com/package.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
distributable:
2+
- url: git+https://github.com/pkgxdev/brewkit
3+
ref: v{{version}}
4+
5+
versions:
6+
github: pkgxdev/brewkit
7+
8+
build:
9+
dependencies:
10+
git-scm.org: '*'
11+
script:
12+
- touch foo
13+
- git add foo
14+
- run:
15+
- mkdir -p {{prefix}}
16+
- mv foo {{prefix}}
17+
18+
test: |
19+
true

0 commit comments

Comments
 (0)