Difference between revisions of "Debian"

From Gramps
Jump to: navigation, search
m (For version 4.0 and newer)
(Build)
Line 15: Line 15:
 
  python setup.py --command-packages=stdeb.command bdist_deb
 
  python setup.py --command-packages=stdeb.command bdist_deb
  
'''For testing only''': you can get this experimental 'python-gramps' package under [http://sourceforge.net/projects/gramps/files/Unstable/ '''UNSTABLE'''] section.
+
'''For testing only''': you can get this experimental 'python-gramps' package under [http://sourceforge.net/projects/gramps/files/Unstable/ '''UNSTABLE'''] section.
 +
 
 +
'''WARNING''':
 +
* The launcher under ''/usr/bin/gramps'' is using the '''same path''' for current stable release and this testing version.
 +
* You need at least version '''3.3.2''' of python-gobject for Gramps '''4.0'''.
 +
* You cannot use greater version than '''2.28''' of python-gobject for Gramps '''3.4.x'''.
  
 
* distutils
 
* distutils

Revision as of 11:11, 25 March 2013

For version 4.0 and newer

Gramps 4 moves to setuptool/distutils installer.

Dependency

  • stdeb, which produces Debian source packages from Python packages via a new distutils command, sdist_dsc. Automatic defaults are provided for the Debian package, but many aspects of the resulting package can be customized (see the customizing section, below). An additional command, bdist_deb, creates a Debian binary package, a .deb file. The debianize command builds a debian/ directory directly alongside your setup.py.
sudo apt-get install python-stdeb

Build

  • command line (quick)
python setup.py --command-packages=stdeb.command bdist_deb

For testing only: you can get this experimental 'python-gramps' package under UNSTABLE section.

WARNING:

  • The launcher under /usr/bin/gramps is using the same path for current stable release and this testing version.
  • You need at least version 3.3.2 of python-gobject for Gramps 4.0.
  • You cannot use greater version than 2.28 of python-gobject for Gramps 3.4.x.
  • distutils
import os
import stdeb.util as util
from shutil import copy
from stdeb.command.sdist_dsc import sdist_dsc
from distutils.core import Command
__all__ = ['bdist_hdeb']
class bdist_hdeb(Command):
   description = 'distutils command to create debian harmattan binary package'
   user_options = [ ("aegis-manifest=", None, 'aegis manifest to use') ]
   boolean_options = []
   def initialize_options (self):
       self.aegis_manifest = None
   def finalize_options (self):
       pass
   def run(self):
       
       # generate .dsc source pkg
       self.run_command('sdist_dsc')
       # execute system command and read output (execute and read output of find cmd)
       dsc_tree = 'deb_dist'
       target_dir = None
       for entry in os.listdir(dsc_tree):
           fulldir = os.path.join(dsc_tree,entry)
           if os.path.isdir(fulldir):
               if target_dir is not None:
                   raise ValueError('more than one directory in deb_dist. '
                                    'Unsure which is source directory')
               else:
                   target_dir = fulldir
       if target_dir is None:
           raise ValueError('could not find debian source directory')
       
       # inject custom logic to dh_builddeb (build digsigsums before and add aegis manifest after)
       DEBNAME = self.distribution.get_name()+'_'+self.distribution.get_version()+'*_all.deb'
       rules = open(target_dir+'/debian/rules', 'a')
       rules.write('override_dh_builddeb:\n\tpython ../../digsigsums.py '+self.distribution.get_name()+\
       '\n\tdh_builddeb')
       if self.aegis_manifest is not None:
           rules.write('\n\tar q ../'+DEBNAME+' _aegis')
       
       rules.write('\n\n')
       rules.close()
       # make aegies manifest avaiable to debian/rules
       if self.aegis_manifest is not None:
           copy(self.aegis_manifest, target_dir+'/_aegis')
       
       # define system command to execute (gen .deb binary pkg)
       syscmd = ['dpkg-buildpackage','-rfakeroot','-uc','-b']
       util.process_command(syscmd,cwd=target_dir)

source: https://github.com/kelvan/gotoVienna/blob/master/bdist_hdeb.py

For version 3.4 and before

Instructions on creating the Debian .deb package for Ubuntu:

  • Ensure you have a working build environment
  • For Ubuntu 7.04 or 7.10, install these tools:
sudo apt-get install devscripts dpkg-dev fakeroot debhelper libgconf2-dev
  • For Ubuntu 8.04, install these tools:
sudo apt-get install devscripts dpkg-dev fakeroot debhelper libgconf2-dev python-xml
  • For Ubuntu 12.04 install these tools:
sudo apt-get install devscripts dpkg-dev fakeroot debhelper libgconf2-dev
  • Check out the necessary version; for example, to build the .deb file for GRAMPS version 3.4.3, you'll want to run:
mkdir ~/gramps
cd ~/gramps
svn co https://svn.code.sf.net/p/gramps/code/tags/gramps-3.4.3/
  • Confirm that sudo apt-get install devscripts dpkg-dev fakeroot debhelper libgconf2-dev, everything builds:
./autogen.sh
make
  • Create the Changelog files:
svn2cl --reparagraph --include-rev --authors=src/data/authors.xml
cd po
svn2cl --reparagraph --include-rev --authors=../src/data/authors.xml
cd ..
  • Create the .deb package:
cd debian
export DEBEMAIL='[email protected]'
export DEBFULLNAME='Stephane Charette'
cd ..
dch -v 3.4.3-3 "New upstream release, include two patches"
dpkg-buildpackage -rfakeroot
Remember to modify DEBEMAIL and DEBFULLNAME to reflect your e-mail and name.
  • Release the .deb files:
cd ..
ls *.deb
Note the gramps_3.4.3-3_all.deb file, which needs to be uploaded to ftp://upload.sourceforge.net/incoming/.
  • The details on how things are going to be packaged into deb files, what are the dependencies, the pre- and post- install and removal scripts etc are under debian/ directory. Please refer to the Debian New Maintainers' Guide for further details.