Setting up a software repository

What is required

  • A web server with adequate bandwidth and disk space to host a repository

  • The knowledge of how to create .hpkg files

Getting ready

The first step in accomplishing this goal should be to get haikuporter and the haikuports repository. Follow the steps described at the haikuports wiki.
This creates an environment set-up to build packages. For a new repository, you have to make some changes to haikuporter.

Since this repository is not going to be associated with the Haiku Project, do a TextSearch for "vendor" in the haikuporter directory and replace "Haiku Project" with an appropriate vendor string. You'll have to edit two files: DependencyAnalyzer.py and Package.py. This will make all .hpkg files built with haikuporter have a vendor string that matches the new repository.

Now make some packages to add to your repository, see the two articles "A gentle introduction to Haikuporter" (Part 1 and Part 2).

Or use the "package" command if the requirements for the app are simple and it can be run within a read-only file system.

Creating the repository

Thanks to KapiX for providing a script that makes creating a working repository extremely easy. Get this archive from http://haiku.kacperkasper.pl/repo.zip and then:

  • Create a new folder "my-repo".

  • Unzip the archive into "my-repo".

  • Place all of your .hpkg files in the "my-repo" directory.

  • Edit the "example.info" file to meet your needs. Here is my example.info:

    name"FatElk"
    vendor"Fat Elk Software"
    summary"Fat Elk x86_gcc2 package repository"
    priority2
    url<http://fatelk.com/repo>
    architecturex86_gcc2

    The name is what shows up in the "Depot" list in HaikuDepot.
    The vendor field needs to match the changes made to haikuporter described above.
    Leave the priority at 2.
    The url is where you will upload your repository to.
    The architecture x86_gcc2 is for the standard gcc2 hybrid

All of the .hpkg files must have a vendor field in their ".PackageInfo" file that matches the information in your "example.info" file or the repository will not be built.

Open a Terminal in the "my-repo" directory and type:

chmod +x ./build.sh
./build.sh

The "chmod" line is only needed the first time to make sure the script is executable.

If all went as planned, you now have a "repo" directory that contains all the files for your repository.

Final steps

Add an index.html page to the "repo" folder with instructions on how to add/remove the repository to/from HaikuDepot. In my case:

To add:

pkgman add-repo fatelk.com/repo

To remove:

pkgman drop-repo FatElk

It's also a nice touch to add links to other known repositories on the index.html page.

Finally, upload all the files and folders to the URL specified in your "example.info" file. In my case, I upload the "repo" folder and all its contents to http://fatelk.com.

Now, let everyone know your repository exists!