jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.1k stars 1.06k forks source link

FreeBSD package: `--prefix` setting not honoured as expected, regular files "not specified in the manifest" (regression?) #1832

Open m-ueberall opened 2 years ago

m-ueberall commented 2 years ago

When building .deb, .rpm, .txz packages as follows with fpm 1.13.1 …

[...]
+ fpm -a amd64 --log error -p .ci/build --prefix /usr -s dir -t deb --name dnscontrol --version 3.12.0 --license 'The MIT License (MIT)' --url https://dnscontrol.org/ --description 'DNSControl: Infrastructure as Code for DNS Zones' dnscontrol=/bin/ LICENSE=/share/doc/dnscontrol/
Created package {:path=>".ci/build/dnscontrol_3.12.0_amd64.deb"}
+ fpm -a amd64 --log error -p .ci/build --prefix /usr -s dir -t rpm --name dnscontrol --version 3.12.0 --license 'The MIT License (MIT)' --url https://dnscontrol.org/ --description 'DNSControl: Infrastructure as Code for DNS Zones' dnscontrol=/bin/ LICENSE=/share/doc/dnscontrol/
Created package {:path=>".ci/build/dnscontrol-3.12.0-1.x86_64.rpm"}
+ fpm -a amd64 --log error --prefix /usr/local -s dir -t freebsd --name dnscontrol --version 3.12.0 --license 'The MIT License (MIT)' --url https://dnscontrol.org/ --description 'DNSControl: Infrastructure as Code for DNS Zones' dnscontrol=/bin/ LICENSE=/share/doc/dnscontrol/
[...]

… the resulting path names/contents are as expected for the first two packages:

% less .ci/build/dnscontrol-3.12.0-1.x86_64.rpm
[...]
*** Contents:
/usr/bin/dnscontrol
/usr/share/doc/dnscontrol/LICENSE
% less .ci/build/dnscontrol_3.12.0_amd64.deb
[...]
*** Contents:
drwxrwxr-x 0/0               0 2021-09-20 21:39 ./
drwxr-xr-x 0/0               0 2021-09-20 21:39 ./usr/
drwxr-xr-x 0/0               0 2021-09-20 21:39 ./usr/share/
drwxr-xr-x 0/0               0 2021-09-20 21:39 ./usr/share/doc/
drwxr-xr-x 0/0               0 2021-09-20 21:39 ./usr/share/doc/dnscontrol/
-rw-r--r-- 0/0             145 2021-09-20 21:39 ./usr/share/doc/dnscontrol/changelog.gz
-rw-rw-r-- 0/0            1080 2021-09-19 18:50 ./usr/share/doc/dnscontrol/LICENSE
drwxr-xr-x 0/0               0 2021-09-20 21:39 ./usr/bin/
-rwxrwxr-x 0/0        28950528 2021-09-20 21:39 ./usr/bin/dnscontrol

However, the .txz package cannot be installed as is on FreeBSD 13.0-RELEASE using pkg 1.16.3:

root@freebsd13-vm-amd64:/tmp/download # ll
total 12985
-rw-rw-r--  1 root  wheel  6635968 Sep 20 21:39 dnscontrol-3.12.0_amd64.txz
root@freebsd13-vm-amd64:/tmp/download # tar -xvf dnscontrol-3.12.0_amd64.txz 
x +COMPACT_MANIFEST
x +MANIFEST
x usr/local/bin/dnscontrol
x usr/local/share/doc/dnscontrol/LICENSE
root@freebsd13-vm-amd64:/tmp/download # cat -- +MANIFEST 
{"arch":"Linux:5:x86:64","name":"dnscontrol","version":"3.12.0","comment":"DNSControl: Infrastructure as Code for DNS Zones","desc":"DNSControl: Infrastructure as Code for DNS Zones","origin":"fpm/dnscontrol","maintainer":"<ueberall_l@desktop01>","www":"https://dnscontrol.org/","prefix":"/","files":{"/usr/local/bin/dnscontrol":"f47e00423afbc2315a567b7638c608b2ad89bd065ca2e5d26d4392d07b305307","/usr/local/share/doc/dnscontrol/LICENSE":"97136a3a50304c366cafb5c47470acca6bf784a0f98c6848486fcb3a7070d7a0"},"scripts":{}}
root@freebsd13-vm-amd64:/tmp/download # pkg install -y ./dnscontrol-3.12.0_amd64.txz 
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        dnscontrol: 3.12.0

Number of packages to be installed: 1
[1/1] Installing dnscontrol-3.12.0...
Extracting dnscontrol-3.12.0:   0%
pkg: File //usr/local/bin/dnscontrol not specified in the manifest
Extracting dnscontrol-3.12.0: 100%
root@freebsd13-vm-amd64:/tmp/download # 

Note (a) the missing leading / for all non-metadata files (this was previously mentioned in issue #1811–maybe a regression?) and (b) the fact that the "prefix" field in +MANIFEST is seemingly always set to "/" while the original path names get modified instead if --prefix is specified on the fpm command line; given that "native" packages indeed use "/usr/local" in the "prefix" field, this is also somewhat unexpected.

vkurland commented 2 years ago

note that architecture is also wrong in the +MANIFEST -- fpm set it to "Linux:5:x86:64" instead of "FreeBSD:13:amd64". command "pkg add" will refuse to install it with error "pkg: wrong architecture:"

jordansissel commented 2 years ago

Ahh good catch, Vadim!

On Sat, Sep 25, 2021 at 5:28 PM Vadim Kurland @.***> wrote:

note that architecture is also wrong in the +MANIFEST -- fpm set it to "Linux:5:x86:64" instead of "FreeBSD:13:amd64". command "pkg add" will refuse to install it with error "pkg: wrong architecture:"

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jordansissel/fpm/issues/1832#issuecomment-927203442, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABAF2XHBBAVBW6MBPEQPALUDZSJHANCNFSM5EMW73DQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

m-ueberall commented 2 years ago

note that architecture is also wrong in the +MANIFEST -- fpm set it to "Linux:5:x86:64" instead of "FreeBSD:13:amd64". command "pkg add" will refuse to install it with error "pkg: wrong architecture:"

No (not anymore?), after correcting the path of files contained in the compressed .txz (tar) archive without changing the MANIFEST (see this workaround I'm currently using)–which still contains "Linux:5:x86:64"–I had no problems installing it on FreeBSD 13. IMHO this is only to document the build environment and has no other meaning. You can (re)try it yourself using these .txz packages generated from the referenced script.

EDIT: I only used pkg install as shown above, not pkg add (which should perform additional checks, then?), though.

jordansissel commented 2 years ago

I have a small idea for what might be the problem (regarding prefix and manifest interactions for FreeBSD packages) but I haven’t made time to investigate further.

I agree this behavior seems like a bug — fpm should only produce usable packages.

On Wed, Sep 29, 2021 at 11:02 PM Markus Ueberall @.***> wrote:

note that architecture is also wrong in the +MANIFEST -- fpm set it to "Linux:5:x86:64" instead of "FreeBSD:13:amd64". command "pkg add" will refuse to install it with error "pkg: wrong architecture:"

No (not anymore?), after correcting the path of files contained in the compressed .txz (tar) archive without changing the MANIFEST (see this workaround I'm currently using https://github.com/m-ueberall/dnscontrol/blob/e0906d3a063e4f4030a3473ef8468919c43a4d08/.ci/build.sh#L63)–which still contains "Linux:5:x86:64"–I had no problems installing it on FreeBSD 13. IMHO this is only to document the build environment and has no other meaning. You can (re)try it yourself using these .txz packages https://github.com/m-ueberall/dnscontrol/releases/tag/v3.12.0.3 generated from the referenced script.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/jordansissel/fpm/issues/1832#issuecomment-930810314, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABAF2R7ECK6K2L623HPWOLUEP4O7ANCNFSM5EMW73DQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

dvachaiev commented 2 years ago

I'm also faced this issue in version 1.13.1, but versions prior 1.13.0 work fine.

jordansissel commented 2 years ago

In testing things for #1844, I found that #1812 might have fixed this? I don't have a freebsd machine at the moment to test, but the package looks OK.

% fpm -f -s dir -t freebsd -n example --prefix /pants ~/.zshrc

# Checking the manifest files list
% tar -Jxf example-1.0.txz -O +MANIFEST |jq '.files | keys'
[
  "/pants/home/jls/.zshrc"
]

# Checking the files in the tar
% tar -Jtf example-1.0.txz  2> /dev/null
+COMPACT_MANIFEST
+MANIFEST
/pants/home/jls/.zshrc
m-ueberall commented 2 years ago

In testing things for #1844, I found that #1812 might have fixed this? I don't have a freebsd machine at the moment to test, but the package looks OK.

I built the gem from https://github.com/jordansissel/fpm/commit/60de482c2cb8d22c6f4b1ec6ce1fb1efc215677d and used it with my build script mentioned earlier today; the logs show that no modifications of the resulting .txz archives are necessary any more and pkg install in my updated FreeBSD 13 environment (now w/ pkg 1.17.2) worked flawlessly. :grinning: (TL;DR: Can't wait to see an updated gem being published.)

jordansissel commented 2 years ago

This is good news! Thank you for taking the time to test this <3

I’ll try to get another release published next time I’m at my computer.

On Tue, Nov 2, 2021 at 5:10 AM Markus Ueberall @.***> wrote:

In testing things for #1844 https://github.com/jordansissel/fpm/issues/1844, I found that #1812 https://github.com/jordansissel/fpm/pull/1812 might have fixed this? I don't have a freebsd machine at the moment to test, but the package looks OK.

I built the gem from 60de482 https://github.com/jordansissel/fpm/commit/60de482c2cb8d22c6f4b1ec6ce1fb1efc215677d and used it with my build script mentioned earlier https://github.com/m-ueberall/dnscontrol/blob/multiarch-builds-variant/.ci/build.sh today; the logs show that no modifications of the resulting .txz archives are necessary any more and pkg install in my updated FreeBSD 13 environment (now w/ pkg 1.17.2) worked flawlessly. 😀 (TL;DR: Can't wait to see an updated gem being published.)

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/jordansissel/fpm/issues/1832#issuecomment-957409990, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABAF2RD5OX5RFEEF6DOFGDUJ7IKLANCNFSM5EMW73DQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.