Skip to content

Latest commit

 

History

History
198 lines (143 loc) · 9.83 KB

README.adoc

File metadata and controls

198 lines (143 loc) · 9.83 KB

1. Maintaining the LLVM Snapshots for Fedora

Konrad Kleine <[email protected]>

This document is supposed to give you an idea of what goes into maintaining the LLVM snapshots for Fedora. Don’t feel like you have read this document from top to bottom but instead consider it a reference. There is an Frequently Asked Questions (FAQ) section at the botton that probably contains many answers. Feel free to add your own there.

This is home for the generation of daily

1.1. Getting the latest snapshot

We need a bit of post-configuration after enabling the copr repository for this project.

$ dnf -y install jq envsubst
$ dnf -y install --skip-broken 'dnf-command(copr)' 'dnf5-command(copr)'
$ dnf -y copr enable @fedora-llvm-team/llvm-snapshots
$ repo_file=$(dnf repoinfo --json *llvm-snapshots* | jq -r ".[0].repo_file_path")
$ distname=$(rpm --eval "%{?fedora:fedora}%{?rhel:rhel}") envsubst '$distname' < $repo_file > /tmp/new_repo_file
$ cat /tmp/new_repo_file > $repo_file

Then install clang or some of the other packages.

2. Tips on contributing

This project uses pre-commit to validate that certain files (e.g. fmf or python) are not broken. Please install pre-commit using pip install pre-commit as described here. Then navigate to your clone of this project and install the git hook scripts using cd ~/llvm-snapshots && pre-commit install. This will run pre-commit on every git commit.

3. Process overview

We build LLVM snapshots on a daily basis on Copr and create a github issue in this very repository for every day to keep track of the build and testing status. The maintainer changes on a monthly basis and will be assigned to the issue.

For a while now we’ve switched from standalone builds to the building everything from a single dist git repo with the working title "big-merge" on the Fedora Package Source. Before we used to have one spec file repository for all the llvm subprojects (clang, lld, lldb, etc.). Now we’ve taken it one step further and build the snapshots directly out of the rawhide branch.

Our snapshot builds are done under our group account on Fedora Copr. There build for all supported Fedora version and some RHEL versions.

We carefully create a new copr project for each day. These projects are called incubator projects. Only if all packages for all operating systems and architectures in an incubator project were successfully built without errors, we will promote it to be the next "official" snapshot here.

For each chroot (except i386) we will also run testing-farm tests and report them in the daily issue. Some of these tests run on Red Hat internal hardware and are only reachable within the VPN. We try our best to utilize github labels to reflect the current state of builds and tests for each chroot.

Note
For now we "promote" a daily snapshot to the next "official" snapshot without having run testing-farm tests. This might change in the future.

That is the reason why sometimes it can take days until a new version of LLVM will be published here. If you’re interested in the version for a particular day, feel free to open https://copr.fedorainfracloud.org/coprs/g/fedora-llvm-team/llvm-snapshots-big-merge-YYYYMMDD/ (replace YYYYMMDD with the date you desire). Notice, that we cannot keep the invdividual incubator projects around forever.

4. Find out about the health of snapshots

Go to the Fedora Copr project and look for anything red in the monitor for today (see How do I find the monitor?).

5. How to fix an error in a package build for a specific OS/arch combination?

Suppose you want to work on the llvm package with nothing checkout locally, yet.

  1. Export your Fedora Account System username so you can copy and paste the commands below:

    $ export FAS_USER=<YOUR_USERMAME>
    Note
    This is optional and only for copy pasting the below commands. Use the username to login in here: https://id.fedoraproject.org/login.
  2. Clone the original source code’s rawhide branch and navigate to that directory.

    $ fedpkg clone llvm -b rawhide ~/dev/llvm-rpms/llvm
    
    $ cd ~/dev/llvm-rpms/llvm
  3. Go to https://src.fedoraproject.org/rpms/llvm and click the "fork" button in the top-right corner to create fork just for you. Then add it as a remote:

    $ git remote add $FAS_USER \
        ssh://[email protected]/forks/$FAS_USER/rpms/llvm.git

    You should have two git remote now: origin and one that is named after your FAS login.

  4. Make your changes to llvm and commit them locally.

    $ git add -p
    $ git commit -m "My changes"
  5. Push your local changes to a branch of your liking (e.g. mybranch) in your fork

    $ git push $FAS_USER HEAD:mybranch
  6. Create a pull-request for your changes so they can go into the rawhide branch by executing this and heading over to your browser:

    $ xdg-open https://src.fedoraproject.org/fork/$FAS_USER/rpms/compiler-rt/diff/rawhide..mybranch
  7. Wait for your changes to be approved and merged. Maybe ping someone from the team.

    Then your changes will automatically be taken into account for the next daily build.

  8. If you want to kick-off a build yourself, you can run:

    $ copr build-package \
        --name llvm \
        -r fedora-rawhide-x86_64 \
        --timeout $((30*3600)) \
        @fedora-llvm-team/llvm-snapshots-big-merge-`date +%Y%m%d`

    This will build the llvm package in today’s Copr project with your changes as soon as they landed in the rawhide branch.

6. Frequently Asked Questions

6.1. How can I clone llvm?

I cloned llvm with the appropriate tool (e.g. fedpkg, centpkg and rhpkg).

$ fedpkg clone llvm -b rawhide ~/src/llvm-rpms/llvm-rawhide #(1)
$ centpkg clone llvm -b c9s ~/src/llvm-rpms/llvm-centos #(2)
$ rhpkg clone llvm -b rhel-9-main ~/src/llvm-rpms/llvm-rhel #(3)
  1. This is for the regular fedora work on rawhide.

  2. This is for the work on CentOS stream.

  3. This is for the internal work on RHEL9.

6.2. How to sync with rawhide?

We do the snapshot work in the rawhide branch of fedora.

These are the benefits that we see: * No special handling for contributors. They can just use rawhide. * When making changes to the spec files for snapshots we can be sure that we’re not breaking rawhide because it is tested by Fedora CI. * No complicated git merging with big-merge or upstream-snapshot branches that we’ve had in the past. * Reverts are possible * Smoother release process? * Just increment the Version: tag used in the non-snapshot part and consume the previously tested changes from the snapshots.

Of course there are some downsides as well: * Possibly a lot of commit activity can happen in the rawhide branch that doesn’t change anything related to rawhide but only snapshots. * A bit more if/else branches in the spec files. * Duplicated patch files with slightly different content as they apply to each supported LLVM version.

We need %if %{maj_ver} >= 20 conditions or alike for different LLVM versions (see this PR for example).

6.3. How do I find the monitor?

You can find the snapshot monitor for LLVM Fedora builds on Copr here:

The above link brings you to the latest "forked" build. It will only contain successful builds.

To find out where this build came from, take a look at the title of the project. There it should say something like:

( forked from @fedora-llvm-team/llvm-snapshots-big-merge-20230221 )

Go to the project from which @fedora-llvm-team/llvm-snapshots was forked to find failing builds.

6.4. How do I run a local snapshot build?

$ git clone https://src.fedoraproject.org/rpms/llvm.git
$ cd llvm
$ make snapshot-rpm

You might need to install missing dependencies. The build process itself probably takes quite some time.

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