Skip to content
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

shfmt: 3.0.2 -> 3.1.0 #84594

Merged
merged 2 commits into from Apr 8, 2020
Merged

shfmt: 3.0.2 -> 3.1.0 #84594

merged 2 commits into from Apr 8, 2020

Conversation

zowoq
Copy link
Contributor

@zowoq zowoq commented Apr 7, 2020

https://github.com/mvdan/sh/releases/tag/v3.1.0

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Member

@Emantor Emantor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • build package
$ nix build --no-link --keep-going --option build-use-sandbox relaxed -f /home/phoenix/.cache/nixpkgs-review/pr-84594/build.nix
[4 built, 0.0 MiB DL]
https://github.com/NixOS/nixpkgs/pull/84594
1 package built:
shfmt
  • tested against a simple shell file, formats it correctly.

};

modSha256 = "1ll2cxhgf8hh19wzdykgc81c4yfcp8bzmfaif08nvvb63rhjdb5y";
modSha256 = "080k8d5rp8kyg0x7vjxm758b9ya9z336yd4rcqws7yhqawxiv55z";
subPackages = ["cmd/shfmt"];

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you mind adding the following?

  buildFlagsArray = [ "-ldflags=-s -w -X main.version=${version}" ];

Copy link
Contributor Author

@zowoq zowoq Apr 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upstream seems to have broken this, it wasn't needed previously and even the 3.1.0 pre-built binaries don't set the version correctly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is not broken per se, upstream set version to devel, and allows to write main.version at link time, see its dockerfile
https://github.com/mvdan/sh/blob/v3.1.0/cmd/shfmt/Dockerfile#L5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mvdan/sh@bb3fed3
cmd/shfmt: set version to "devel" in master
Otherwise building master might feel like it's a release version.
Releases are tagged, and those tags have the right version.

mvdan/sh@8e403df
cmd/shfmt: start using module info for -version
This way, 'go get' installs will automatically have proper version
information. Do it in a way that doesn't break -ldflags=-X, since we use
that in the dockerfile.

Copy link
Contributor Author

@zowoq zowoq Apr 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added ldflags, we can remove it in a future release once it is fixed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for humor me. I must recognize that I barely know Golang, and you are probably right about this being a upstream issue

@marsam marsam merged commit bfd6cfb into NixOS:master Apr 8, 2020
@zowoq zowoq deleted the shfmt branch April 8, 2020 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants