Difference between revisions of "Debian"

From Gramps
Jump to: navigation, search
m (Build)
(add language box)
 
(53 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= For version 4.0 and newer =
+
{{languages|Debian}}
 +
= For version 4.x and newer =
  
Gramps 4 moves to setuptool/distutils installer.
+
'''Testing .debs can be found in http://sourceforge.net/projects/gramps/files/Unstable/'''
 +
 
 +
{{man menu|Gramps 4 moved to setuptool/distutils installer.}}
  
 
==Dependency==
 
==Dependency==
Line 7: Line 10:
 
* debian stuff
 
* debian stuff
  
  sudo apt-get install devscripts dpkg-dev fakeroot debhelper libgconf2-dev
+
  sudo apt-get install devscripts dpkg-dev fakeroot debhelper dh-linktree
  
* [https://github.com/astraw/stdeb 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.
+
* [https://github.com/astraw/stdeb 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. 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
+
  sudo apt-get install python-stdeb python3-all
  
 
==Build==
 
==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 [http://sourceforge.net/projects/gramps/files/Unstable/ '''UNSTABLE'''] section.
 
  
 
*'''WARNING'''
 
*'''WARNING'''
 
** The launcher under ''/usr/bin/gramps'' is using the '''same path''' for current stable release and this testing version. '''Backup your launcher''' if you want to install both versions. Translations might be also overwritten, you have been warned...
 
** The launcher under ''/usr/bin/gramps'' is using the '''same path''' for current stable release and this testing version. '''Backup your launcher''' if you want to install both versions. Translations might be also overwritten, you have been warned...
** You need at least version '''3.3.2''' of python-gobject for Gramps '''4.0'''.
+
** You need at least version '''3.3.2''' of python-gobject for Gramps '''4.x'''.
 
** You cannot use greater version than '''2.28''' of python-gobject for Gramps '''3.4.x'''.
 
** You cannot use greater version than '''2.28''' of python-gobject for Gramps '''3.4.x'''.
  
* custom tarball
+
===via a quick command line===
 +
 
 +
python setup.py --command-packages=stdeb.command bdist_deb
 +
 
 +
* Custom tarball
  
 
  python setup.py --command-packages=stdeb.command sdist_dsc
 
  python setup.py --command-packages=stdeb.command sdist_dsc
Line 34: Line 35:
 
  python setup.py --command-packages=stdeb.command sdist_dsc --depends "python-gobject (>= 3.3.2)"
 
  python setup.py --command-packages=stdeb.command sdist_dsc --depends "python-gobject (>= 3.3.2)"
  
* distutils (''not tested yet'')
+
===via customized options===
 +
 
 +
These options are set into ''/debian'' folder.
 +
 
 +
cd debian
 +
export DEBEMAIL='...@...'
 +
export DEBFULLNAME='Your name'
 +
cd ..
 +
dch -v 4.0.0 "New upstream for Gramps 4.0.0"
 +
dpkg-buildpackage -rfakeroot
 +
 
 +
===via Distutils===
 +
 
 +
Samples :
 +
 
 +
* https://github.com/astraw/stdeb/blob/master/stdeb/command/
 +
* https://github.com/kelvan/gotoVienna/blob/master/bdist_hdeb.py
 +
 
 +
==Test==
 +
 +
$ lintian gramps_4.0.1-2_all.deb
 +
W: gramps: old-fsf-address-in-copyright-file
 +
W: gramps: extra-license-file usr/share/doc/gramps/COPYING.gz
 +
W: gramps: package-contains-upstream-install-documentation usr/share/doc/gramps/INSTALL
 +
W: gramps: extra-license-file usr/share/doc/gramps/LICENSE.gz
 +
W: gramps: menu-icon-missing usr/share/pixmaps/gramps.xpm
 +
 
 +
==webapp package==
 +
 
 +
* How to include Makefile into deb package?
 +
 
 +
setup.py:
 +
 
 +
- package_data_webapp = ['webapp/*.sql', 'webapp/grampsdb/sql/*.sql']
 +
+ package_data_webapp = ['webapp/*.sql', 'webapp/Makefile', 'webapp/grampsdb/sql/*.sql']
 +
 
 +
* Depends on python-django, python-sqlite
 +
 
 +
Control:
 +
 
 +
Package: python-gramps-webapp
 +
Architecture: all
 +
Depends:
 +
  python-django,
 +
  python-sqlite,
 +
  ${misc:Depends},
 +
  ${python:Depends}
 +
 
 +
Rules:
  
source : https://github.com/astraw/stdeb/blob/master/stdeb/command/
+
#!/usr/bin/make -f
  
Sample for creating a debian harmattan (MeeGo 1.2) binary package:
+
# Uncomment this to turn on verbose mode.
 +
export DH_VERBOSE=1
 +
export DH_OPTIONS=-v
  
  <code>import os
+
  %:
import stdeb.util as util
+
    dh $@ --with python2
from shutil import copy
 
from stdeb.command.sdist_dsc import sdist_dsc
 
  
  from distutils.core import Command
+
  # Override auto test because upstream do not use the standard unittest discover
 +
override_dh_auto_test:
  
  __all__ = ['bdist_hdeb']
+
  # Override of auto_build
 +
override_dh_auto_build:
 +
      python setup.py --server build
  
  class bdist_hdeb(Command):
+
  # Override of auto_install to remove information from package
    description = 'distutils command to create debian harmattan binary package'
+
override_dh_auto_install:
 +
        #dh_auto_install
 +
        python setup.py --server install --root=debian/python-gramps-webapp --install-layout=deb
  
    # [http://wiki.meego.com/Aegis_Policies aegis], UAC, [https://developer.gnome.org/goa/stable/ UOA], [http://developer.ubuntu.com/resources/technologies/online-accounts/ GOA], etc ...
+
# Make css style sheets and templates non-executable
    user_options = [ ("aegis-manifest=", None, 'aegis manifest to use') ]
+
override_dh_fixperms:
    boolean_options = []
+
        dh_fixperms
 +
        chmod a-x $(CURDIR)/debian/python-gramps-webapp/usr/share/gramps/css/Web_*.css
 +
        chmod a-x $(CURDIR)/debian/python-gramps-webapp/usr/share/gramps/templates/*.html
  
    def initialize_options (self):
+
# Avoid compressing COPYING file so that it can appear in the "About" dialog
         self.aegis_manifest = None
+
override_dh_compress:
 +
         #dh_compress -X COPYING
  
    def finalize_options (self):
+
* python 3
        pass
 
  
    def run(self):
+
Control:
       
 
        # generate .dsc source pkg
 
        self.run_command('sdist_dsc')
 
  
        # execute system command and read output (execute and read output of find cmd)
+
X-Python3-Version: >= 3.2
        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: # MeeGo 1.2
 
            rules.write('\n\tar q ../'+DEBNAME+' _aegis')
 
        rules.write('\n\n')
 
        rules.close()
 
  
        # make aegis manifest avaiable to debian/rules
+
Package: python3-gramps-webapp
        # MeeGo 1.2
+
Architecture: all
        if self.aegis_manifest is not None:
+
Depends:
            copy(self.aegis_manifest, target_dir+'/_aegis')
+
  python3-django,
       
+
  python3-sqlite,
        # define system command to execute (gen .deb binary pkg)
+
  ${misc:Depends},
        syscmd = ['dpkg-buildpackage','-rfakeroot','-uc','-b']
+
  ${python3:Depends}
  
        util.process_command(syscmd,cwd=target_dir)</code>
+
Rules:
  
source: https://github.com/kelvan/gotoVienna/blob/master/bdist_hdeb.py
+
#!/usr/bin/make -f
  
= For version 3.4 and before=
+
# Uncomment this to turn on verbose mode.
Instructions on creating the Debian <tt>.deb</tt> package for Ubuntu:
+
export DH_VERBOSE=1
 +
export DH_OPTIONS=-v
 +
 
 +
%:
 +
    dh $@ --with python3
 +
 
 +
# Override auto test because upstream do not use the standard unittest discover
 +
override_dh_auto_test:
 +
 
 +
# Override of auto_build
 +
override_dh_auto_build:
 +
      python3 setup.py --server build
 +
 
 +
# Override of auto_install to remove information from package
 +
override_dh_auto_install:
 +
        #dh_auto_install
 +
        python3 setup.py --server install --root=debian/python3-gramps-webapp --install-layout=deb
 +
 
 +
# Make css style sheets and templates non-executable
 +
override_dh_fixperms:
 +
        dh_fixperms
 +
        chmod a-x $(CURDIR)/debian/python3-gramps-webapp/usr/share/gramps/css/Web_*.css
 +
        chmod a-x $(CURDIR)/debian/python3-gramps-webapp/usr/share/gramps/templates/*.html
 +
 
 +
# Avoid compressing COPYING file so that it can appear in the "About" dialog
 +
override_dh_compress:
 +
        #dh_compress -X COPYING
 +
 
 +
==qml package==
 +
 
 +
*Depends on  python-pyside, gramps
 +
 
 +
= Instructions on creating the Debian package for Ubuntu =
 +
 
 +
* Check out the necessary version; for example, to build the <tt>.deb</tt> file for GRAMPS {{version}}, you'll want to run:
 +
git clone http://git.code.sf.net/p/gramps/source Gramps
 +
git checkout v{{version}} -b {{version}}
  
* 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 <tt>.deb</tt> 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:
 
* 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 <tt>.deb</tt> 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 '''<tt>DEBEMAIL</tt>''' and '''<tt>DEBFULLNAME</tt>''' to reflect your e-mail and name.
 
  
* Release the <tt>.deb</tt> files:
+
git log v{{version}}.. --pretty --numstat --summary --no-merges | git2cl > ChangeLog
cd ..
+
git log v{{version}}.. --pretty --numstat --summary --no-merges -- po/*.po | git2cl > po/ChangeLog
ls *.deb
+
 
: Note the '''<tt>gramps_3.4.3-3_all.deb</tt>''' file, which needs to be uploaded to <tt>ftp://upload.sourceforge.net/incoming/</tt>.
+
Using the <tt>Changelog</tt> files generated with <tt>git2cl</tt>,
 +
 
 +
Modify <tt>MANIFEST.in</tt>
 +
+ include ChangeLog
 +
+ include po/ChangeLog
  
 
* 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 <tt>debian/</tt> directory. Please refer to the [http://www.debian.org/doc/maint-guide/ Debian New Maintainers' Guide] for further details.
 
* 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 <tt>debian/</tt> directory. Please refer to the [http://www.debian.org/doc/maint-guide/ Debian New Maintainers' Guide] for further details.
  
 
[[Category:Developers/Packaging]]
 
[[Category:Developers/Packaging]]

Latest revision as of 07:16, 27 May 2021

For version 4.x and newer

Testing .debs can be found in http://sourceforge.net/projects/gramps/files/Unstable/

Gramps 4 moved to setuptool/distutils installer.

Dependency

  • debian stuff
sudo apt-get install devscripts dpkg-dev fakeroot debhelper dh-linktree
  • 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. 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 python3-all

Build

  • WARNING
    • The launcher under /usr/bin/gramps is using the same path for current stable release and this testing version. Backup your launcher if you want to install both versions. Translations might be also overwritten, you have been warned...
    • You need at least version 3.3.2 of python-gobject for Gramps 4.x.
    • You cannot use greater version than 2.28 of python-gobject for Gramps 3.4.x.

via a quick command line

python setup.py --command-packages=stdeb.command bdist_deb
  • Custom tarball
python setup.py --command-packages=stdeb.command sdist_dsc

or

python setup.py --command-packages=stdeb.command sdist_dsc --depends "python-gobject (>= 3.3.2)"

via customized options

These options are set into /debian folder.

cd debian
export DEBEMAIL='...@...'
export DEBFULLNAME='Your name'
cd ..
dch -v 4.0.0 "New upstream for Gramps 4.0.0"
dpkg-buildpackage -rfakeroot

via Distutils

Samples :

Test

$ lintian gramps_4.0.1-2_all.deb
W: gramps: old-fsf-address-in-copyright-file
W: gramps: extra-license-file usr/share/doc/gramps/COPYING.gz
W: gramps: package-contains-upstream-install-documentation usr/share/doc/gramps/INSTALL
W: gramps: extra-license-file usr/share/doc/gramps/LICENSE.gz
W: gramps: menu-icon-missing usr/share/pixmaps/gramps.xpm

webapp package

  • How to include Makefile into deb package?

setup.py:

- package_data_webapp = ['webapp/*.sql', 'webapp/grampsdb/sql/*.sql']
+ package_data_webapp = ['webapp/*.sql', 'webapp/Makefile', 'webapp/grampsdb/sql/*.sql']
  • Depends on python-django, python-sqlite

Control:

Package: python-gramps-webapp
Architecture: all
Depends:
 python-django,
 python-sqlite,
 ${misc:Depends},
 ${python:Depends}

Rules:

#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
export DH_OPTIONS=-v
%:
    dh $@ --with python2
# Override auto test because upstream do not use the standard unittest discover
override_dh_auto_test:
# Override of auto_build
override_dh_auto_build:
      python setup.py --server build
# Override of auto_install to remove information from package
override_dh_auto_install:
       #dh_auto_install
       python setup.py --server install --root=debian/python-gramps-webapp --install-layout=deb
# Make css style sheets and templates non-executable
override_dh_fixperms:
       dh_fixperms
       chmod a-x $(CURDIR)/debian/python-gramps-webapp/usr/share/gramps/css/Web_*.css
       chmod a-x $(CURDIR)/debian/python-gramps-webapp/usr/share/gramps/templates/*.html
# Avoid compressing COPYING file so that it can appear in the "About" dialog
override_dh_compress:
       #dh_compress -X COPYING
  • python 3

Control:

X-Python3-Version: >= 3.2

Package: python3-gramps-webapp
Architecture: all
Depends:
 python3-django,
 python3-sqlite,
 ${misc:Depends},
 ${python3:Depends}

Rules:

#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
export DH_OPTIONS=-v
%:
    dh $@ --with python3
# Override auto test because upstream do not use the standard unittest discover
override_dh_auto_test:
# Override of auto_build
override_dh_auto_build:
      python3 setup.py --server build
# Override of auto_install to remove information from package
override_dh_auto_install:
       #dh_auto_install
       python3 setup.py --server install --root=debian/python3-gramps-webapp --install-layout=deb
# Make css style sheets and templates non-executable
override_dh_fixperms:
       dh_fixperms
       chmod a-x $(CURDIR)/debian/python3-gramps-webapp/usr/share/gramps/css/Web_*.css
       chmod a-x $(CURDIR)/debian/python3-gramps-webapp/usr/share/gramps/templates/*.html
# Avoid compressing COPYING file so that it can appear in the "About" dialog
override_dh_compress:
       #dh_compress -X COPYING

qml package

  • Depends on python-pyside, gramps

Instructions on creating the Debian package for Ubuntu

  • Check out the necessary version; for example, to build the .deb file for GRAMPS 5.2.1, you'll want to run:
git clone http://git.code.sf.net/p/gramps/source Gramps
git checkout v5.2.1 -b 5.2.1
  • Create the Changelog files:
git log v5.2.1.. --pretty --numstat --summary --no-merges | git2cl > ChangeLog
git log v5.2.1.. --pretty --numstat --summary --no-merges -- po/*.po | git2cl > po/ChangeLog

Using the Changelog files generated with git2cl,

Modify MANIFEST.in

+ include ChangeLog
+ include po/ChangeLog
  • 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.