Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some automation for doing periodic mass rebuilds of Fedora packages #864

Merged
merged 197 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
e252a90
Add some automation for doing periodic mass rebuilds of Fedora packages
tstellar Nov 13, 2024
d963e2d
Fix formatting
tstellar Nov 15, 2024
641aa8f
Fix formatting
tstellar Nov 15, 2024
2682ca9
Fix formatting
tstellar Nov 15, 2024
5ff0fa4
Fix formatting
tstellar Nov 15, 2024
38ce870
Fix formatting
tstellar Nov 15, 2024
658f24c
Fix formatting
tstellar Nov 15, 2024
41967a9
Fix docstring
tstellar Nov 15, 2024
b00f3bf
Update .github/workflows/rebuilder.py
tstellar Nov 18, 2024
366d12a
Update .github/workflows/rebuilder.py
tstellar Nov 18, 2024
4956c4a
Address review comments
tstellar Nov 18, 2024
ac66967
Fix formatting
tstellar Nov 19, 2024
8d16f12
Fix formatting
tstellar Nov 19, 2024
0767ab9
Try to install dnf
tstellar Nov 19, 2024
242e0ed
Fix dnf install
tstellar Nov 19, 2024
ec894ba
Fix dnf install
tstellar Nov 19, 2024
d4f0846
Remove accidental commit
tstellar Nov 19, 2024
e92ad11
Fix running tests
tstellar Nov 19, 2024
716d87e
Add debugging
tstellar Nov 19, 2024
d24398a
Debugging
tstellar Nov 19, 2024
e091245
Debugging
tstellar Nov 19, 2024
6cbd7fa
Debugging
tstellar Nov 19, 2024
851d171
Debugging
tstellar Nov 19, 2024
97451ba
Debugging
tstellar Nov 19, 2024
980e8bc
Python fix
tstellar Nov 19, 2024
e554bae
Python fix
tstellar Nov 19, 2024
e54d3a5
Debugging
tstellar Nov 19, 2024
1ccac7a
Python fix
tstellar Nov 19, 2024
d8320ab
Debug
tstellar Nov 19, 2024
5d53fdd
Python fix
tstellar Nov 19, 2024
cd166ad
Update requirements
tstellar Nov 19, 2024
713aed0
Merge remote-tracking branch 'origin/main'
tstellar Nov 19, 2024
e571777
Fix python
tstellar Nov 19, 2024
bba48cf
Fix python
tstellar Nov 19, 2024
2cfe6ac
Workaround
tstellar Nov 19, 2024
8cee26b
Workaround
tstellar Nov 19, 2024
22608be
Use fedora
tstellar Nov 19, 2024
b752967
Use fedora
tstellar Nov 19, 2024
6f7ad51
Use fedora
tstellar Nov 19, 2024
22d63b2
Use fedora
tstellar Nov 19, 2024
e6778dc
Use fedora
tstellar Nov 19, 2024
aaf3096
Use fedora
tstellar Nov 19, 2024
3c793aa
Undo some changes
tstellar Nov 19, 2024
f825712
Add reproducer containre
tstellar Dec 12, 2024
36c8f95
Fix container build
tstellar Dec 12, 2024
5095ed3
use system python for tests
tstellar Dec 17, 2024
254b139
Install python-dnf
tstellar Dec 17, 2024
eb6a7a8
Fix condition
tstellar Dec 17, 2024
78aee97
Enable tests
tstellar Dec 17, 2024
cfa5f8f
fix system-python input
tstellar Dec 17, 2024
9ee2bb5
Fix pytest paths
tstellar Dec 17, 2024
58e2f41
Debug
tstellar Dec 17, 2024
646c6e5
Fix typos
tstellar Dec 17, 2024
50c9526
Fix typo
tstellar Dec 17, 2024
1a66c7d
Fix test
tstellar Dec 17, 2024
8e4201c
Fix test cases
tstellar Dec 17, 2024
adb9ef6
Fix output
tstellar Dec 17, 2024
f19a157
Fix test output
tstellar Dec 17, 2024
eabe90c
Fix test output
tstellar Dec 17, 2024
b671a62
Fix test output
tstellar Dec 17, 2024
7700261
Fix test output
tstellar Dec 17, 2024
62bcf17
Fix test output
tstellar Dec 17, 2024
db95ac0
Add more tests and fix formatting
tstellar Dec 17, 2024
4aed876
Fix test output
tstellar Dec 17, 2024
944ce05
Fix formatting
tstellar Dec 17, 2024
788f1b8
Fix python setup
tstellar Dec 17, 2024
72d66b6
Fix formatting
tstellar Dec 17, 2024
00c0a55
Add documentation
tstellar Dec 17, 2024
1fe74e1
Update .github/workflows/mass-rebuild-bisect.yml
tstellar Dec 18, 2024
953d3b8
Update .github/workflows/mass-rebuild-reporter.yml
tstellar Dec 18, 2024
fb6b5c9
Update README.adoc
tstellar Dec 18, 2024
e511be3
Update README.adoc
tstellar Dec 18, 2024
035cc0a
Update README.adoc
tstellar Dec 18, 2024
38dfe2a
Update README.adoc
tstellar Dec 18, 2024
2cf938a
Update README.adoc
tstellar Dec 18, 2024
3692f62
Address some review comments
tstellar Dec 18, 2024
bbb231b
Fix formatting
tstellar Dec 18, 2024
c8c74f5
Fix tests
tstellar Dec 19, 2024
efd4cf5
Fix tests
tstellar Dec 19, 2024
3c9497c
Add missing @property
tstellar Dec 19, 2024
0830a9c
Fix tests
tstellar Dec 19, 2024
49b854b
Fix formatting
tstellar Dec 19, 2024
040da9c
Update .github/workflows/rebuilder.py
tstellar Dec 19, 2024
2e7df74
Update README.adoc
tstellar Dec 19, 2024
f6088c2
Add back snapshot_manager tests
tstellar Dec 19, 2024
ebe968d
Only build container on pushes to main
tstellar Dec 19, 2024
90ec618
Reporting improvements
tstellar Dec 19, 2024
5716db9
More reporting improvements
tstellar Dec 20, 2024
fcae50a
Add some automation for doing periodic mass rebuilds of Fedora packages
tstellar Nov 13, 2024
93e3d75
Fix formatting
tstellar Nov 15, 2024
57643e5
Fix formatting
tstellar Nov 15, 2024
56b889a
Fix formatting
tstellar Nov 15, 2024
d0bdbf3
Fix formatting
tstellar Nov 15, 2024
6e53487
Fix formatting
tstellar Nov 15, 2024
b28c17d
Fix formatting
tstellar Nov 15, 2024
160ac34
Fix docstring
tstellar Nov 15, 2024
be29018
Update .github/workflows/rebuilder.py
tstellar Nov 18, 2024
3aa434a
Update .github/workflows/rebuilder.py
tstellar Nov 18, 2024
6c29f1d
Address review comments
tstellar Nov 18, 2024
f239446
Fix formatting
tstellar Nov 19, 2024
c825d43
Fix formatting
tstellar Nov 19, 2024
4979895
Try to install dnf
tstellar Nov 19, 2024
25605bf
Fix dnf install
tstellar Nov 19, 2024
1caf425
Fix dnf install
tstellar Nov 19, 2024
04725f8
Fix running tests
tstellar Nov 19, 2024
8794938
Add debugging
tstellar Nov 19, 2024
2cf064d
Debugging
tstellar Nov 19, 2024
8b18abe
Debugging
tstellar Nov 19, 2024
0575f2e
Debugging
tstellar Nov 19, 2024
1509687
Debugging
tstellar Nov 19, 2024
bd704c3
Debugging
tstellar Nov 19, 2024
71b7527
Python fix
tstellar Nov 19, 2024
9c8ddd1
Python fix
tstellar Nov 19, 2024
ed4928c
Debugging
tstellar Nov 19, 2024
d7ef58d
Python fix
tstellar Nov 19, 2024
d9d8839
Debug
tstellar Nov 19, 2024
813aa9e
Python fix
tstellar Nov 19, 2024
43c6f01
Update requirements
tstellar Nov 19, 2024
4e68ea0
Fix python
tstellar Nov 19, 2024
c3b82e8
Fix python
tstellar Nov 19, 2024
ddef6db
Workaround
tstellar Nov 19, 2024
dae07f5
Workaround
tstellar Nov 19, 2024
014d3e7
Use fedora
tstellar Nov 19, 2024
b6a91b9
Use fedora
tstellar Nov 19, 2024
17903d7
Use fedora
tstellar Nov 19, 2024
b25ac78
Use fedora
tstellar Nov 19, 2024
cd22c17
Use fedora
tstellar Nov 19, 2024
db99051
Use fedora
tstellar Nov 19, 2024
0fcfba9
Undo some changes
tstellar Nov 19, 2024
333e678
Add reproducer containre
tstellar Dec 12, 2024
7f15193
Fix container build
tstellar Dec 12, 2024
71a1739
use system python for tests
tstellar Dec 17, 2024
abf8c4b
Install python-dnf
tstellar Dec 17, 2024
f3028db
Fix condition
tstellar Dec 17, 2024
d7acd76
Enable tests
tstellar Dec 17, 2024
93f4105
fix system-python input
tstellar Dec 17, 2024
445997d
Fix pytest paths
tstellar Dec 17, 2024
c53f5fd
Debug
tstellar Dec 17, 2024
a25b218
Fix typos
tstellar Dec 17, 2024
3ed0da9
Fix typo
tstellar Dec 17, 2024
7cfc3a0
Fix test
tstellar Dec 17, 2024
7e7c33a
Fix test cases
tstellar Dec 17, 2024
1745e99
Fix output
tstellar Dec 17, 2024
5b62b0f
Fix test output
tstellar Dec 17, 2024
06da24a
Fix test output
tstellar Dec 17, 2024
c780e30
Fix test output
tstellar Dec 17, 2024
52fb93a
Fix test output
tstellar Dec 17, 2024
d4b893f
Fix test output
tstellar Dec 17, 2024
eb492a4
Add more tests and fix formatting
tstellar Dec 17, 2024
a161e2b
Fix test output
tstellar Dec 17, 2024
cf812c1
Fix formatting
tstellar Dec 17, 2024
cab4bd1
Fix python setup
tstellar Dec 17, 2024
602a316
Fix formatting
tstellar Dec 17, 2024
3117f9f
Add documentation
tstellar Dec 17, 2024
675accb
Update .github/workflows/mass-rebuild-bisect.yml
tstellar Dec 18, 2024
69d7576
Update .github/workflows/mass-rebuild-reporter.yml
tstellar Dec 18, 2024
040d50d
Update README.adoc
tstellar Dec 18, 2024
0119e48
Update README.adoc
tstellar Dec 18, 2024
91c5f13
Update README.adoc
tstellar Dec 18, 2024
f7fde01
Update README.adoc
tstellar Dec 18, 2024
881f5c7
Update README.adoc
tstellar Dec 18, 2024
c5ab5ac
Address some review comments
tstellar Dec 18, 2024
42e134d
Fix formatting
tstellar Dec 18, 2024
c9c7559
Fix tests
tstellar Dec 19, 2024
5ceee26
Fix tests
tstellar Dec 19, 2024
ef87505
Add missing @property
tstellar Dec 19, 2024
92f830f
Fix tests
tstellar Dec 19, 2024
a506dbc
Fix formatting
tstellar Dec 19, 2024
0e99ee0
Update .github/workflows/rebuilder.py
tstellar Dec 19, 2024
d567044
Update README.adoc
tstellar Dec 19, 2024
2e00e5a
Add back snapshot_manager tests
tstellar Dec 19, 2024
7b1134f
Only build container on pushes to main
tstellar Dec 19, 2024
89abe93
Reporting improvements
tstellar Dec 19, 2024
2f9d81e
More reporting improvements
tstellar Dec 20, 2024
68c287e
Fix date
tstellar Dec 20, 2024
a188acd
Install python
tstellar Dec 20, 2024
8a11dcf
Install python
tstellar Dec 20, 2024
e7faf1e
XXX: Debugging
tstellar Dec 20, 2024
0b4553e
Fix
tstellar Dec 20, 2024
fa922b7
Fix reporter
tstellar Dec 20, 2024
384b688
Fix dep
tstellar Dec 20, 2024
f804382
XXX: Debug
tstellar Dec 20, 2024
6dfb263
Merge remote-tracking branch 'tstellar/better-reporting' into mass-re…
tstellar Dec 20, 2024
2241903
Update llvm-project repo before bisecting
tstellar Dec 23, 2024
4e48ac4
Rework CoprPkg and CoprBuild
tstellar Jan 3, 2025
951a78e
Remove file
tstellar Jan 3, 2025
760cf52
Remove file
tstellar Jan 3, 2025
38810cf
Rename to Containerfile
tstellar Jan 3, 2025
534f67d
Update container
tstellar Jan 3, 2025
96e6f5c
Fix regressions
tstellar Jan 3, 2025
d32e21d
Move rebuilder script
tstellar Jan 3, 2025
873dbc0
Limit workflows to main repo and fix pytest.ini
tstellar Jan 6, 2025
108ae07
Fix formatting
tstellar Jan 6, 2025
d292008
Fix formatting
tstellar Jan 6, 2025
2366a9b
Fix formatting
tstellar Jan 6, 2025
7deb356
Update README
tstellar Jan 7, 2025
bbf6edb
Merge branch 'main' into mass-rebuild
tstellar Jan 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/actions/prepare-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ inputs:
description: "Where this project was checked out"
required: false
default: "."
use-system-python:
kwk marked this conversation as resolved.
Show resolved Hide resolved
description: "Set to true if you want to use the python installation from the OS"
required: false
default: false
runs:
using: "composite"
steps:
- name: "Setup python"
uses: actions/setup-python@v5
if: "${{ inputs.use-system-python != 'true' }}"
kwk marked this conversation as resolved.
Show resolved Hide resolved
with:
python-version: 3.12
cache: 'pip'
Expand All @@ -24,4 +29,14 @@ runs:

- name: "Install python dependencies for project"
shell: bash
run: pip install -r ${{ inputs.checkout-path }}/requirements.txt
run: |
pip install -r ${{ inputs.checkout-path }}/requirements.txt

# The dnf module cannot be installed by pip, so it's only possible to use
# it when using the system pyhton interpreter.
- name: Install DNF module
if: "${{ inputs.use-system-python == 'true' }}"
shell: bash
run: |
sudo apt-get update
sudo apt-get install python3-dnf
27 changes: 27 additions & 0 deletions .github/workflows/build-reproducer-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Build Reproducer Container"

on:
push:
branches:
- main

permissions:
contents: read

jobs:
build-reproducer-container:
if: github.repository_owner == 'fedora-llvm-team'
runs-on: ubuntu-24.04
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Build Container
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
sudo apt-get -y update
sudo apt-get -y install podman
podman build -t ghcr.io/$GITHUB_REPOSITORY_OWNER/llvm-snapshots-reproducer -f Containerfile scripts/
podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io
podman push ghcr.io/$GITHUB_REPOSITORY_OWNER/llvm-snapshots-reproducer
40 changes: 40 additions & 0 deletions .github/workflows/mass-rebuild-bisect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Mass Rebuild Bisect

permissions:
contents: read

on:
workflow_dispatch:
inputs:
pkg:
description: "The name of the Fedora package build that you want to bisect."
required: true
type: string
workflow_call:
inputs:
pkg:
description: "The name of the Fedora package build that you want to bisect."
required: true
type: string

jobs:
mass-rebuild-bisect:
if: github.repository_owner == 'fedora-llvm-team'
runs-on: ubuntu-24.04
container:
image: "ghcr.io/${{ github.repository_owner }}/llvm-snapshots-reproducer"
steps:
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
max-size: 8G
key: bisect
- working-directory: /root/llvm-project/
run: |
git fetch origin
bash bisect.sh ${{ inputs.pkg }}

- if: always()
working-directory: /root/llvm-project
run: |
git bisect log
115 changes: 115 additions & 0 deletions .github/workflows/mass-rebuild-reporter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: "Mass Rebuild Reporter"

on:
schedule:
# Hourly at minute 40, e.g. 2024-12-18 00:40:00
- cron: "40 * * * *"
tstellar marked this conversation as resolved.
Show resolved Hide resolved
workflow_dispatch:

permissions:
contents: read

jobs:
check-for-rebuild:
if: github.repository_owner == 'fedora-llvm-team'
runs-on: ubuntu-24.04
permissions:
issues: write
container:
image: "registry.fedoraproject.org/fedora:41"
outputs:
regressions: ${{ steps.regressions.outputs.REGRESSIONS }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
scripts/rebuilder.py
sparse-checkout-cone-mode: false


- name: Check for last report
uses: actions/github-script@v7
id: last-report
with:
result-encoding: string
script: |
const issues = await github.rest.search.issuesAndPullRequests({
q: "label:mass-rebuild+is:issue",
sort: "created",
order: "desc",
per_page: 1
});

console.log(issues)
if (issues.data.total_count == 0)
return 0;
const issue = issues.data.items[0];
console.log(issue);
return issue.created_at

- name: Check if a new rebuild has completed
id: new-rebuild
run: |
sudo dnf install -y python3-dnf python3-copr
if python3 scripts/rebuilder.py rebuild-in-progress; then
echo "completed=false" >> $GITHUB_OUTPUT
exit 0
fi

last_rebuild=$(date +%s -d "${{ steps.last-report.outputs.result }}")
current_snapshot=$(date +%s -d "$(python3 scripts/rebuilder.py get-snapshot-date)")

echo "last_rebuild: $last_rebuild current_snapshot: $current_snapshot"

if [ $last_rebuild -gt $current_snapshot ]; then
echo "completed=false" >> $GITHUB_OUTPUT
else
echo "completed=true" >> $GITHUB_OUTPUT
fi

- name: Collect Regressions
if: steps.new-rebuild.outputs.completed == 'true'
id: regressions
run: |
python3 scripts/rebuilder.py get-regressions --start-date ${{ steps.last-report.outputs.result }} > regressions
echo "REGRESSIONS=$(cat regressions)" >> $GITHUB_OUTPUT

- name: Create Report
if: steps.new-rebuild.outputs.completed == 'true'
uses: actions/github-script@v7
env:
REGRESSIONS: ${{ steps.regressions.outputs.REGRESSIONS }}
with:
script: |
var fs = require('fs');
const regressions = await JSON.parse(fs.readFileSync('./regressions'));
comment = "During the last mass rebuild, some packages failed:\n";
console.log(regressions);
if (regressions.length == 0)
return;
regressions.forEach(function(value){
comment = comment.concat('\n', value.name);
comment = comment.concat(': ', value.url);
});
console.log(comment);
const issue = await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "Mass Rebuild Report",
labels: ['mass-rebuild'],
tstellar marked this conversation as resolved.
Show resolved Hide resolved
body: comment
});
console.log(issue);

bisect-failures:
if: github.repository_owner == 'fedora-llvm-team'
needs:
- check-for-rebuild
strategy:
max-parallel: 1
fail-fast: false
matrix:
include: ${{ fromJson(needs.check-for-rebuild.outputs.regressions) }}
uses: ./.github/workflows/mass-rebuild-bisect.yml
with:
pkg: ${{ matrix.name }}
37 changes: 37 additions & 0 deletions .github/workflows/mass-rebuild-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Mass Rebuild Runner"

on:
schedule:
# Run on the first of every month.
- cron: 30 1 1 * *
workflow_dispatch:

permissions:
contents: read

jobs:
start-rebuild:
if: github.repository_owner == 'fedora-llvm-team'
runs-on: ubuntu-24.04
container:
image: "registry.fedoraproject.org/fedora:41"
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
scripts/rebuilder.py
sparse-checkout-cone-mode: false

- name: Setup Copr config file
env:
# You need to have those secrets in your repo.
# See also: https://copr.fedorainfracloud.org/api/.
COPR_CONFIG_FILE: ${{ secrets.COPR_CONFIG }}
run: |
mkdir -p ~/.config
printf "$COPR_CONFIG_FILE" > ~/.config/copr

- name: Start rebuild
run: |
sudo dnf install -y python3-dnf python3-copr
python3 scripts/rebuilder.py rebuild
2 changes: 2 additions & 0 deletions .github/workflows/python-format-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare-python
with:
use-system-python: true
- name: Run pytest with coverage
shell: bash -e {0}
env:
Expand Down
19 changes: 19 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM registry.fedoraproject.org/fedora:41

ENV LLVM_SYSROOT=/opt/llvm \
AR=llvm-ar \
RANLIB=llvm-ranlib

RUN dnf -y copr enable tstellar/fedora-clang-default-cc

RUN dnf -y install jq cmake ninja-build git binutils-devel clang fedora-clang-default-cc rpmbuild ccache

WORKDIR /root

RUN git clone https://github.com/llvm/llvm-project

WORKDIR /root/llvm-project

ADD bisect.sh git-bisect-script.sh .

COPY --from=ghcr.io/llvm/ci-ubuntu-22.04:1734145213 $LLVM_SYSROOT $LLVM_SYSROOT
32 changes: 32 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,38 @@ $ cd llvm
$ make snapshot-rpm
----

= README
:icons: font

You might need to install missing dependencies. The build process itself probably takes quite some time.
tstellar marked this conversation as resolved.
Show resolved Hide resolved

You're going to find `results/YYYYMMDD/snapshot-rpm.log` with logging everything from this makefile target.

== Mass Rebuilds ==

This repository uses GitHub Actions to periodically perform rebuilds of selected
Fedora packages. Once a mass rebuild is complete there is also automation
that will create a new issue with the results of the rebuild.

The rebuild process will attempt to automatically bisect the failures to a specific upstream
LLVM commit.

The rebuild can be started manually using the rebuilder.py script in
`.github/workflows/`

[source,console]
---
$ python3 rebuilder.py rebuild
---
tstellar marked this conversation as resolved.
Show resolved Hide resolved

You can also view the regression report once the rebuild is complete using
the same script.

[source,console]
---
$ python3 rebuilder.py get-regressions --start-date=<yyyy-mm-dd>
---
tstellar marked this conversation as resolved.
Show resolved Hide resolved

The start date should be the day the rebuild was started (In reality
it can be any date between when the last rebuild ended and the
new rebuild began).
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ addopts: --doctest-modules --durations=0 -s

; Directories to search for tests when no files or directories are given on the
; command line
testpaths: snapshot_manager
testpaths: snapshot_manager scripts

; Each line specifies a pattern for warnings.filterwarnings. Processed after
; -W/--pythonwarnings.
Expand Down
46 changes: 46 additions & 0 deletions scripts/bisect.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

set -ex

function get_clang_commit {
buildid=$1
pkg=$2

curl "https://download.copr.fedorainfracloud.org/results/@fedora-llvm-team/fedora-41-clang-20/fedora-41-x86_64/0$buildid-$pkg/root.log.gz" | gunzip | grep -o 'clang[[:space:]]\+x86_64[[:space:]]\+[0-9a-g~pre.]\+' | cut -d 'g' -f 3
}


pkg_or_buildid=$1

if echo $pkg_or_buildid | grep '^[0-9]\+'; then
buildid=$pkg_or_buildid
read -r pkg last_success_id <<<$(curl -X 'GET' "https://copr.fedorainfracloud.org/api_3/build/$buildid" -H 'accept: application/json' | jq -r '[.builds.latest.source_package.name,.builds.latest_succeeded.id] | join(" ")')
else
pkg=$pkg_or_buildid
fi

read -r buildid last_success_id <<<$(curl -X 'GET' \
"https://copr.fedorainfracloud.org/api_3/package/?ownername=%40fedora-llvm-team&projectname=fedora-41-clang-20&packagename=$pkg&with_latest_build=true&with_latest_succeeded_build=true" \
-H 'accept: application/json' | jq -r '[.builds.latest.id,.builds.latest_succeeded.id] | join(" ")' )


good_commit=llvmorg-20-init
bad_commit=origin/main

good_commit=$(get_clang_commit $last_success_id $pkg)
bad_commit=$(get_clang_commit $buildid $pkg)

srpm_url=$(curl -X 'GET' "https://copr.fedorainfracloud.org/api_3/build/$buildid" -H 'accept: application/json' | jq -r .source_package.url)
curl -O -L $srpm_url
srpm_name=$(basename $srpm_url)

dnf builddep -y $srpm_name


git bisect start
git bisect good $good_commit
git bisect bad $bad_commit

cmake -G Ninja -B build -S llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=Native -DLLVM_BINUTILS_INCDIR=/usr/include/ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=/opt/llvm/bin/clang++ -DCMAKE_C_COMPILER=/opt/llvm/bin/clang

git bisect run ./git-bisect-script.sh $srpm_name
7 changes: 7 additions & 0 deletions scripts/git-bisect-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

srpm_name=$1

ninja -C build install-clang install-clang-resource-headers install-LLVMgold install-llvm-ar install-llvm-ranlib

rpmbuild -rb $srpm_name
Loading
Loading