Building packages - hamstar/Braincase GitHub Wiki

This page details how to build and manage packages in the repo.

The packages are stored under a directory in the root of the folder called packages (example). Under this directory should go the directories that are used for building the packages. Currently we are only building debian packages however this may change in the future.

Debain Packages

WAIT!!! We have an automatic debianizer! You can go here to get the deb generated the last time something was commit/pushed to the Github repository (newest should be on top). Read on if you'd rather get your hands dirty though :D

Some things to know

Naming conventions

The naming scheme for the folders are braincase_<version>-<revision>_<arch> where:

  • <version> - the version of braincase
  • <revision> - the revision number or branch name
  • <arch> - the architecture the package is for

Folder structure of the package directory

debian
|-- DEBIAN
|   `-- control
|   `-- preinst     # script run before installing
|   `-- postinst    # script run after installing
|   `-- prerm       # script run before removal
|   `-- postrm      # script run after removal
`-- usr
    `-- local
        `-- bin
            `-- create-braincase-user

Building the debian package

Clone the repo

First we need to clone the repository and checkout the correct branch (in this case sprint2) and init the submodules.

git clone git://github.com/hamstar/Braincase.git
git fetch origin sprint2
git checkout sprint2
git submodule init
git submodule update

Freshen the Package folder

First we need to freshen the packages folder in packages/debian. We'll need to delete everything except for DEBIAN, then copy stuff from the main folder into it.

cd Braincase/packages/debian
rm -rf usr var etc
cd ../..
cp -Rf usr var etc packages/debian

Update the control file

This is the control file for braincase_0.1-sprint1_all:

Package: braincase
Version: 0.1
Section: misc
Priority: optional
Architecture: all
Essential: no
Depends: git, openssh-server, python2.6
Installed-Size: 16
Maintainer: James Skene <[email protected]>
Homepage: https://github.com/hamstar/Braincase
Description: A personal knowledge base system for expansion of the mind in a virtual space
        Very early version of a personal knowledge base system.  Emphasis is on automatic backups to external storage to protect the knowledge inside it.

The only thing that should need changing is Installed-Size, Depends and possibly Description.

Build the package

Building is easy, just use dpkg --build debian and it will generate a debian.deb file. Just rename that to the naming standard for deb files (e.g. braincase_0.2-sprint1_all.deb).

$ cd packages/
$ dpkg-deb --build debian
dpkg-deb: building package `braincase' in `debian.deb'.

Test the package

Do a test install of the package and check that everything is working good.

dpkg -i debian.deb

Commit the package

If everything went well, then rename the package and commit it to the repository.

$ mv debian.deb braincase_0.4-sprint1_all.deb
$ git add braincase_0.4-sprint1_all.deb
$ gc -m '#221: built new package v0.4.1'
$ git tag v0.4.1
$ git push origin sprint1 --tags

The package manager should take care of the rest.

Commit

Commit the work done in the debian folder as well as the new package. This will allow us to track changes to the debian working directory over time and serve as a place from which to download packages.

See Also

⚠️ **GitHub.com Fallback** ⚠️