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

Created a script for automatic creation of .deb packages from source Resolve #43 #117

Merged
merged 6 commits into from
May 20, 2015

Conversation

pallavagarwal07
Copy link
Contributor

As mentioned by @pcottle , I have made the necessary additions to makeDist.py and created all necessary files in debian directory which would facilitate the creation of the debian package.
Please review.

I have already accepted Facebook's Contributor License Agreement (CLA).

@pcottle
Copy link
Contributor

pcottle commented May 17, 2015

👏 😍 this is awesome @pallavagarwal07. Did you see my comment about the man pages? we could use the output of fpp --help to generate that, since it will show all the possible command line options and the most recent usage strings.

Im installing dpkg via brew so hopefully I can run this myself as well. most of this is magic to me but im excited to try it out

@pallavagarwal07
Copy link
Contributor Author

@pcottle Yes, I saw the comment. The format of the man pages is usually fixed. I don't think the same page can be used. I'll have to read up a bit more before I can say for sure.

@pcottle
Copy link
Contributor

pcottle commented May 17, 2015

hrm im getting one error:

[pcottle:~/Dropbox (Facebook)/wip/PathPicker:]$ dpkg --build ./
dpkg-deb: error: parsing file './/DEBIAN/control' near line 7:
 missing package name

so i cant try it out. curious what you think about the man page but if we dont go that direction ill merge this PR just so we have somewhere to start for the linux packages

@pcottle pcottle changed the title Created a script for automatic creation of .deb packages from source Created a script for automatic creation of .deb packages from source Resolve #43 May 17, 2015
@pallavagarwal07
Copy link
Contributor Author

Try this:
install devscripts package, comment out lines from 3-12 in makeDist.py and run ./scripts/makeDist.py from the source directory (in which scripts, debian) folders are present

I have used debuild command to create packages. It runs both dpkg and some verify script internally. But this works perfectly on mine. Will try directly by dpkg and report back

@pallavagarwal07
Copy link
Contributor Author

Yeah. Getting the same errors when running dpkg manually although dpkg-buildpackage command works perfectly.

@pallavagarwal07
Copy link
Contributor Author

The more I am trying dpkg, the more I'm convinced that the method I followed was debhelper specific. Run using the script in makeDist. It also rewrites one of the file to have the correct version number and timestamp. So package won't be build directly anyway.

EDIT:I don't know if this is possible to do in Mac OS. It seems like Mac only has support for dpkg, while all the new documents on debian packaging are based on the dh tools.
Does the script necessarily have to run on Mac?

@pallavagarwal07
Copy link
Contributor Author

@pcottle
Is there a chance I could talk to you (on chat / skype)? I think I can fix the problem but I have some doubts like about where the script would be run etc.

@pallavagarwal07
Copy link
Contributor Author

@pcottle
I have rewritten the files on basis of dpkg. Now executing package.sh inside the debian directory creates the .deb file in the parent without any problems.

Note: file should be executed from inside the debian directory, fakeroot should be installed.

Please review

@tbpalsulich
Copy link

Works for me on Ubuntu 15.04:

➜  PathPicker git:(DebianPackaging) cd debian 
➜  debian git:(DebianPackaging) ✗ fpp --help
zsh: command not found: fpp
➜  debian git:(DebianPackaging) ./package.sh 
dpkg-deb: building package `pathpicker' in `../fpp.deb'.
➜  debian git:(DebianPackaging) ✗ sudo dpkg -i ../fpp.deb
Selecting previously unselected package pathpicker.
(Reading database ... 216159 files and directories currently installed.)
Preparing to unpack ../fpp.deb ...
Unpacking pathpicker (0.5.7) ...
Setting up pathpicker (0.5.7) ...
➜  debian git:(DebianPackaging) ✗ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
➜  debian git:(DebianPackaging) ✗ fpp --help
********************************************************************************

Welcome to fpp, the Facebook PathPicker! We hope your stay
...
➜  debian git:(DebianPackaging) ✗ sudo apt-get remove pathpicker
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  pathpicker
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 214 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 216214 files and directories currently installed.)
Removing pathpicker (0.5.7) ...
➜  debian git:(DebianPackaging) ✗ fpp --help
zsh: command not found: fpp

@pallavagarwal07
Copy link
Contributor Author

@pcottle
Did you check this yet? The script only uses fakeroot, sed, and dpkg now. They should all work fine on Mac.

@pcottle
Copy link
Contributor

pcottle commented May 20, 2015

Thanks @tpalsulich for the check. I'm trying this out right now and I think a few things are broken if there's a space in the name:

[pcottle:~/Dropbox (Facebook)/wip/PathPicker/debian:]$ ./package.sh 
/usr/bin/python: can't find '__main__' module in '/Users/pcottle/Dropbox'
mkdir: /Users/pcottle/Dropbox: File exists

Which is yet again a reason why Dropbox shouldn't have introduced spaces in their enterprise product 😠 😡 but I digress...

let me try to patch in some quotes and fix this up

@tbpalsulich
Copy link

I'm mobile right now. But, from what I remember, you'll need some quotes around {}.

@pcottle
Copy link
Contributor

pcottle commented May 20, 2015

[pcottle:~/Dropbox (Facebook)/wip/PathPicker/debian:]$ ln --symbolic
ln: illegal option -- -

My ln doesnt have the --symbolic option, only -s so ill change this too

@pcottle
Copy link
Contributor

pcottle commented May 20, 2015

There we go, finally got it to work and made the script much more idempotent:

[pcottle:~/Dropbox (Facebook)/wip/PathPicker/debian:]$ ./package.sh 
Building fpp version 0.5.7 at Wed, 20 May 2015 09:05:14 -0700
====================
Control file is:
====================
Package: pathpicker
Version: 0.5.7
Architecture: all
Maintainer: Peter Cottle <[email protected]>
Installed-Size: 209
Section: misc
Priority: optional
Description: Bash Output File Picker
 PathPicker parses piped input for files and presents it in a convenient UI.
====================
Creating symlink...
====================
Changelog is:
====================
pathpicker (0.5.7) UNRELEASED; urgency=low

  * Release version 0.5.7.

 -- Peter Cottle <[email protected]>  Wed, 20 May 2015 09:04:29 -0700
====================
Gziping...
/Users/pcottle/Dropbox (Facebook)/wip/PathPicker/debian/usr/share/doc/pathpicker/changelog.gz already exists -- do you wish to overwrite (y or n)? y
Setting permissions...
find: -exec: no terminating ";" or "+"
Building package...
dpkg-deb: building package `pathpicker' in `../fpp.deb'.
usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group] file ...
       chown [-fhv] [-R [-H | -L | -P]] :group file ...
Done! Check out ../fpp.deb

@pallavagarwal07 something to consider also is that since usr/share/doc/pathpicker/changelog is tracked by version control, you cant just delete it since then we will have local changes to the directory. so ill add some stuff to fix that

pcottle added a commit that referenced this pull request May 20, 2015
Created a script for automatic creation of .deb packages from source Resolve #43
@pcottle pcottle merged commit 86dc34d into facebook:master May 20, 2015
@pcottle
Copy link
Contributor

pcottle commented May 20, 2015

Ahhh now its so clean 😍

[pcottle:~/Dropbox (Facebook)/wip/PathPicker/debian:master]$ ./package.sh 
Building fpp version 0.5.7 at Wed, 20 May 2015 09:11:12 -0700
====================
Control file is:
====================
Package: pathpicker
Version: 0.5.7
Architecture: all
Maintainer: Peter Cottle <[email protected]>
Installed-Size: 209
Section: misc
Priority: optional
Description: Bash Output File Picker
 PathPicker parses piped input for files and presents it in a convenient UI.
====================
Creating symlink...
====================
Changelog is:
====================
pathpicker (0.5.7) UNRELEASED; urgency=low

  * Release version 0.5.7.

 -- Peter Cottle <[email protected]>  Wed, 20 May 2015 09:11:12 -0700
====================
Gziping...
Setting permissions...
Building package...
dpkg-deb: building package `pathpicker' in `../fpp.deb'.
usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group] file ...
       chown [-fhv] [-R [-H | -L | -P]] :group file ...
Restoring template files...
/Users/pcottle/Dropbox (Facebook)/wip/PathPicker/debian/usr/bin
Done! Check out fpp.deb
[pcottle:~/Dropbox (Facebook)/wip/PathPicker/debian:master]$ gs
## master...origin/master

One thing is that logspew from the packager:

dpkg-deb: building package `pathpicker' in `../fpp.deb'.
usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group] file ...
       chown [-fhv] [-R [-H | -L | -P]] :group file ...

thats ok right?

pcottle added a commit that referenced this pull request May 20, 2015
@pallavagarwal07
Copy link
Contributor Author

Thanks, I'll keep that in mind. Should I do the rpm packages next?

@pcottle
Copy link
Contributor

pcottle commented May 20, 2015

Thanks a bunch @pallavagarwal07 I definitely couldn't have done this on my own. Now that we have debian packages, I assume just including them with the next release so they can be downloaded is sufficient right? Is there any easy command we should list in the README for installation?

@pallavagarwal07
Copy link
Contributor Author

Seems fine, although I would be more relieved if I tested the deb built on your system by installing it on mine

@pallavagarwal07
Copy link
Contributor Author

Installation usually is done by double clicking. On worst cases it can be installed by dpkg -i command. Although I haven't met a debian system where double clicking the downloaded file didn't work

pcottle added a commit that referenced this pull request May 20, 2015
@pcottle
Copy link
Contributor

pcottle commented May 20, 2015

@pallavagarwal07
Copy link
Contributor Author

Seems to install and work fine 😄 But Lintian is giving some errors. Lintian checks for .deb packages for best practices. The deb produced on my system isn't giving any 😦

@pallavagarwal07
Copy link
Contributor Author

Anyway, those are only warnings. Shouldn't cause any trouble.

@pcottle
Copy link
Contributor

pcottle commented May 20, 2015

Alright great! I'll be sure to include the debian package in the next release and update the README with the link

@pcottle
Copy link
Contributor

pcottle commented May 20, 2015

Oh wait you can edit releases, let me put this up now...

pcottle added a commit that referenced this pull request May 20, 2015
@pallavagarwal07
Copy link
Contributor Author

Awesome!
Let me know if I should write a man page for this. Debian packages are usually expected to have one.

@pcottle
Copy link
Contributor

pcottle commented May 20, 2015

Alright readme updated!
https://github.com/facebook/PathPicker#linux

@pcottle
Copy link
Contributor

pcottle commented May 20, 2015

If you feel particularly compelled @pallavagarwal07 go ahead! But I'm not sure how "bad" it is to not have a manpage -- if its not a huge deal then maybe its not worth your time. However if its a huge debian "faux pa" then maybe we should

@pallavagarwal07
Copy link
Contributor Author

Please break up the Linux section into parts. AUR is for Arch ONLY.
.deb package is only for debian systems.
.rpm, which should be the next ToDo, would be for RedHat Linux derivatives

@pcottle
Copy link
Contributor

pcottle commented May 20, 2015

@pallavagarwal07 mind sending a PR for the README? you know what you're talking about haha

@pallavagarwal07
Copy link
Contributor Author

Will do.

@pcottle pcottle mentioned this pull request Jun 12, 2015
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.

4 participants