Installing applications

Article contributed by humdinger on Sun, 2013-10-13 07:33

With the recent incorporation of package management (get a nightly image to check it out) some things have changed with regard to installing applications. Mind you, it's all still in a bit of flux with bugs being found and fixed and features being refined (this article has been written for hrev46218). Also, keep in mind that I'm not that familiar with the workings of the package management myself. I'd appreciate corrections, additions and tips!

Once repositories and packages are up and HaikuDepot is more feature complete, things will get easier. But until then, this is how I understand things: There are basically three scenarios:

1. A proper new .hpkg package

Either installed automatically via HaikuDepot, e.g. WonderBrush, or downloaded off some site. When using HaikuDepot, you're all set. If downloaded somewhere else, just move the .hpkg file into ~/config/packages/ and (in case of an application) it'll appear in ~/config/apps/.

2. An "old", self-contained archive

Those come traditionally from sites like BeBits or Haikuware in form of a zipped up folder. As before, you can unzip that anywhere in /boot/home/ (besides ~/config/ which is read-only) and launch the app just like you did before package management.

3. An "old" archive that has files to spread around

This is the case where you used to unzip the archive anywhere and had to invoke an install script or copy some files to special locations. Think of screen savers, translators or similar things. Since the file system hierarchy has changed a bit and some folders became read-only, those apps don't work any more out-of-the-box. You have two choices to get them working:

3.1 The non-packaged folder

Under ~/config/non-packaged/ you can recreate the needed file hierarchy. Let's take for example the very convenient tool TextBank, that provides a history and templates of the clipboard. After unzipping it to ~/config/non-packaged/apps/ you can launch TextBank, but it doesn't yet do anything. The input_server add-ons TextBankAssistantPasteSender and TextBankAssistantSpy aren't yet in the right place in the filesystem and therefore aren't picked up by the system.

TextBank offers to install these files in its preferences, but since the changed hierarchy due to package management, that doesn't work anymore. You'll have to do that manually by creating the needed folders and copying the corresponding file:

~/config/non-packaged/add-ons/input_server/devices/TextBankAssistantPasteSender
~/config/non-packaged/add-ons/input_server/filters/TextBankAssistantSpy

The next time you boot up (or restart the input_server from Terminal with "/system/servers/input_server -q") it should work.

3.2 Making it into a proper .hpkg package

The non-packaged folder route is a bit unwieldy if you're updating your system from scratch often. Here is how you create a .hpkg of TextBank:

You create some folder "SomeFolder" and within it the subfolders "apps", "add-ons/input_server/filters/" and "add-ons/input_server/devices/".

Then unzip the TextBank archive under "apps" and move "TextBankAssistantPasteSender" and "TextBankAssistantSpy" in their corresponding folders you just created.

Now, the hardest part, you have to create the text file ".PackageInfo" in the top folder "SomeFolder". The exact syntax of that file is described in the PM wiki. Also, .hpkg files opened in Expander (check "Show contents") can be educational. It'll look something like this:

name			textbank
version			5.3.2-1
architecture		x86_gcc2
 
summary			"A tool to provide clipboard history and more"
description		"Useful text provision tool (Clipboard history/template/time & date...)"
 
packager		"Humdinger <humdlinger@gmail.com>"
vendor			"SHINTA"
 
copyrights		"SHINTA"
licenses		"MIT"
 
provides {
			textbank = 5.3.2-1
}

Note, the license is actually Creative Commons, but that doesn't exist yet under /system/data/licenses/. You could create your own of course, but that would lead us astray for this educational example. Hope SHINTA doesn't mind... :)

Finally, let's create the actual .hpkg file. Open a Terminal at "SomeFolder" and type:

package create -b textbank.hpkg

That creates an empty package with just the .PackageInfo. Continue with:

package add textbank.hpkg apps add-ons

And there we are. Put into ~/config/packages to install and TextBank will appear under ~/config/apps/



[Edit 14.10.2013: corrected path, thanks Giovanni.]

Comments

Re: Installing apps in new PM Haiku

Quote:

~/config/bin/packages

~/config/packages :-)

Re: Installing apps in new PM Haiku

Thanks. Corrected.

Regards,
Humdinger

Re: Installing apps in new PM Haiku

Excellent howto, very informative. Thanks very much!

Re: Installing apps in new PM Haiku

Just another person saying thank you for your simple and clear instructions.

Re: Installing applications

The tricky part seems to be getting your link in the Deskbar. just making SomeFolder/data/deskbar/menu/Applications and dragging a link across from SomeFolder/apps won't do it. When you install the hpkg on another computer, the deskbar link will be pointing at a nonexistent SomeFolder.

I finally managed by opening a Terminal in SomeFolder/data/deskbar/Applications and using:

ln -s ../../../../apps/textbank_x86

Re: Installing applications

There's a trick here when using Tracker: hold down SHIFT while right-click-dragging the application to data/deskbar/menu/Applicationstext/html/. Now you get the option to "Create relative link here".

There are a few places in Tracker where the SHIFT key offers interesting extended features.

But thanks for pointing that out. This is an area of potential conflict...
Regards,
Humdinger

Re: Installing applications

There i can get a complete documentation in how to build a hpkg file?

Something like:
- How to add website
- How to add mail address

Why the hpkg does not installed every time i copy it into the packages folder? Have some one of you the same prolbem?

Re: Installing applications

> There i can get a complete documentation in how to build a hpkg file?

It's in the "PM wiki" linked in the article. You can enter project URL and email addresses under "urls". I guess apps like HaikuDepot have to parse those to distinguish between URLs and email addresses... [Edit: I misread that in the wiki: It only talks about regular URLs and email-formatted URLs. Not email addresses at all...]

> Why the hpkg does not installed every time i copy it into the packages folder?

There might be a timing issue (mostly for bigger packages, I guess), if the package daemon kicks in before the complete package is there. It's recommended to have the hpkg somewhere on the boot partition and just move it into the packages folder. This is instantaneous compared to copying the file.

Regards,
Humdinger

Re: Installing applications

I am trying to create a hpkg for yavtd. When I execute the

package create -b yavtd.hpkg

I get error:

Parse error in .PackageInfo(2:36) -> expected revision number (- suffix)

The .PackageInfo file is like this:

name							yavtd
version							1.0
architecture						x86_gcc2
summary						"YAVTD stands for Yet Another Video Tube Downloader and allows downloading & streaming Videos from Youtube."
description						"This is the first version for Haiku and supports Streaming (Downloading a part of flv and playing it back with MediaPlayer) and Downloading (In the highest format thats available). While other Youtube Downloaders suffer from not functioning when Youtube updates its api YAVTD includes an autoupdate function for the underlying youtube-dl Download Script it uses. This should allow you to be always up2date."
packager						"cebif <<a href="mailto:grg.gdsr@clear.net.nz" rel="nofollow">grg.gdsr@clear.net.nz</a>>"
vendor							"Leszek Lesner (llelectronics)"
copyrights						"Leszek Lesner (llelectronics)"
licenses						"Public Domain"
provides 	{
									yavtd = 1.0
}

What am I doing wrong with the revision number in this file?
ps. The terminal output message did not show correctly after I saved this comment. I cannot get it to show correctly. It always leaves out "number" after the (-

Re: Installing applications

Hi cebif,

I think you need the "internal revision" number of your package, i.e. instead of "1.0" under "version" and "provides" it should be "1.0-1" if it's your first released revision of the package. You increase the "-1" every time you have to change the package while the app's version stayed the same. For example, if you realized that the copyright wasn't correct, or it needed another dependency after all...

Regards,
Humdinger

Re: Installing applications

Using this tutorial does not match, because my hpkg is empty? No installation.

They are any changes in hpkg last this tutorial is available?

Greetings lelldorin

BeSly - Haiku, BeOS and Zeta knowledge base: http://www.besly.de

Re: Installing applications

Hi lelldorin,

I'm not aware of any changes to PM that would matter in this case.
And it still works as described for me (I'm on hrev47029 currently):

mkdir someFolder
cd someFolder
# create the needed .PackageInfo in this folder #
mkdir apps
mkdir lib
cp -r /path/to/your/to/be/packaged/app_or_appfolder apps/
cp /path/to/your/to/some/needed/library lib/
package create -b Test.hpkg
package add Test.hpkg apps lib

You could use the "-C" parameter to avoid creating the empty package first, but I like short command lines... :)

Hope this helped to find your mistake.
Regards,
Humdinger

Re: Installing applications

Ok i get packageing the hpkg, but when i copy it into /boot/home/config/packages i get the message that the package is not installable. What is wrong? I do every step of your tutorial. Files are included the hpkg the i unpack it with expander.

- cd /testfolder
- creating folder /apps
- creating .PackageInfo

name			CrimsonFileds
version			0.5.3-1
architecture		x86_gcc2
 
summary		        "Strategie game"
description		"Battle isle like strategy game"
 
packager		"Lelldorin  <lelldorin(at)gmx.de>"   //must remove the at sign because the forum make a <a href://mail,to out of it
vendor			"Lelldorin"
 
copyrights		"Jens Gransauer"
licenses			"MIT"
 
provides {
			CrimsonFields = 0.5.3-1
}

- copy files into /apps
- creating hpkg without any problem
- add folder apps into hpkg
- display file content with expander, all included

Re: Installing applications

Hi lelldorin,

There is a typo in the package name. So if you copy and pasted your .PackageInfo, that should be it. :)
Otherwise, I can't see the mistake right now either. Maybe you can share the hpkg somewhere?

Regards,
Humdinger

Re: Installing applications

I have placed the hpkg file on beshare

Re: Installing applications

Without the typo... the same problem

Re: Installing applications

I have just created my very first .hpkg package using the guidlines above. Worked fine, many thanks.

Re: Installing applications

And now on a new "nighly" i get it build too. But i need three several nightly in some months to get it running on now the last version i insatlled :-(

Re: Installing applications

Now i am working on a HKPG Creator, today i release first alpha: http://haikuware.com/remository/view-details/development/app-installatio...

Re: Installing applications

That links comes up 404. Here's another to HPKG Creator:

Re: Installing applications

I'll very much recommend to use haikuporter for anything more complex than packaging fonts.
A RecipeCreator would be more useful IMO.

Regards,
Humdinger

Re: Installing applications

Neu version of HPKG Creator 0.8-1

For some day i release a new version of the HPKGCreator, you can download it from our website: http://software.besly.de or you can add our repository to HaikuDepot: pkgman add-repo http://software.besly.de and dowanlod and install the hpkg from there.

Greetings Lelldorin