Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How do I make a deb package of a ruby script?

  1. #1
    Join Date
    Mar 2007
    Location
    Virginia
    Beans
    Hidden!
    Distro
    Ubuntu 6.10 Edgy

    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.

  2. #2
    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.

  3. #3
    Join Date
    Mar 2007
    Location
    Virginia
    Beans
    Hidden!
    Distro
    Ubuntu 6.10 Edgy

    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.

  4. #4
    Join Date
    Jul 2007
    Beans
    21
    Distro
    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 25th, 2007 at 12:58 AM.

  5. #5
    Join Date
    Jul 2007
    Beans
    21
    Distro
    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?

  6. #6
    Join Date
    Sep 2006
    Location
    Oklahoma
    Beans
    Hidden!

    Re: How do I make a deb package of a ruby script?

    Thanks for the tutorial WW.

  7. #7
    Join Date
    Feb 2005
    Beans
    84

    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.

  8. #8
    Join Date
    Feb 2005
    Beans
    84

    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?

  9. #9
    Join Date
    Jul 2006
    Location
    Tempe, AZ, USA
    Beans
    45
    Distro
    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

  10. #10
    Join Date
    Feb 2005
    Beans
    84

    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 \#*\#

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •