Custom-packages

From LocalizationWiki

Building Custom Debian Packages

The following steps outline the process for creating custom debian packages (Ex. with our translations for our local repositories)

 1. Get the package source by : apt-get source <pkg-name>. (This downloads the package source, extracts it and also applies
    the diff file).
 2. Apply our custom changes. For adding our translation for a package that doesnt have our translation officially, we now add
    our po file in the po directory. Also have to edit the configure.in and configure file in the source directory to add our
    language code to ALL_LINGUAS.
 3. Once all our custom additions are done, do dch -i to change the package version. (this changes the package version in the 
    debian/changlog file). For local repository, we might need to devise our own versioning scheme.
 4. Now do debuild to start building the packages.While doing debuild, if it complains of dependency problems, do 
    apt-get build-dep <pkg-name> to download and install the dependent packages.
 5. Once the build is successful, the deb, diff, and dsc files with new version will be created.
    For more information see http://www.debian.org/doc/maint-guide/
    
    Note: The packages devscripts and fakeroot needs to be installed for the commands like dch -i and debuild to work.

Problems while building custom packages

Sometimes, just adding our translation into the po directory and chaging the configure configure.in file doesnt work. We need to add our changes as a patch file in the debian/patches directory within the source directory.

 1. Get the source for the package as explained above. lets assume the source directory to be pkg-folder
 2. Copy the newly created pkg-folder to some new name: cp -r pkg-folder pkg-folder.New
 3. cd pkg-folder.New
 4. Apply our changes manually here (in pkg-folder.New) like adding the translation in the po directory and editing the configure 
    and configure.in files.
 5. cd ../
 6. Create a diff between the pkg-folder and pkg-folder.New :  diff -uNr pkg-folder pkg-folder.New > some.patch 
 7. Copy the patch created above into the debian/patches/ directory inside pkg-folder: 
    cp some-patch pkg-folder/debian/package/ 
 8. Rename our patch such that it will be the last one to be applied when we do debuild. For this we can name our patch 
    something like "99_Dzongkha_translation.patch". Look for the filenames of other patch file in the patches directory to see
    what names can be given. They are normally named beginning with something like "04" or "05". So naming our patch beginning
    with "99" makes it to be applied the last.
 9. Now do a debuiild to build the package.