Comment 5 for bug 503554

Revision history for this message
ermo | Rune Morling (ermo) wrote :

Dustin-

I was referring to conary recipe 'cleanliness' :)

I pruned the Makefile in debian/rules to only contain this:

[ermo@mrwing byobu]$ cat Makefile
# -*- makefile -*-

# Ripped from debian/rules Makefile

PKG=byobu

update-pot:
 rm -f po/${PKG}.pot
 xgettext -f po/POTFILES.Shell -o po/${PKG}.pot -L Shell
 xgettext -f po/POTFILES.Python -o po/${PKG}.pot -L Python -j
 for po in po/*.po ; do \
  msgmerge $${po} po/${PKG}.pot -o $${po} ; \
 done

install-po: update-pot
 for po in po/*.po ; do \
  lang=$${po#po/}; lang=$${lang%.po}; \
  mkdir -p usr/share/locale/$${lang}/LC_MESSAGES/; \
  msgfmt $${po} -o usr/share/locale/$${lang}/LC_MESSAGES/${PKG}.mo ; \
 done

install: install-po
[ermo@mrwing byobu]$

This allows me to generate the translations in in a clean way in the recipe:

[ermo@mrwing byobu]$ cat byobu.recipe
# Copyright (c) 2010 Foresight Linux
# This file is distributed under the terms of the MIT License.
# A copy is available at http://www.rpath.com/permanent/mit-license.html

class Byobu(BuildPackageRecipe):
    name = 'byobu'
    version = '2.75'
    buildRequires = ['bash:runtime', 'desktop-file-utils:runtime', 'gettext:runtime',
                     'newt:python', 'python:devel', 'screen:runtime' ]
    packageSummary = "Byobu is to GNU Screen what GNOME is to Xorg."
    packageDescription = """
    Byobu is a Japanese term for decorative, multi-panel screens that serve as folding room dividers.
    As an open source project, Byobu is an elegant enhancement of the otherwise functional, plain,
    practical GNU Screen. Byobu includes an enhanced profile and configuration utilities for the GNU
    screen window manager, such as toggle-able system status notifications.

    See http://launchpad.net/byobu for project details.
    """

    def setup(r):
        r.addArchive('http://launchpad.net/%(name)s/trunk/%(version)s/+download/%(name)s_%(version)s.orig.tar.gz')
        # Add translations using a debian/rules Makefile snippet
        # -- note that this does not install byobu as such!
        r.addSource('Makefile')
        r.Copy('Makefile', '%(builddir)s')
        # Need to use the 'install' target to generate the translation succesfully
        r.MakeInstall()
        # Do the actual install.
        # Byobu appears to follow the Linux FHS, so this is the easiest way to do it
        # -- incidentally, this is also the way the .deb does it.
        r.Run('cp -arv %(builddir)s/{etc,usr} %(destdir)s')
        # Replace Ubuntu-specific /var/run/screen dir to FL's /tmp/uscreens/ dir
        r.Replace('\/var\/run\/screen', '/tmp/uscreens', '%(sysconfdir)s/%(name)s/socketdir')
        # FIXME: May need to fix more perms
        r.SetModes('%(bindir)s/%(name)s.*', 0755)
        # Avoid /usr/bin/byobu-config being tagged as :devel
        # r.ComponentSpec('runtime', '%(destdir)s/usr/bin/byobu-config') <- won't work
        r.ComponentSpec('runtime', '%(bindir)s/%(name)s-config')
        # Make sure that we include /usr/share/doc/byobu/help.txt in the :doc trove
        # - if we don't, the help text in the menu won't show when selected.
        r.ComponentSpec('doc', '%(docdir)s/%(name)s/help.txt')
[ermo@mrwing byobu]$

I hope this illustrates what I meant by "generate translations in a clean way on Foresight Linux."