laher / goxc

a build tool for Go, with a focus on cross-compiling, packaging and deployment
1.68k stars 79 forks source link

Installed-Size in deb control file #96

Closed jault3 closed 8 years ago

jault3 commented 8 years ago

I typically work on a Mac and just use the OS X builds that goxc generates, but recently a customer noticed that the .deb files goxc generates are "untrusted". This is due to the lack of an Installed-Size field in the control file. https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Installed-Size.

It's not a mandatory field it looks like, but it does generate a warning when trying to install it through the Ubuntu Software Center as show in this image.

c696fa0a-5d27-11e5-98a3-63125e93aab1

Could this be added by goxc? I can't really predict this value as it is an estimate of the binary size and would need to be done dynamically.

Current Settings

I am not specifying any settings in my .goxc.json file for the deb task but I do have a debian/control file

Maintainer: Catalyze <support@catalyze.io>
Description: Catalyze CLI
Installed-Size: 1
Package: catalyze
Source: catalyze
Architecture: any
Section: user/utils
Priority: optional

The 1 was just testing. It does not make it into the generated control file. Here is what I get when I look at the generated control file

$ goxc
... trimmed this. its too long ...

$ ar -vx builds/3.0.0/catalyze_3.0.0_amd64.deb 
x - debian-binary
x - control.tar.gz
x - data.tar.gz

$ tar xvzf control.tar.gz 
x control

$ cat control
Package: catalyze
Priority: optional
Maintainer: Catalyze <support@catalyze.io>
Section: user/utils
Version: 3.0.0
Architecture: amd64
Description: Catalyze CLI

by the way, great work on goxc. It's such a useful tool and has saved me tons of dev time!

jault3 commented 8 years ago

FWIW I modified the deb file on ubuntu 14.04 directly

mkdir temp
dpkg-deb -R catalyze_3.0.0_amd64.deb temp
vim temp/DEBIAN/control # I added the line 'Installed-Size: 10'
dpkg-deb -R catalyze_3.0.0_amd64.deb temp

tried reinstalling the deb and got this error

screen shot 2016-02-22 at 11 01 53 pm

the fix was to run that very last command as root to fix file permissions

sudo dpkg-deb -R catalyze_3.0.0_amd64.deb temp

Not sure if that is something that will happen if Installed-Size is added to goxc but I can help debug if you'd like.

jault3 commented 8 years ago

Turns out that if you do specify the Installed-Size field, the file permissions are correct. I have a PR for the debber repo https://github.com/debber/debber-v0.3/pull/1 if you get a chance.

laher commented 8 years ago

Hi there, thanks for coming up with a solution. I think the debber change looks good - I'll check more thoroughly and reply in that repo

jault3 commented 8 years ago

Fixed in https://github.com/debber/debber-v0.3/pull/1