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 a step to check if patches apply before invoking TuxSuite #800

Merged

Conversation

nathanchance
Copy link
Member

There is no point in spinning up TuxSuite for a build if any patches that we need to apply are going to fail to do so. At the beginning of a build, check if the patches apply to the current repository and reference. This is done by downloading a tarball of the source, running git init and committing the files, then finally running git quiltimport to make sure that that patches still apply. It would be simpler to use git clone --depth=1 but cloning can be expensive on the server side and these jobs may run at the same time.

Closes: #796

NOTE: I have not bumped the generated files to make this easier to review and reason through. I will do it before merging.

with TemporaryDirectory() as workdir:
# Fetch the tarball from the repository. This is different for each type of
# tree that we support.
if args.repo.startswith(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good spot for Python's new-ish match expression. I'm always looking for an excuse to use it.

Not a blocker for approval though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow TIL, that kind of melts my brain a little bit haha. We have technically written these scripts to be compatible with Python 3.8 and newer but it looks like match was added in 3.10? We can likely change that when ubuntu-latest becomes ubuntu-24.04 since that should have a pretty recent Python version. Thanks for the review! I will rebase this and merge it shortly.

There is no point in spinning up TuxSuite for a build if any patches
that we need to apply are going to fail to do so. At the beginning of a
build, check if the patches apply to the current repository and
reference. This is done by downloading a tarball of the source, running
'git init' and committing the files, then finally running
'git quiltimport' to make sure that that patches still apply. It would
be simpler to use 'git clone --depth=1' but cloning can be expensive
on the server side and these jobs may run at the same time.

Closes: ClangBuiltLinux#796
Signed-off-by: Nathan Chancellor <[email protected]>
@nathanchance nathanchance force-pushed the check-if-patches-apply branch from c45868e to bb5f5b8 Compare January 21, 2025 18:58
@nathanchance nathanchance merged commit 55dd36d into ClangBuiltLinux:main Jan 21, 2025
7 checks passed
@nathanchance nathanchance deleted the check-if-patches-apply branch January 21, 2025 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explore adding a check that patches apply at current revision before calling tuxsuite
2 participants