* refactor: remove pkg/errors
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: lint
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: Ensure relative path prefix for deb packages
This patch ensures that all items contained in tar.gz files in Debian
packages have a relative path prefix, so the names all start with "./".
While this is not strictly required for a Debian package to function,
detecting a changed config file fails with an error messages similar to
the following:
tar: ./etc/default/conffilename: Not found in archive
It seems to fail extracting config files for checking if they have been
modified by the system administrator.
All reference documentation that I was able to find (e.g. in the Debian
Handbook[1]) shows that all paths contained in either data.tar.gz and
control.tar.gz have the prefix "./".
I've verified that with this change, config files works as expected.
[1] https://debian-handbook.info/browse/stable/packaging-system.html#sect.binary-package-structure
* fix: Remove dpkg filters for changelog acceptance test.
* fix: Fix broken md5sums file when a changelog is added.
Co-authored-by: Alexander Neumann <alexander.neumann@redteam-pentesting.de>
* fix: Remove leading slashes from symlinks and changelog in deb.
* test: Test that deb .tar.gz files don't contain leading slashes.
* fix: Fix acceptance tests by removing slashes globally.
* refactor: internal/files
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: lint issues
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: Reflect (pre)release in conventional file names.
* test: Add tests for conventional file names.
* test: Make test case variables consistent.
Co-authored-by: Erik Geiser <erik.geiser@redteam-pentesting.de>
Co-authored-by: Dj Gilcrease <d.gilcrease@f5.com>
Co-authored-by: Dj Gilcrease <d.gilcrease@f5.com>
Co-authored-by: Erik Geiser <erik.geiser@redteam-pentesting.de>
* refactor: add a method on Info to list files to copy to the package
Since iterating over the files to copy to the package is something that
all package formats need, adding a central place for that logic reduces
duplication.
Also sort the list of files as a step toward making builds more
reproducible.
* Update nfpm.go
* Rename `CopiedFile` to `FileToCopy`
* Add test for `FilesToCopy`
Co-authored-by: Danny Zhu <dzhu@dzhu.us>
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
* fix: golangci-lint
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* feat: update golangci-lint
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: docs
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: lint issues
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: test
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: test
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: test
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
The description field in the DEB control file supports multiline/verbatim
input. It is done by indenting the lines by two spaces. Before this patch,
the control file was broken if a user wanted to supply a multiline description.
* add stricter linting
* As part of this it changes the API slightly changing all uses of the `nfpm.Info` object to accept a pointer to reduce memory usage as pointed out by `hugeParam: info is heavy (568 bytes); consider passing it by pointer (gocritic)`
* fix: rules tests, overridables
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* doc: gogoc
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: rpm template
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: rpm template
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* feat: Add optional packager tag to rpm spec
Using the `Maintainer` tag from deb as the `Packager` tag for rpm
See #57
* feat: Optional epoch field added to both rpm and dep packages
See #57
* test: Adding test for deb epoch field
Adding a unit test for the epoch field and fixing the implementation
of version number with epoch for deb packager.
See #57
The Debian policy[1] declares the following control file fields as
required for binary packages:
* Package
* Version
* Section
* Priority
* Architecture
* Maintainer
* Description
All other fields are optional. A few programs handling .deb packages
emit warnings when optional fields exist without a value.
With this change the template generating the control file is updated to
omit empty values. Comments are added to denote mandatory fields.
A newly added test verifies the generated control file.
[1]
<https://www.debian.org/doc/debian-policy/ch-controlfields.html#
binary-package-control-files-debian-control>
Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Added file globs to deb and rpm packager. Since the destination for
a glob can not be a single file, the files collected by the glob are
stored in: join(dst, trim(lcp(src), src)) (read: lcp = longest common
prefix). Thereby the longest common prefix is removed from every path in
the globbed files and joined with the destination path. Implementation
is backwards compatible (i.e. non-globs will work as before)