Skip to content

Commit

Permalink
Merge pull request #29 from parca-dev/download_musl
Browse files Browse the repository at this point in the history
Add musl offsets
  • Loading branch information
kakkoyun authored Feb 22, 2024
2 parents b5a0597 + bf635ea commit ac2e144
Show file tree
Hide file tree
Showing 26 changed files with 968 additions and 11 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/generate-musl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Generate musl
on:
workflow_call:
push:
branches:
- main
- release
paths:
- ".github/workflows/generate-musl.yml"
- "pkg/libc/musl"
- "scripts"
- "Makefile"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
generate-and-create-branch:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out the code
uses: actions/checkout@v4

- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true

- name: Setup devbox
run: devbox run -- echo "done!"

- name: Load devbox shellenv
uses: HatsuneMiku3939/direnv-action@v1
with:
direnvVersion: 2.32.3

- name: Set up Go tool cache
uses: actions/cache@v4
with:
path: ~/.devbox/go
key: devbox-go-tools.cache-${{ runner.os }}-${{ runner.arch }}

- name: Build
run: make build

- name: Set up cache for downloaded files
uses: actions/cache@v4
with:
path: workspace-musl
key: musl-downloaded-${{ runner.os }}-${{ matrix.arch }}
restore-keys: |
musl-downloaded-${{ runner.os }}-${{ matrix.arch }}
- name: Generate musl Offsets
run: |
TEMP_DIR=workspace-musl make generate/musl
# If there are no changes (i.e. no diff exists with the checked-out base branch),
# no pull request will be created and the action exits silently.
- name: Create a pull-request
if: github.event_name != 'pull_request'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update musl layouts"
title: "chore: Update musl layouts"
branch: update-offsets-musl-${{ github.run_number }}
add-paths: pkg/libc/musl/layout
base: main
labels: chore
draft: false
delete-branch: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ tmp
/mergelayout
/debdownload
/debuginfofind
/apkdownload
/main
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ mergelayout: cmd/mergelayout/mergelayout.go $(filter-out *_test.go,$(GO_SRC))
debdownload: cmd/debdownload/debdownload.go $(filter-out *_test.go,$(GO_SRC))
go build -o $@ $<

apkdownload: cmd/apkdownload/apkdownload.go $(filter-out *_test.go,$(GO_SRC))
go build -o $@ $<

debuginfofind: cmd/debuginfofind/debuginfofind.go $(filter-out *_test.go,$(GO_SRC))
go build -o $@ $<

.PHONY: build
build: structlayout mergelayout debdownload debuginfofind
build: structlayout mergelayout debdownload apkdownload debuginfofind
go build ./...

.PHONY: generate
generate: build generate/python generate/ruby generate/glibc
generate: build generate/python generate/ruby generate/glibc generate/musl

.PHONY: generate/python
generate/python:
Expand All @@ -42,6 +45,12 @@ generate/glibc:
./scripts/structlayout/glibc.sh
./scripts/mergelayout/glibc.sh

.PHONY: generate/musl
generate/musl:
./scripts/download/musl.sh
./scripts/structlayout/musl.sh
./scripts/mergelayout/musl.sh

.PHONY: clean
clean:
rm -rf target
Expand Down Expand Up @@ -97,10 +106,13 @@ $(TMPDIR)/mergelayout-help.txt: $(TMPDIR) ./cmd/mergelayout/mergelayout.go
$(TMPDIR)/debdownload-help.txt: $(TMPDIR) ./cmd/debdownload/debdownload.go
go run ./cmd/debdownload/debdownload.go -h > $@ 2>&1

$(TMPDIR)/apkdownload-help.txt: $(TMPDIR) ./cmd/apkdownload/apkdownload.go
go run ./cmd/apkdownload/apkdownload.go -h > $@ 2>&1

$(TMPDIR)/debuginfofind-help.txt: $(TMPDIR) ./cmd/debuginfofind/debuginfofind.go
go run ./cmd/debuginfofind/debuginfofind.go -h > $@ 2>&1

.PHONY: README.md
README.md: $(TMPDIR)/structlayout-help.txt $(TMPDIR)/mergelayout-help.txt $(TMPDIR)/debdownload-help.txt $(TMPDIR)/debuginfofind-help.txt
README.md: $(TMPDIR)/structlayout-help.txt $(TMPDIR)/mergelayout-help.txt $(TMPDIR)/debdownload-help.txt $(TMPDIR)/debuginfofind-help.txt $(TMPDIR)/apkdownload-help.txt
go run github.com/campoy/embedmd/v2@latest -w README.md
devbox generate readme CONTRIBUTING.md
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ flags:
-output string
output directory to write the layout file
-r string
name of the pre-defined runtime, e.g. python, ruby, libc (shorthand)
name of the pre-defined runtime, e.g. python, ruby, libc, musl (shorthand)
-runtime string
name of the pre-defined runtime, e.g. python, ruby, libc
name of the pre-defined runtime, e.g. python, ruby, libc, musl
-v string
version of the runtime that the layout to generate, e.g. 3.9.5 (shorthand)
-version string
Expand Down Expand Up @@ -139,6 +139,23 @@ FLAGS
```


### apkdownload
[embedmd]:# (tmp/apkdownload-help.txt)
```txt
NAME
apkdownload
FLAGS
-o, --output STRING output directory to write the downloaded apk files (default: tmp/bin)
-t, --temp-dir STRING temporary directory to download deb files (default: tmp/apk)
-u, --url STRING URL to download apk files from
-p, --package STRING package name to download
-a, --arch STRING architectures to download
-c, --constraint STRING version constraints to download
```

### debuginfofind
[embedmd]:# (tmp/debuginfofind-help.txt)
```txt
Expand Down
Loading

0 comments on commit ac2e144

Please sign in to comment.