-
Notifications
You must be signed in to change notification settings - Fork 50
Add source provenance documentation to debian/README.Debian #726
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: cpuguy83 <799078+cpuguy83@users.noreply.github.com>
packaging/linux/deb/debroot.go
Outdated
| // GenerateReadmeDebian creates the content for debian/README.Debian that documents | ||
| // source provenance, allowing consumers to understand where sources came from. | ||
| // This is exported for testing purposes. | ||
| func GenerateReadmeDebian(spec *dalec.Spec) []byte { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Why do we need an exported function?
Co-authored-by: cpuguy83 <799078+cpuguy83@users.noreply.github.com>
packaging/linux/deb/debroot.go
Outdated
| fmt.Fprintf(buf, "-----------------\n\n") | ||
| fmt.Fprintf(buf, "This package was built from the following sources:\n\n") | ||
|
|
||
| if len(spec.Sources) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot this should return before we've written anything and just return a nil slice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in fed46d7. The function now returns nil immediately when there are no sources, avoiding creation of README.Debian file entirely. Updated calling code to handle nil return value and modified tests accordingly.
Co-authored-by: cpuguy83 <799078+cpuguy83@users.noreply.github.com>
|
@copilot rebase |
| "strings" | ||
| "testing" | ||
|
|
||
| "github.com/Azure/dalec" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot The import path is now github.com/project-dalec/dalec
This PR implements source provenance documentation for Debian packages by automatically generating
debian/README.Debianfiles that document where each source came from, similar to how RPM specs already include this information as comments.Problem
RPM packages built with dalec include detailed source provenance documentation in the spec file comments, allowing consumers to understand and reproduce builds. However, Debian packages lacked this same functionality, making it difficult for users to understand the origins of package sources.
Solution
Added automatic generation of
debian/README.Debianfiles during the Debian package build process. The implementation:Source.Doc()method that's already implemented for all source typesdebian/README.Debianlocation as recommended by Debian packaging guidelinesExample Output
For a package with multiple source types, the generated
debian/README.Debianlooks like:Implementation Details
generateReadmeDebian()function inpackaging/linux/deb/debroot.goDebroot()functionnilwhen no sources are present to avoid creating empty documentation filesFixes #556.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.