Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Development & Programming > Packaging and Compiling Programs
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Packaging and Compiling Programs
Need help compiling programs or creating .deb packages?

 
Thread Tools Display Modes
Old April 10th, 2007   #1
ceeg
Just Give Me the Beans!
 
ceeg's Avatar
 
Join Date: Mar 2007
Location: Virginia
My beans are hidden!
Ubuntu 6.10 Edgy
Send a message via AIM to ceeg
How do I make a deb package of a ruby script?

I finished a ruby program recently, and I'd like to make a package out of it so a friend of mine can simply apt-get install myprogram from my repository.

Anyone know how I can do this?
__________________
aum.
ceeg is offline   Reply With Quote
Old April 11th, 2007   #2
WW
Fresh Brewed Ubuntu
 
Join Date: Oct 2004
Beans: 1,532
Re: How do I make a deb package of a ruby script?

Here is one way to create a .deb file, using the program epm. First, install epm with the command
Code:
$ sudo apt-get install epm
As an example, I will create a package for a very simple python program called helloworld.py:
Code:
#!/usr/bin/env python

#
# helloworld.py
#

print 'Hello, World!'
In the directory that contains helloworld.py, create a file called helloworld.list that looks like this:
Code:
%product Hello World
%copyright 2007 by Yours Truly
%vendor Yours Truly
%description This program prints "Hello, World!"
%version 0.1
%readme README
%license LICENSE
%requires python

f 755 root sys /usr/bin/helloworld.py helloworld.py
Then, in the same directory, create the files README and LICENSE. At a minimum, do this:
Code:
$ touch README
$ touch LICENSE
(Of course, you should really put useful information in those files.)

Finally, we use epm to create the package:
Code:
$ epm -f deb helloworld
You might see this warning:
Code:
epm: Warning - file permissions and ownership may not be correct
     in Debian packages unless you run EPM as root!
but the package will work fine (well, it has for me so far).

The package will be created in a subdirectoy; the name of the subdirectory and the package depend on the architecture of your computer. On an Intel computer (running the 2.6 kernel), the directory is linux-2.6-intel, and the package is helloworld-0.1-linux-2.6-intel.deb.

If you don't want to include "linux-2.6-intel" in the filename of the package, you can use the -n option:
Code:
epm -n -f deb helloworld
This will create a package called helloworld-0.1.deb. (It will still be in the directory linux-2.6-intel.)

You can find out more about epm here: http://www.easysw.com/epm/

I don't know anything about setting up a repository, so I can't help you with that.
WW is offline   Reply With Quote
Old April 11th, 2007   #3
ceeg
Just Give Me the Beans!
 
ceeg's Avatar
 
Join Date: Mar 2007
Location: Virginia
My beans are hidden!
Ubuntu 6.10 Edgy
Send a message via AIM to ceeg
Re: How do I make a deb package of a ruby script?

Well that's certainly a lot easier than the way I ended figuring it out
Thanks a bunch.
__________________
aum.
ceeg is offline   Reply With Quote
Old July 24th, 2007   #4
scicode
5 Cups of Ubuntu
 
scicode's Avatar
 
Join Date: Jul 2007
Beans: 15
Ubuntu 7.04 Feisty Fawn
Re: How do I make a deb package of a ruby script?

hi, thanks for the tutoria WW

after watching this wonderful tutorial on how to make deb packages for ubuntu I decided to try epm first.

Last edited by scicode; July 24th, 2007 at 07:58 PM..
scicode is offline   Reply With Quote
Old August 6th, 2007   #5
scicode
5 Cups of Ubuntu
 
scicode's Avatar
 
Join Date: Jul 2007
Beans: 15
Ubuntu 7.04 Feisty Fawn
Re: How do I make a deb package of a ruby script?

ok i was very sucessfull in making a nice .deb package of my program ... however epm is missing sections for ubuntu (science, games ...) which is not that bad, but I also discovered on more thing:

if I install python files and execute them .pyc files will be created, these are not removed when I remove the package with synaptic (a warning is issued while removing that some files are left behing). My solution for now is to also include the .pyc files in the installation. Is that correct? I also wonder what happens when I install my main program files into /usr/bin and they do not have an .py extension, will the pyc files still be created and how do I treat these files?
scicode is offline   Reply With Quote
Old August 7th, 2007   #6
Frak
The emu says rawr.
 
Frak's Avatar
 
Join Date: Sep 2006
Location: Oklahoma
Beans: 3,539
Re: How do I make a deb package of a ruby script?

Thanks for the tutorial WW.
__________________
Quote:
FOSS advocates who celebrate Google as an open source company are deluding themselves. In reality Google is a proprietary company that funds open source projects on the side with pocket change.
Frak is offline   Reply With Quote
Old August 28th, 2007   #7
charlie763
A Carafe of Ubuntu
 
charlie763's Avatar
 
Join Date: Feb 2005
Beans: 85
Re: How do I make a deb package of a ruby script?

Quote:
Originally Posted by WW View Post
I don't know anything about setting up a repository, so I can't help you with that.
Here is an article about a service on Launchpad. From the article:
Developers upload packages to a PPA and have it built for multiple architectures against the current version of Ubuntu. Each user gets up to 1GB of Personal Package Archive space, which works as a standard Ubuntu software package repository. Free PPAs are available only for free ("libre") software packages.
So you don't need to set up your own repository, Launchpad will take care of that for you. This feature is currently available.
charlie763 is offline   Reply With Quote
Old August 29th, 2007   #8
charlie763
A Carafe of Ubuntu
 
charlie763's Avatar
 
Join Date: Feb 2005
Beans: 85
Re: How do I make a deb package of a ruby script?

Quote:
Originally Posted by scicode View Post
ok i was very sucessfull in making a nice .deb package of my program ... however epm is missing sections for ubuntu (science, games ...) which is not that bad, but I also discovered on more thing:

if I install python files and execute them .pyc files will be created, these are not removed when I remove the package with synaptic (a warning is issued while removing that some files are left behing). My solution for now is to also include the .pyc files in the installation. Is that correct? I also wonder what happens when I install my main program files into /usr/bin and they do not have an .py extension, will the pyc files still be created and how do I treat these files?
I have the same problem with the pyc files. Anyone have a more elegant solution?
charlie763 is offline   Reply With Quote
Old September 5th, 2007   #9
code-breaker
Just Give Me the Beans!
 
code-breaker's Avatar
 
Join Date: Jul 2006
Location: Tempe, AZ, USA
Beans: 45
Kubuntu 7.10 Gutsy Gibbon
Re: How do I make a deb package of a ruby script?

Maybe you can use a prerm shell script to remove the pyc files:

http://www.debian.org/doc/FAQ/ch-pkg...s-maintscripts
code-breaker is offline   Reply With Quote
Old September 5th, 2007   #10
charlie763
A Carafe of Ubuntu
 
charlie763's Avatar
 
Join Date: Feb 2005
Beans: 85
Re: How do I make a deb package of a ruby script?

I think that's exactly what I'll do when I finally get around to making a nice source package that adheres to .deb standards. For now I have it set up such that the .py files are compiled into .pyc files. The .pyc files are installed instead of the .py files. This solves the derelict-file problem and has the added benefit of being a bit faster the first time it's run. The only problem is that it needs to be compiled for each architecture. Here is my Makefile.
Code:
gladex : package

package : gladex-0.3.4.deb

gladex-0.3.4.deb : gladex.list # And a bunch of other stuff.
	python -mcompileall .
	sudo epm -n -f deb gladex

install :
	sudo dpkg --install linux-2.6-*/gladex-0.3.4.deb

clean :
	rm -rfv linux-2.6-* *~ *.pyc \#*\#
charlie763 is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:40 PM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry