[Sawfish] 1.8.1 Debian packages on Wheezy from git

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


Hi,

I've been working to get the Debian packaging of sawfish 1.8.1, librep
0.90.2 and rep-gtk 0.90.6 to work on Debian testing (as installed
today).  I have
had to make some patches which are attached.

 - librep's debian/control file needs some depends inequalities fixed.

 - sawfish's debian/postinst and rules files were not finding some
..jl/.jlc files correctly

I haven't done extensive
testing but the resulting sawfish does work when I run it in Xephyr.

I've also made a Fabric script to help me with the building (also
attached).  It is intended to work as new releases are made in the future
but I have not yet tested that.

If you want to use it follow these steps:

 0) Install fabric

 1) Go to some clean work area

 2) Copy the patches (keep their names unchanged) and the fabfile.py

 3) Run "fab dependencies" to do one-time installation of some needed
 packages.

 4) Run "fab build_latest" to build and install the latest librep, rep-gtk and
 sawfish packages.

This will git-clone, apply the patches, build and install.  It guesses
that the latest tags for each project go together.  If that is the
wrong thing to do in the future then one will need to do anything
requiring a version string to be done one step at a time.  See the
finer grained functions with "fab -l".

 Optional: "fab xephyr_test" to test sawfish in the nested Xephyr
 xserver.


Maybe something here is useful to people.

-Brett.
diff --git a/debian/control b/debian/control
index 1eabec3..65b3389 100644
--- a/debian/control
+++ b/debian/control
@@ -51,7 +51,7 @@ Description: embeded lisp command interpreter library
 Package: librep-dev
 Section: libdevel
 Architecture: any
-Depends: rep, librep16 (>> ${source:Version}), ${shlibs:Depends}
+Depends: rep, librep16 (>= ${source:Version}), ${shlibs:Depends}
 Recommends: rep-doc
 Description: development libraries and headers for librep
  rep is a dialect of Lisp, designed to be used both as an extension
@@ -70,7 +70,7 @@ Package: librep-dbg
 Section: debug
 Priority: extra
 Architecture: any
-Depends: librep16 (>> ${source:Version}), ${shlibs:Depends}
+Depends: librep16 (>= ${source:Version}), ${shlibs:Depends}
 Recommends: rep (>> ${source:Version})
 Suggests: librep-dev, libncurses5-dbg, libreadline6-dbg | libreadline5-dbg, rep-doc
 Description: debug symbols for librep
@@ -83,7 +83,7 @@ Description: debug symbols for librep
 Package: rep-doc
 Section: doc
 Architecture: all
-Depends: info | info-browser, librep16 (>> ${source:Version}),
+Depends: info | info-browser, librep16 (>= ${source:Version}),
          dpkg (>> 1.15.4) | install-info
 Description: documentation for the lisp command interpreter
  rep is a dialect of Lisp, designed to be used both as an extension
diff --git a/debian/postinst b/debian/postinst
index bb3bc2e..dc0f139 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -3,7 +3,9 @@
 if [ "$1" = "configure" ]; then
 
 # Touch all jlc files
-  find /usr/share/sawfish/*/lisp -name *.jlc | xargs touch
+    if [ "0" != "$(find /usr/share/sawfish/*/lisp -name '*.jlc'|wc -l)" ] ; then
+	find /usr/share/sawfish/*/lisp -name '*.jlc' | xargs touch
+    fi
 
 # Because dh_installwm don't install a slave manpage
   update-alternatives --install /usr/bin/x-window-manager \
diff --git a/debian/rules b/debian/rules
index 26ecbed..31e330d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,13 +17,12 @@ export LC_ALL LINGUAS LANG
 
 DEB_CONFIGURE_USER_FLAGS = --with-readline
 
-lisp_source_extras = debian/tmp/usr/share/sawfish/*/lisp -name "*.jl" \
-	\! -name "*autoload*" \! -name "*custom-defaults*"
+lisp_source_extras = debian/tmp/usr/share/sawfish/lisp -name "*.jl" 
 
-data_extras = debian/tmp/usr/share/sawfish/*/lisp -name "*.jlc" \! -name "*main*"
+data_extras = debian/tmp/usr/share/sawfish/lisp -name "*.jlc" \! -name "*main*"
 
-data_extradirs = debian/tmp/usr/share/sawfish/$(version)/sounds \
-	debian/tmp/usr/share/sawfish/$(version)/themes \
+data_extradirs = debian/tmp/usr/share/sawfish/sounds \
+	debian/tmp/usr/share/sawfish/themes \
 	debian/tmp/usr/share/xsessions \
 	debian/tmp/usr/include
 
#!/usr/bin/env python

from fabric.api import local, abort, warn, env
from fabric.context_managers import lcd,cd
from fabric.operations import sudo as fabric_sudo
from fabric.contrib.files import exists
from glob import glob
import os, re

# On Debian Wheezy /bin/sh is dash which does not honor the "#!
# /bin/bash" in the "libtool" script.  So, tell the build systems to
# use /bin/bash instead of /bin/sh
os.environ['CONFIG_SHELL'] = '/bin/bash'

env.hosts = ['localhost']
all_projects = [ 'librep','rep-gtk','sawfish' ]

def sudo(cmd):
    '''Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=639391'''
    username = os.environ['USER']
    refcount_file = '/dev/shm/ecryptfs-%s-Private' % username
    if os.path.exists(refcount_file):
        fp = open(refcount_file,'r')
        count = int(fp.readlines()[0].strip())
        fp.close()
        count += 1
        fp = open(refcount_file,'w')
        fp.write('%d\n'%count)
        fp.close()
        print ('Incremented ecryptfs ref count to %d to protect against Debian bug 639391.' % count)
    return fabric_sudo(cmd)
    

def list(): 
    'List what projects are supported'
    print ' '.join(all_projects)
def dependencies():
    'Install some of the dependencies needed'
    deps = ['dh-autoreconf', 
            'gettext',
            'autoconf',
            'libltdl-dev',
            'automake',
            'libtool',
            'autotools-dev',
            'gcc',
            'libreadline-dev',
            'readline-common',
            'libffi-dev',
            'libgdbm-dev',
            'libgmp-dev',
            'libgtk2.0-dev',
            'libpango1.0-0',
            'libgnutls-dev',
            'quilt',
            ]
    sudo('apt-get -y install %s' % ' '.join(deps))
    return

def rebase():
    'Update the git repositories'
    for proj in all_projects:
        local('cd %s && git fetch'%proj)

def version_exist(project,version):
    'Determine if project has given version, return the tag'
    tag = version
    if project == 'sawfish' and 'sawfish' not in version:
        tag = 'sawfish-%s' % version
    with lcd(project):
        tags = local('git tag',True)
        tags = tags.split('\n')
        if tag in tags: 
            return tag
 
    abort( 'Project "%s" has not such tag "%s"' % (project,tag))
        
def latest(project):
    'Find the latest version for a project'
    pattern = '^\d+\.\d+\.\d+$'
    if project == 'sawfish':
        pattern = '^sawfish-\d+\.\d+\.\d+$'
    highest = None
    with lcd(project):
        for tag in local('git tag',True).split('\n'):
            m = re.search(pattern,tag)
            if m is None: 
                continue
            highest = tag
            continue
        pass
    if highest and project == 'sawfish':
        highest = highest[len('sawfish-'):]
    print ('The latest version of "%s" is "%s"' % (project,highest))

    return highest

def diff(project):
    'Make a diff'
    with lcd(project):
        patch = local('git diff',True)
        print (patch)
        pass
    return

def checkout(project,version):
    'usage: checkout project version'
    tag = version_exist(project,version)

    with lcd(project):
        branches = local('git branch -a',True)
        if tag in branches.split():
            if '* %s'%tag in branches.split('\n'):
                print('Branch "%s" already exists and is checked out' % tag)
                return
            local('git checkout %s' % tag)
            return
        local('git checkout -b %s %s' % (tag,tag))
        return

def build_stepwise(project):
    'Build the Debian packages for the given project'
    with lcd(project):
        local('fakeroot ./debian/rules build-indep')
        local('fakeroot ./debian/rules build-arch')
        local('fakeroot ./debian/rules binary')
    return

def build(project):
    'Build the Debian packages for the given project'
    with lcd(project):
        local('dpkg-buildpackage -rfakeroot')

def clean(project):
    'Clean the Debian packages for the given project'
    with lcd(project):
        local('fakeroot ./debian/rules clean')
    return

def install(project,version):
    'Install packages for project of given version'
    packages = {
        'librep':
            ['librep[0-9]*_%(version)s-1nano_i386.deb',
             'librep-dev_%(version)s-1nano_i386.deb',
             'rep_%(version)s-1nano_i386.deb',
             'rep-doc_%(version)s-1nano_all.deb',],
        'rep-gtk':
            ['rep-gtk_%(version)s-1nano_i386.deb',],
        'sawfish':
            ['sawfish-data_%(version)s-1nano_all.deb',
             'sawfish_%(version)s-1nano_i386.deb',
             'sawfish-lisp-source_%(version)s-1nano_all.deb']
        }

    pkgs = [glob(pkg%{'version':version})[0] for pkg in packages[project]]

    with cd(os.environ['PWD']):
        for pkg in pkgs:
            assert exists(pkg), 'Package file "%s" does not exist' % pkg
            continue
        sudo('dpkg -i %s' % ' '.join(pkgs))

    return

def uninstall(project):
    'Uninstall all packages for project'
    packages = {
        'librep':
            ['librep-dev','rep','rep-doc'],
        'rep-gtk':
            ['rep-gtk'],
        'sawfish':
            ['sawfish-data', 'sawfish', 'sawfish-lisp-source'],
        }
    sudo('apt-get -y -m remove --purge %s' % ' '.join(packages[project]))


def ucbi(project,version):
    'Uninstall, Clean, Build and Install version of project'
    uninstall(project)
    clean(project)
    build(project)
    install(project,version)

def clone(project):
    'git clone a project'
    if os.path.exists(os.path.join(project,'.git')):
        print ('Project "%s" already cloned.' % project)
        return
    urls = {
        'librep': 'git://git.tuxfamily.org/gitroot/librep/main.git',
        'rep-gtk': 'git://git.tuxfamily.org/gitroot/librep/gtk.git',
        'sawfish': 'git://git.tuxfamily.org/gitroot/sawfish/main.git',
        }
    local('git clone %s %s' % (urls[project],project))
    return

def patch(project):
    'Apply local patch if there is one'
    if not os.path.exists('%s.patch'%project):
        print ('No patch file for project "%s"' % project)
        return
    with lcd(project):
        local('patch -N -p1 < ../%s.patch || true' % project)
        local('git commit -m "Bug fix" -a')

def build_latest():
    '''
    Build and install latest packages
    '''
    for project in all_projects:
        clone(project)

    rebase()

    pv = []
    for project in all_projects:
        pv.append((project,latest(project)))

    for project,version in pv:
        checkout(project,version)

    for project in all_projects:
        patch(project)

    for project in all_projects:
        clean(project)

    for project,version in pv:
        build(project)
        install(project,version)

    for p,v in pv:
        print ('Built "%s" version %s' % (p,v))

def xephyr_test(display='1'):
    bg = ' > /dev/null 2>&1 < /dev/null &'
    local('Xephyr -geometry 800x600 :' + display + bg)
    local('sleep 1 && sawfish --display :' + display + bg)
    local('sleep 1 && xterm -display :' + display + bg)


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/