kernel recipes 2014 - advanced quilt

26
Advanced Quilt That's how it's done! Jean DELVARE Level 3 Support Engineer SUSE

Upload: anne-nicolas

Post on 24-May-2015

355 views

Category:

Software


1 download

DESCRIPTION

A presentation of the quilt patch management tool, including use cases (SUSE kernel, OBS) and practical usability tips. Quick presentation of what quilt is, what it can be used for, its most useful commands and what they do 3 typical use cases, step by step Package version update in OBS Patch review as an upstream maintainer Adding a patch to the SUSE kernel Quilt vs Git discussion Known caveats and how to work around them Cool tips: how to get the better of quilt Q&A Jean Delvare, SUSE

TRANSCRIPT

Page 1: Kernel Recipes 2014 - Advanced Quilt

Advanced QuiltThat's how it's done!

Jean DELVARELevel 3 Support Engineer

SUSE

Page 2: Kernel Recipes 2014 - Advanced Quilt

2

Advanced Quilt

• Quick introduction to Quilt

• Quilt versus Git

• Practical use cases‒ Patch review as an upstream maintainer

‒ Package version update in OBS

‒ Adding a patch to the SUSE kernel

• Known limitations

• Cool tips

• Q&A

Page 3: Kernel Recipes 2014 - Advanced Quilt

3

Quick introduction to Quilt

Quilt lets you manage a series of patches on top of a working directory. You can:

• Import and remove patches

• Navigate through the series

• Modify patches

• Create new patches anywhere

• Merge patches together

• Export patches in various ways and formats

• And more...

Page 4: Kernel Recipes 2014 - Advanced Quilt

4

Quilt versus Gitor why Quilt still rocks

Developers may think Git made Quilt obsolete:

• Git is very good to store the work once done

• Git is very good to handle huge amounts of data

• Git handles branches very well

• Git makes digging through history very easy‒ Especially if developers have been careful

‒ Which they aren't always

• Quilt is very good for work in progress, when developing, testing or more generally hacking around

Page 5: Kernel Recipes 2014 - Advanced Quilt

Practical use case #1Patch review as an upstream maintainer

Page 6: Kernel Recipes 2014 - Advanced Quilt

Practical use case #2Package version update in OBS

Page 7: Kernel Recipes 2014 - Advanced Quilt

Practical use case #3Adding a patch to the SUSE kernel

Page 8: Kernel Recipes 2014 - Advanced Quilt

8

Known limitations

• Don't forget “quilt add”!‒ Better add more than needed, unchanged files are discarded

automatically

‒ Always use “quilt edit”, it's safer

• Quilt can be slow‒ But I'm working hard to solve the most critical performance

issues

‒ Please report performance issues to me

• ~/.quiltrc takes over system defaults‒ Keep ~/.quiltrc up-to-date

‒ Or source /etc/quilt.quiltrc in ~/.quiltrc

Page 9: Kernel Recipes 2014 - Advanced Quilt

9

Cool tips: get the best out of Quilt!

• Quilt commands can be abbreviated

• All commands print some help with -h

• Use ~/.quiltrc‒ Set QUILT_PATCHES_PREFIX=yes

‒ You can set EDITOR too

‒ Add --color to diff, series, push, patches commands

‒ Set every option you always use for each command

• Quilt now supports a pager, if you like it

Page 10: Kernel Recipes 2014 - Advanced Quilt

10

~/.quiltrc file example

# Global optionsQUILT_PATCHES_PREFIX=yesQUILT_NO_DIFF_INDEX=1QUILT_NO_DIFF_TIMESTAMPS=1QUILT_PAGER=

# Options for external toolsQUILT_DIFF_OPTS="-p"QUILT_PATCH_OPTS="-F 3"

# Default command argumentsQUILT_DIFF_ARGS="--color"QUILT_REFRESH_ARGS="--sort -p ab --diffstat --strip-trailing-whitespace"QUILT_PUSH_ARGS="--color=auto"QUILT_SERIES_ARGS="--color=auto"QUILT_PATCHES_ARGS="--color=auto"

Page 11: Kernel Recipes 2014 - Advanced Quilt

Thank you.

11

Questions?

Page 12: Kernel Recipes 2014 - Advanced Quilt

Corporate HeadquartersMaxfeldstrasse 590409 NurembergGermany

+49 911 740 53 0 (Worldwide)www.suse.com

Join us on:www.opensuse.org

12

Page 13: Kernel Recipes 2014 - Advanced Quilt

Unpublished Work of SUSE LLC. All Rights Reserved.This work is an unpublished work and contains confidential, proprietary and trade secret information of SUSE LLC. Access to this work is restricted to SUSE employees who have a need to know to perform tasks within the scope of their assignments. No part of this work may be practiced, performed, copied, distributed, revised, modified, translated, abridged, condensed, expanded, collected, or adapted without the prior written consent of SUSE. Any use or exploitation of this work without authorization could subject the perpetrator to criminal and civil liability.

General DisclaimerThis document is not to be construed as a promise by any participating company to develop, deliver, or market a product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. SUSE makes no representations or warranties with respect to the contents of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. The development, release, and timing of features or functionality described for SUSE products remains at the sole discretion of SUSE. Further, SUSE reserves the right to revise this document and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. All SUSE marks referenced in this presentation are trademarks or registered trademarks of Novell, Inc. in the United States and other countries. All third-party trademarks are the property of their respective owners.

Page 14: Kernel Recipes 2014 - Advanced Quilt

Advanced QuiltThat's how it's done!

Jean DELVARELevel 3 Support Engineer

SUSE

Page 15: Kernel Recipes 2014 - Advanced Quilt

2

Advanced Quilt

• Quick introduction to Quilt

• Quilt versus Git

• Practical use cases‒ Patch review as an upstream maintainer

‒ Package version update in OBS

‒ Adding a patch to the SUSE kernel

• Known limitations

• Cool tips

• Q&A

Page 16: Kernel Recipes 2014 - Advanced Quilt

3

Quick introduction to Quilt

Quilt lets you manage a series of patches on top of a working directory. You can:

• Import and remove patches

• Navigate through the series

• Modify patches

• Create new patches anywhere

• Merge patches together

• Export patches in various ways and formats

• And more...

Page 17: Kernel Recipes 2014 - Advanced Quilt

4

Quilt versus Gitor why Quilt still rocks

Developers may think Git made Quilt obsolete:

• Git is very good to store the work once done

• Git is very good to handle huge amounts of data

• Git handles branches very well

• Git makes digging through history very easy‒ Especially if developers have been careful

‒ Which they aren't always

• Quilt is very good for work in progress, when developing, testing or more generally hacking around

Sometimes I submit a patch upstream, then realize it's not good but the maintainer has already applied it. He/she will ask me for an incremental patch to fix the problem, instead of a replacement patch... because of git! With quilt, a replacement patch would do.

Same for reviewing credits or approvals: often not recorded because the patch was already applied by the maintainer. This kind of discourages reviews.

Sometimes even build breakages end up being fixed by extra patches without rebasing. This is wrong!

Git's ability to work off-line discarded some of Quilt's former use cases, but I believe it is still very useful. And not all software repositories have migrated to Git yet (yes, it's a matter of time...)

Page 18: Kernel Recipes 2014 - Advanced Quilt

Practical use case #1Patch review as an upstream maintainer

# First version received* rename-patch* quilt import ; rm* quilt push* quilt diff | less* ./scripts/checkpatch.pl# Replied with comments ; second version received* quilt snapshot* quilt pop* rename-patch* quilt import* quilt import -f -d n ; rm* quilt push* quilt diff | less* quilt diff –snapshot | less* quilt snapshot -d# Patch accepted

Page 19: Kernel Recipes 2014 - Advanced Quilt

Practical use case #2Package version update in OBS

Page 20: Kernel Recipes 2014 - Advanced Quilt

Practical use case #3Adding a patch to the SUSE kernel

“quilt annotate” can also be demonstrated at this point.

Page 21: Kernel Recipes 2014 - Advanced Quilt

8

Known limitations

• Don't forget “quilt add”!‒ Better add more than needed, unchanged files are discarded

automatically

‒ Always use “quilt edit”, it's safer

• Quilt can be slow‒ But I'm working hard to solve the most critical performance

issues

‒ Please report performance issues to me

• ~/.quiltrc takes over system defaults‒ Keep ~/.quiltrc up-to-date

‒ Or source /etc/quilt.quiltrc in ~/.quiltrc

Emacs has a plug-in that can call “quilt add” for you.You can also make your tree read-only.Also make sure you run the first “quilt new” or “quilt import” at the root of your working directory.Performance is limited by the fact that Quilt is implemented as bash scripts, but it doesn't mean improvements aren't possible. For example I recently improved the “quilt series” command, which took over 3 minutes on the SLE11 SP3 kernel before and now takes under a second. We are really pushing Quilt to its limits with the SLE11 SP3 kernel tree which has over 15,000 patches!

Page 22: Kernel Recipes 2014 - Advanced Quilt

9

Cool tips: get the best out of Quilt!

• Quilt commands can be abbreviated

• All commands print some help with -h

• Use ~/.quiltrc‒ Set QUILT_PATCHES_PREFIX=yes

‒ You can set EDITOR too

‒ Add --color to diff, series, push, patches commands

‒ Set every option you always use for each command

• Quilt now supports a pager, if you like it

I've not typed “quilt refresh” or “quilt previous” in years.~/.quiltrc is a bash script, you can use shell constructs.Colors can be adjusted if needed.

Page 23: Kernel Recipes 2014 - Advanced Quilt

10

~/.quiltrc file example

# Global optionsQUILT_PATCHES_PREFIX=yesQUILT_NO_DIFF_INDEX=1QUILT_NO_DIFF_TIMESTAMPS=1QUILT_PAGER=

# Options for external toolsQUILT_DIFF_OPTS="-p"QUILT_PATCH_OPTS="-F 3"

# Default command argumentsQUILT_DIFF_ARGS="--color"QUILT_REFRESH_ARGS="--sort -p ab --diffstat --strip-trailing-whitespace"QUILT_PUSH_ARGS="--color=auto"QUILT_SERIES_ARGS="--color=auto"QUILT_PATCHES_ARGS="--color=auto"

Page 24: Kernel Recipes 2014 - Advanced Quilt

Thank you.

11

Questions?

Page 25: Kernel Recipes 2014 - Advanced Quilt

Corporate HeadquartersMaxfeldstrasse 590409 NurembergGermany

+49 911 740 53 0 (Worldwide)www.suse.com

Join us on:www.opensuse.org

12

Page 26: Kernel Recipes 2014 - Advanced Quilt

Unpublished Work of SUSE LLC. All Rights Reserved.This work is an unpublished work and contains confidential, proprietary and trade secret information of SUSE LLC. Access to this work is restricted to SUSE employees who have a need to know to perform tasks within the scope of their assignments. No part of this work may be practiced, performed, copied, distributed, revised, modified, translated, abridged, condensed, expanded, collected, or adapted without the prior written consent of SUSE. Any use or exploitation of this work without authorization could subject the perpetrator to criminal and civil liability.

General DisclaimerThis document is not to be construed as a promise by any participating company to develop, deliver, or market a product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. SUSE makes no representations or warranties with respect to the contents of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. The development, release, and timing of features or functionality described for SUSE products remains at the sole discretion of SUSE. Further, SUSE reserves the right to revise this document and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. All SUSE marks referenced in this presentation are trademarks or registered trademarks of Novell, Inc. in the United States and other countries. All third-party trademarks are the property of their respective owners.