goreleaser / nfpm

nFPM is Not FPM - a simple deb, rpm, apk, ipk, and arch linux packager written in Go
https://nfpm.goreleaser.com/
MIT License
2.14k stars 157 forks source link

fix: windows #690

Closed caarlos0 closed 1 year ago

caarlos0 commented 1 year ago

fixed all backslash issues that I/the CI found

refs https://github.com/goreleaser/goreleaser/issues/4174

cloudflare-pages[bot] commented 1 year ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: b193007
Status: ✅  Deploy successful!
Preview URL: https://82638576.nfpm.pages.dev
Branch Preview URL: https://windows.nfpm.pages.dev

View logs

codecov[bot] commented 1 year ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (main@d710da8). Click here to learn what that means. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #690   +/-   ##
=======================================
  Coverage        ?   74.79%           
=======================================
  Files           ?       10           
  Lines           ?     2384           
  Branches        ?        0           
=======================================
  Hits            ?     1783           
  Misses          ?      425           
  Partials        ?      176           
Impacted Files Coverage Δ
apk/apk.go 73.23% <100.00%> (ø)
arch/arch.go 78.57% <100.00%> (ø)
deb/deb.go 71.80% <100.00%> (ø)
files/files.go 76.64% <100.00%> (ø)
internal/glob/glob.go 85.07% <100.00%> (ø)
rpm/rpm.go 70.50% <100.00%> (ø)
caarlos0 commented 1 year ago

idk why, apk complains:

WARNING: foo-1.2.3beta: ignoring malicious file /etc/
WARNING: foo-1.2.3beta: ignoring malicious file /etc/foo/
WARNING: foo-1.2.3beta: ignoring malicious file /etc/foo/whatever.conf
WARNING: foo-1.2.3beta: ignoring malicious file /etc/something/
WARNING: foo-1.2.3beta: ignoring malicious file /etc/something/a
WARNING: foo-1.2.3beta: ignoring malicious file /etc/something/b
WARNING: foo-1.2.3beta: ignoring malicious file /etc/something/c/
WARNING: foo-1.2.3beta: ignoring malicious file /etc/something/c/d
WARNING: foo-1.2.3beta: ignoring malicious file /usr/
WARNING: foo-1.2.3beta: ignoring malicious file /usr/bin/
WARNING: foo-1.2.3beta: ignoring malicious file /usr/bin/fake
WARNING: foo-1.2.3beta: ignoring malicious file /usr/bin/fake2
WARNING: foo-1.2.3beta: ignoring malicious file /usr/foo/
WARNING: foo-1.2.3beta: ignoring malicious file /usr/foo/bar/
WARNING: foo-1.2.3beta: ignoring malicious file /usr/foo/bar/something/
WARNING: foo-1.2.3beta: ignoring malicious file /usr/share/
WARNING: foo-1.2.3beta: ignoring malicious file /usr/share/foo/
WARNING: foo-1.2.3beta: ignoring malicious file /usr/share/whatever/
WARNING: foo-1.2.3beta: ignoring malicious file /usr/share/whatever/folder/
WARNING: foo-1.2.3beta: ignoring malicious file /usr/share/whatever/folder/file1
WARNING: foo-1.2.3beta: ignoring malicious file /usr/share/whatever/folder/file2
WARNING: foo-1.2.3beta: ignoring malicious file /usr/share/whatever/folder/folder2/
WARNING: foo-1.2.3beta: ignoring malicious file /usr/share/whatever/folder/folder2/file1
WARNING: foo-1.2.3beta: ignoring malicious file /usr/share/whatever/folder/folder2/file2
WARNING: foo-1.2.3beta: ignoring malicious file /var/
WARNING: foo-1.2.3beta: ignoring malicious file /var/log/
WARNING: foo-1.2.3beta: ignoring malicious file /var/log/whatever/

will dig more tomorrow, so far what I found is that when packaged on windows, apk is creating the tar with the absolute path instead of relative, e.g.:

❯ tar tvf foo.apk
-rw-------  0 0      0         275 Dec 31  1969 .PKGINFO
-rwxr-xr-x  0 0      0         435 Jul 11 00:59 .pre-install
-rwxr-xr-x  0 0      0          45 Jul 11 00:59 .pre-upgrade
-rwxr-xr-x  0 0      0         693 Jul 11 00:59 .post-install
-rwxr-xr-x  0 0      0          46 Jul 11 00:59 .post-upgrade
-rwxr-xr-x  0 0      0         408 Jul 11 00:59 .pre-deinstall
-rwxr-xr-x  0 0      0         564 Jul 11 00:59 .post-deinstall
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /etc/
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /etc/foo/
-rw-rw-r--  0 root   root        8 Jul 11 00:59 /etc/foo/whatever.conf
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /etc/something/
-rw-rw-r--  0 root   root        1 Jul 11 00:59 /etc/something/a
-rw-rw-r--  0 root   root        1 Jul 11 00:59 /etc/something/b
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /etc/something/c/
-rw-rw-r--  0 root   root        1 Jul 11 00:59 /etc/something/c/d
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /usr/
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /usr/bin/
-rw-rw-r--  0 root   root       10 Jul 11 00:59 /usr/bin/fake
-rwsr-xr-x  0 root   root       10 Jul 11 00:59 /usr/bin/fake2
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /usr/foo/
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /usr/foo/bar/
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /usr/foo/bar/something/
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /usr/share/
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /usr/share/foo/
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /usr/share/whatever/
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /usr/share/whatever/folder/
-rw-rw-r--  0 root   root        5 Jul 11 00:59 /usr/share/whatever/folder/file1
-rw-rw-r--  0 root   root        5 Jul 11 00:59 /usr/share/whatever/folder/file2
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /usr/share/whatever/folder/folder2/
-rw-rw-r--  0 root   root       13 Jul 11 00:59 /usr/share/whatever/folder/folder2/file1
-rw-rw-r--  0 root   root       13 Jul 11 00:59 /usr/share/whatever/folder/folder2/file2
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /var/
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /var/log/
drwxr-xr-x  0 root   root        0 Jul 11 01:00 /var/log/whatever/

versus a working package:

❯ tar tvf nfpm_2.31.0_x86_64.apk
-rw-------  0 0      0         404 Dec 31  1969 .PKGINFO
drwxr-xr-x  0 root   root        0 Jun 26 11:34 usr/
drwxr-xr-x  0 root   root        0 Jun 26 11:34 usr/bin/
-rwxr-xr-x  0 root   root 12660736 Jun 26 10:56 usr/bin/nfpm
drwxr-xr-x  0 root   root        0 Jun 26 11:34 usr/share/
drwxr-xr-x  0 root   root        0 Jun 26 11:34 usr/share/bash-completion/
drwxr-xr-x  0 root   root        0 Jun 26 11:34 usr/share/bash-completion/completions/
-rw-r--r--  0 root   root    11658 Jun 26 11:31 usr/share/bash-completion/completions/nfpm
drwxr-xr-x  0 root   root        0 Jun 26 11:34 usr/share/doc/
drwxr-xr-x  0 root   root        0 Jun 26 11:34 usr/share/doc/nfpm/
-rw-r--r--  0 root   root     1067 Jun 26 11:31 usr/share/doc/nfpm/copyright
drwxr-xr-x  0 root   root        0 Jun 26 11:34 usr/share/fish/
drwxr-xr-x  0 root   root        0 Jun 26 11:34 usr/share/fish/vendor_completions.d/
-rw-r--r--  0 root   root     9508 Jun 26 11:32 usr/share/fish/vendor_completions.d/nfpm.fish
drwxr-xr-x  0 root   root        0 Jun 26 11:34 usr/share/man/
drwxr-xr-x  0 root   root        0 Jun 26 11:34 usr/share/man/man1/
-rw-r--r--  0 root   root      623 Jun 26 11:32 usr/share/man/man1/nfpm.1.gz
drwxr-xr-x  0 root   root        0 Jun 26 11:34 usr/share/zsh/
drwxr-xr-x  0 root   root        0 Jun 26 11:34 usr/share/zsh/vendor-completions/
-rw-r--r--  0 root   root     7676 Jun 26 11:31 usr/share/zsh/vendor-completions/_nfpm

I'm sure I'm missing something obvious, blind by tiredness :P