mirror of
https://github.com/goreleaser/nfpm.git
synced 2026-06-19 08:05:04 +00:00
fix: path in Debian md5sums file (#1052)
When packaging a Debian file, I noticed: ```bash $ cat /var/lib/dpkg/info/<my-pkg>.md5sums d53cafdbafeaa62df89f21a80ccb7c1e ./etc/<my-pkg>/<some-file>.yml ``` From the [Debian md5sums manpages](https://manpages.debian.org/testing/dpkg-dev/deb-md5sums.5.en.html): > This file contains a list of MD5 digests (as 32 case-insensitive > hexadecimal characters) followed by two spaces (U+0020 SPACE) and > the absolute pathname of a plain file, one per line. > > Trailing slashes (U+002F /) in the pathname will be trimmed. > Neither trailing whitespace nor empty or whitespace-only > lines are accepted. So, a proper file should contain lines like (note no `./`): ``` d53cafdbafeaa62df89f21a80ccb7c1e etc/<my-pkg>/<some-file>.yml ``` I do not know Go but I was able to come up with this fix which works at least for my use case.
This commit is contained in:
+1
-1
@@ -505,7 +505,7 @@ func copyToTarAndDigest(file *files.Content, tw *tar.Writer, md5w io.Writer) (in
|
||||
if _, err := io.Copy(tw, io.TeeReader(tarFile, digest)); err != nil {
|
||||
return 0, fmt.Errorf("%s: failed to copy: %w", file.Source, err)
|
||||
}
|
||||
if _, err := fmt.Fprintf(md5w, "%x %s\n", digest.Sum(nil), header.Name); err != nil {
|
||||
if _, err := fmt.Fprintf(md5w, "%x %s\n", digest.Sum(nil), files.AsRelativePath(header.Name)); err != nil {
|
||||
return 0, fmt.Errorf("%s: failed to write md5: %w", file.Source, err)
|
||||
}
|
||||
return file.Size(), nil
|
||||
|
||||
Reference in New Issue
Block a user