Skip to content

Conversation

@hololeap
Copy link
Member

This is a PR for generally improving the quality of generated .ebuild files. Example .ebuild files have been added for "golden" testing. Moving forward, these will serve as guidelines or templates for how we want .ebuild files to look.

We can leverage the use of the prettyprinter package, which won't add much dependency footprint since it is also needed by optparse-applicative. This will be very useful for improving the showEBuild function (shown partially here).

-- | Pretty-print an 'EBuild' as a 'String'.
showEBuild :: TC.UTCTime -> EBuild -> String
showEBuild now ebuild =
ss ("# Copyright 1999-" ++ this_year ++ " Gentoo Authors"). nl.
ss "# Distributed under the terms of the GNU General Public License v2". nl.
nl.


@hololeap hololeap requested a review from solpeth August 25, 2023 05:55
@hololeap
Copy link
Member Author

hololeap commented Aug 25, 2023

@solpeth, I'd like you to take a look at the golden/example .ebuild files I included and let me know if you have any input on the formatting.

I selected these because they should cover the full range of issues we've been experiencing for generated ebuilds. They will serve as a template for how generated ebuilds should look:


Edit: @thesamesam if you have any input on how to improve the formatting of these example ebuilds, I'd be interested in your opinion.

@hololeap
Copy link
Member Author

.out files are simply data dumps, which were generated by pretty-simple outputting live EBuilds. They can be read from the file directly as EBuild data.

This data is fed into showEBuild, whose output is then compared to the corresponding golden .ebuild file.

@hololeap hololeap marked this pull request as ready for review August 25, 2023 06:24
@hololeap hololeap force-pushed the improve-ebuild-output branch from d31b93e to 3481040 Compare August 28, 2023 23:17
@hololeap hololeap force-pushed the improve-ebuild-output branch from 0d73e92 to 16e5b05 Compare February 8, 2024 21:55
@hololeap hololeap force-pushed the improve-ebuild-output branch from 37f5913 to bcf12ee Compare March 5, 2024 03:07
@hololeap
Copy link
Member Author

hololeap commented Aug 9, 2024

@049940

This will assist testing by allowing EBuild data to be read from a file

Signed-off-by: hololeap <[email protected]>
@hololeap hololeap force-pushed the improve-ebuild-output branch from bcf12ee to f8c75ff Compare February 4, 2025 06:41
hololeap and others added 12 commits February 3, 2025 23:55
Add "golden" tests which compare generated output to example ebuild
files. This will help aid development of improvements for ebuild output.

Signed-off-by: hololeap <[email protected]>
- Use an asterisk at the end of the version when possible
- Add newline to DEPEND
- Avoid backslashes by passing an array to src_configure
- Drop trailing .0 components

Thanks-to: Sam James <[email protected]>
Signed-off-by: hololeap <[email protected]>
Some rendering utility functions and Prettyprinter re-exports

Signed-off-by: hololeap <[email protected]>
Drop unused functions in Portage.Ebuild and associated test

Signed-off-by: hololeap <[email protected]>
LinesBuilder is a custom Monad that works by building up a list of
prettyprinter Docs and then concats them with vcat. It is helpful for
when a logical piece of the ebuild may use a variable number of lines,
including no lines at all (for instance when no CABAL_HACKAGE_REVISION
or CABAL_PN are used).

Improve some formatting

Signed-off-by: hololeap <[email protected]>
Wildcard matches save on characters, but they look messy in diffs when
an upper bound gets bumped for a dependency.

Signed-off-by: hololeap <[email protected]>
@hololeap hololeap force-pushed the improve-ebuild-output branch from f8c75ff to cb1e4b0 Compare February 4, 2025 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants