Creating a Ruby DotPet in Puppy 2.14+

March 17, 2007 at 3:05 pm Leave a comment

Puppy Linux 2.14 introduce a new package manager call dotpet, which replaces dotpup. Creating dotpet is mostly automated and is much easier than manually creating a dotpup. This article talks about creating a dotpet on Ruby. The instruction should also work with later version of Puppy.

Ruby is a interpreted programming language designed for programmers. We will do the following:

  1. Backup your pup_save.2fs file.
  2. Download the source code.
  3. Configure and compile the source code.
  4. Create a DotPet Package.
  5. Testing the package.
  6. Sharing your DotPet with others.

Backing up your pup_save.2fs file

The first thing you should do is to backup your pup_save.2fs file. The pup_save.2fs is a storage file that contains all of the changes you made. You need to back up this file because if you screw up, you can restore your changes. Many programs have a make install, but programs with make uninstall are as common as chicken tooth.

To backup the pup_save.2fs file, just make a copy of it and store it somewhere such as a CD-R. Remember to do this or you’ll be sorry!

Downloading the source code

You can get the latest Ruby language release from the Ruby Site. Download the latest stable version somewhere. I usually download it to a directory under /root. Make sure that you have enough space in your pup_save.2fs file to hold the download.

Ruby has its own package management system call GEM. I tried to create a DotPet for GEM, but the new2dir script isn’t really design to record GEM installation. It only managed to record one line.

Configuring and compiling Source Code

To compile the source code, you’ll need to set up the Puppy Linux development environment. This consists of copying a devx_214.sfs file to the same directory as your pup_save.2fs file and then restarting Puppy. The dev_214.sfs file will not work unless there is a pup_save file. When you install Puppy for the first time, there will be no pup_save file, so you won’t have the development environment until you reboot.

  1. Open a console.
  2. Change directory to the Ruby package.
  3. Untar the package:
    tar -xvf ruby-1.8.6.tar.gz
  4. Change into the directory created by the package.
    cd ruby-1.8.6
  5. Run configure to set up the makefile. The i486 parameter is so that the program will be build to a 486. While most people these day probably have a 686, you should still compile to a 486 if you plan to share your DotPet with others. Puppy Linux itself is built to a 486.
    ./configure --host=i486-pc-linux-gnu
    Note that there are two dashes in front of host. In earlier edition of Puppy, we would install the application in /root/my-applications because an upgrade of Puppy may wipe out our installs. DotPet avoid this problem by allowing you to register the package with Puppy so that this doesn’t happen (at least in theory any way).
  6. Compile Ruby by running
    make CFLAGS="-march=i486 -mtune=i686"
    The CFLAG are compiler flags passed to the C compiler. The above tells the compiler to compile to a 486 so that the program will work with anything 486 and above, while the i686 flag optimizes the binary for a 686, which most computer of today are based on. This option is the best of both worlds.

Creating a DotPet Package

Creating a DotPet is pretty easy. The package script records the files installed by make install. This is a one shot deal. Once make install installs all of the files, running new2dir make install a second time won’t record the files because they are already installed. This is why you should back up your pup_save file.

Though this isn’t in the Ruby readme file, Ruby really intalls into two packages: Ruby and Ruby Doc. Ruby is the programming language. Ruby doc is the interactive documentation (the doc you get when you type ri). We’ll need to create two different packages.

Creating Ruby DotPet

The Ruby DotPet contains the actual Ruby Language minus the Ruby documentation.

  1. Run the DotPet script:
    new2dir make install
  2. Step 1: You’re prompted to enter the package directory. Press Enter for the default option
  3. Step 2: You are asked what cpu the code was built to. Press enter to default to 486.
  4. Step 3: You are asked if you wish to create one or multiple packages. The multiple packages are for cases when you want to separate the package with the shared libraries. Ruby is fairly lean on its own, so just press Enter to accept the default of one package
  5. Step 4: Press Enter to record the make install.
  6. Finished: Press Enter to exit the new2dir script.
  7. Type the command: cd ..
  8. You’ll notice a ruby-1.8.6-i486 directory and a ruby-1.8.6-i486.files. The directory contains all of the install files and .files contains a list of the files. You can then convert the directory and files to a Dotpet by the following command:
    dir2pet ruby-1.8.6-i486
  9. The instruction asks if the name is in the correct format. It is, so press Enter.
  10. Step 1: the instruction ask if there will be a menu. Ruby is launched from the command line, so you type “no” and enter.
  11. Step 2: you are asked to enter a description. Enter “Ruby programming language”.
  12. You are given a list of packages in Pup_xxx file. I am not sure why we get this list, but I assume it is so you can see what packages are already in the system so you don’t build duplicate packages. Press enter to continue.
  13. You are given a list of packages in unleashed. I assume that this is so you can check if the package you are building is already in unleashed. Press enter since Ruby is not an unleashed package.
  14. You are asked about dependency list. Ruby is fairly independant, so press enter.
  15. Step 4: You are asked if you want to register with PETget. If you register with PETget, you can use the package manager to uninstall your package. If you upgrade your Puppy, it will known not to overwrite your files (in theory). Type “yes” and press enter.
  16. Step 5: you are informed that the dotpet is created. You should see a .pet file.

Creating Ruby Doc DotPet

The Ruby Doc contains the interactive documentation to Ruby. The DotPet tools documentation indicated there is an option to generate additional packages (ie: development, doc, etc). However, it also said that the script may not be reliable. The most reliable way is to just create it independently from ruby.

  1. Because the new2dir create the preprocessed files based on the name of the base directory, you need to rename the Ruby source directory. Otherwise, we’ll overwrite the previous package. In this case, we’ll rename the source directory to “-doc”. You need to do this before the version number because Puppy uses the name before the version number as the signature. If you type in “ruby-1.8.6-doc”, it will be shorten to “ruby”. If you install both packages, the second one will overwrite the first. You should use ruby-doc-1.8.6 instead of ruby-1.8.6-doc.
    mv ruby-1.8.6 ruby-doc-1.8.6
  2. Now you can run the new2dir script on the installdoc.
    new2dir make install-doc
  3. Step 1: You’re prompted to enter the package directory. Press Enter for the default option
  4. Step 2: You are asked what cpu the code was built to. Press enter to default to 486.
  5. Step 3: You are asked if you wish to create one or multiple packages. The multiple packages are for cases when you want to separate the package with the shared libraries. Ruby is fairly lean on its own, so just press Enter to accept the default of one package
  6. Step 4: Press Enter to record the make install-doc.
  7. Finished: Press Enter to exit the new2dir script. There is some sort of bad interaction between new2dir and make install-doc that cause it to go into an infinite loop. I had thought that the process was slow, but after a few days the script was not complete and I notice that ruby-doc-1.8.6-i486.files hasn’t been updated in a while. I would basically check the .files and if nothing has been updated for a couple of hours, break from the program using CTRL-C.
  8. Type the command: cd ..
  9. You’ll notice a ruby-doc-1.8.6-i486 directory and a ruby-doc-1.8.6-i486.files. The directory contains all of the install files and .files contains a list of the files. You can then convert the directory and files to a Dotpet by the following command:
    dir2pet ruby-doc-1.8.6-i486
  10. The instruction asks if the name is in the correct format. It is, so press Enter.
  11. Step 1: the instruction ask if there will be a menu. Ruby is launched from the command line, so you type “no” and enter.
  12. Step 2: you are asked to enter a description. Enter “Ruby Documentation”.
  13. You are given a list of packages in Pup_xxx file. Just as before, press enter to continue.
  14. You are given a list of packages in unleashed. Press enter since Ruby is not an unleashed package.
  15. You are asked about dependency list. Enter “ruby” and press enter.
  16. Step 4: You are asked if you want to register with PETget. Type “yes” and press enter.
  17. Step 5: you are informed that the dotpet is created. You should see a .pet file.

Testing the DotPet package

When you create your DotPet file, you will have install the package. To test it, you can install it again, test it, and then uninstall it.

  1. In a command line window, type “irb”. You’ll get a message that the command is not available.
  2. Launch Menu->Filesystem->Rox-Filer file manager
  3. Click on the ruby dotpet file that you created.
  4. Click on the install button.
  5. Press OK when install is complete.
  6. Launch terminal and type in irb. Ruby should start. If you type ri, it will not work because documentation is still not installed. Exit terminal.
  7. Click on the Install icon on your desktop. This brings up the package manager.
  8. Click on the PetGet package manager button.
  9. Click on the Install Package button (the large one). You should see a list of packages. On the right panel should be an entry for the package you just installed.
  10. Using Rox, click and install the Ruby-doc package.
  11. Open a  terminal window and type ri.  The command ri should now work.

Sharing your DotPet with others

Follow the instructions in this link to upload the package. In general, you need to use the ftp site to upload your package and then use messaging to inform the admin where to put your package.

Keep in mind that Puppy is a community release linux (as oppose to a Enterprise linux like Red Hat). Infrastructure support is limited and on a volunteer basis. The FTP server has been semi-unreliable so I had to try a few times to upload. The admin may take a bit to get back to you because they are volunteers with a life. Be patient!

I hope that this blog has been helpful and that you will contribute your dotPet.

Advertisements

Entry filed under: linux, Puppy Linux.

Creating a Ruby DotPup in Puppy Linux 2.13 Installing Ruby on Rail in Puppy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

March 2007
M T W T F S S
« Feb   Apr »
 1234
567891011
12131415161718
19202122232425
262728293031  

Most Recent Posts


%d bloggers like this: