Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: goreleaser/nfpm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.41.3
Choose a base ref
...
head repository: goreleaser/nfpm
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 5 commits
  • 9 files changed
  • 5 contributors

Commits on Feb 27, 2025

  1. docs: update cmd docs

    caarlos0 authored and github-actions[bot] committed Feb 27, 2025
    Copy the full SHA
    eaf8141 View commit details

Commits on Feb 28, 2025

  1. chore(deps): bump actions/cache from 4.2.1 to 4.2.2 (#911)

    Bumps [actions/cache](https://github.com/actions/cache) from 4.2.1 to 4.2.2.
    - [Release notes](https://github.com/actions/cache/releases)
    - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
    - [Commits](actions/cache@0c907a7...d4323d4)
    
    ---
    updated-dependencies:
    - dependency-name: actions/cache
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 28, 2025
    Copy the full SHA
    0e9d1d8 View commit details

Commits on Mar 11, 2025

  1. chore(deps): bump cachix/install-nix-action from 30 to 31 (#913)

    Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 30 to 31.
    - [Release notes](https://github.com/cachix/install-nix-action/releases)
    - [Commits](cachix/install-nix-action@v30...v31)
    
    ---
    updated-dependencies:
    - dependency-name: cachix/install-nix-action
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Mar 11, 2025
    Copy the full SHA
    00e6b7e View commit details

Commits on Mar 13, 2025

  1. feat: Add BuildHost option to RPM packages (#914)

    This commit adds the BuildHost option to the RPM specific configurations. If the build
    host is not provided it will default to os.Hostname() which is the previous behavior.
    This allows reproduce-able builds when the build environment spans
    multiple hosts.
    
    Co-authored-by: onshorechet <onshorechet@github.com>
    onshorechet and onshorechet authored Mar 13, 2025
    Copy the full SHA
    2c0c2a0 View commit details
  2. chore: re-generate schema

    Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
    caarlos0 committed Mar 13, 2025
    Copy the full SHA
    5f52cb6 View commit details
Showing with 27 additions and 10 deletions.
  1. +2 −2 .github/workflows/build.yml
  2. +1 −1 .github/workflows/docs.yml
  3. +1 −1 .github/workflows/release.yml
  4. +1 −0 nfpm.go
  5. +6 −3 rpm/rpm.go
  6. +7 −2 rpm/rpm_test.go
  7. +4 −0 www/docs/configuration.md
  8. +1 −1 www/docs/static/latest
  9. +4 −0 www/docs/static/schema.json
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ jobs:
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
with:
path: dist/
key: ${{ env.sha_short }}
@@ -118,7 +118,7 @@ jobs:
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
with:
path: dist/
key: ${{ env.sha_short }}
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
github_access_token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ jobs:
- uses: anchore/sbom-action/download-syft@v0.18.0
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: cachix/install-nix-action@v30
- uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: task setup
1 change: 1 addition & 0 deletions nfpm.go
Original file line number Diff line number Diff line change
@@ -377,6 +377,7 @@ type ArchLinuxScripts struct {
// RPM is custom configs that are only available on RPM packages.
type RPM struct {
Arch string `yaml:"arch,omitempty" json:"arch,omitempty" jsonschema:"title=architecture in rpm nomenclature"`
BuildHost string `yaml:"buildhost,omitempty" json:"buildhost,omitempty" jsonschema:"title=host name of the build environment, default=os.Hostname()"`
Scripts RPMScripts `yaml:"scripts,omitempty" json:"scripts,omitempty" jsonschema:"title=rpm-specific scripts"`
Group string `yaml:"group,omitempty" json:"group,omitempty" jsonschema:"title=package group,example=Unspecified"`
Summary string `yaml:"summary,omitempty" json:"summary,omitempty" jsonschema:"title=package summary"`
9 changes: 6 additions & 3 deletions rpm/rpm.go
Original file line number Diff line number Diff line change
@@ -235,9 +235,12 @@ func buildRPMMeta(info *nfpm.Info) (*rpmpack.RPMMetaData, error) {
return nil, err
}

hostname, err := os.Hostname()
if err != nil {
return nil, err
hostname := info.RPM.BuildHost
if hostname == "" {
hostname, err = os.Hostname()
if err != nil {
return nil, err
}
}

return &rpmpack.RPMMetaData{
9 changes: 7 additions & 2 deletions rpm/rpm_test.go
Original file line number Diff line number Diff line change
@@ -80,8 +80,9 @@ func exampleInfo() *nfpm.Info {
PostRemove: "../testdata/scripts/postremove.sh",
},
RPM: nfpm.RPM{
Group: "foo",
Prefixes: []string{"/opt"},
Group: "foo",
BuildHost: "barhost",
Prefixes: []string{"/opt"},
Scripts: nfpm.RPMScripts{
PreTrans: "../testdata/scripts/pretrans.sh",
PostTrans: "../testdata/scripts/posttrans.sh",
@@ -139,6 +140,10 @@ func TestRPM(t *testing.T) {
require.NoError(t, err)
require.Equal(t, "foo", group)

buildhost, err := rpm.Header.GetString(rpmutils.BUILDHOST)
require.NoError(t, err)
require.Equal(t, "barhost", buildhost)

summary, err := rpm.Header.GetString(rpmutils.SUMMARY)
require.NoError(t, err)
require.Equal(t, "Foo does things", summary)
4 changes: 4 additions & 0 deletions www/docs/configuration.md
Original file line number Diff line number Diff line change
@@ -351,6 +351,10 @@ rpm:
# This will expand any env var you set in the field, e.g. packager: ${PACKAGER}
packager: GoReleaser <staff@goreleaser.com>

# The hostname of the machine the rpm was built with. If ommited os.Hostname()
# will be used.
buildhost: buildserver1

# Compression algorithm (gzip (default), zstd, lzma or xz).
compression: zstd

2 changes: 1 addition & 1 deletion www/docs/static/latest
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.41.2
v2.41.3
4 changes: 4 additions & 0 deletions www/docs/static/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.