Outils pour utilisateurs

Outils du site


tech:construire_un_paquet_debian_deb

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
tech:construire_un_paquet_debian_deb [2025/03/24 15:06] – créée - modification externe 127.0.0.1tech:construire_un_paquet_debian_deb [2026/06/16 15:33] (Version actuelle) Jean-Baptiste
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 +{{tag>Debian Deb}}
 +
 +# Construire un paquet Debian .deb
 +
 +Voir : 
 +* [Guide du nouveau responsable Debian](https://www.debian.org/doc/manuals/maint-guide/index.fr.html)
 +* [[compilation_opencv_sur_debian|Création d'un paquet Debian OpenCV]]
 +* http://blog.easter-eggs.org/index.php/post/2014/04/10/Backporter-un-package-Debian-testing-vers-Debian-stable
 +
 +
 +## Pour construire un paquet à partir des sources
 +
 +
 +
 +Voir checkinstall http://openmaniak.com/fr/checkinstall.php
 +
 +Voir [[Debian - Construction d un paquet a partir des sources - wdfs]]
 +
 +Construire un paquet Debian .deb
 +
 +    Créer un répertoire temporaire. Entrer dans ce répertoire.
 +    Télécharger la source .tar.gz d'origine et la nommer ex.: package_x.x.x.orig.tar.gz
 +    Décompresser la source d'origine dans un dossier nommé package-x.x.x. C'est dans ce dossier qu'il faut effectuer les modifications (ex. créer /debian avec dh_make)
 +    À la racine du répertoire package-x.x.x, entrer "dpkg-buildpackage -rfakeroot" pour lancer la génération du .deb
 +    Dans le répertoire temporaire (..), en plus du .deb on devrait maintenant avoir un diff.gz, en plus d'un .dsc 
 +
 +
 +Et pour générer un .src.deb:
 +
 +    Créer le .src.deb avec: ar -r package_x.x.x-x_arch.src.deb package_x.x.x-x.diff.gz package_x.x.x-x.dsc package_x.x.x.orig.tar.gz
 +    
 +## Création d'un paquet Debian - Exemple avec NodeJS
 +
 +Voir : https://github.com/ruxkor/checkinstall/blob/master/checkinstallrc-dist
 +
 +~~~bash
 +wget https://nodejs.org/dist/v8.9.3/node-v8.9.3.tar.gz
 +tar xvf node-v8.9.3.tar.gz
 +cd node-v8.9.3
 +
 +./configure
 +make -j $(nproc)
 +
 +cat >description-pak <<EOF
 +evented I/O for V8 javascript
 +
 +Node.js is a platform built on Chrome's JavaScript runtime for easily
 +building fast, scalable network applications. Node.js uses an
 +event-driven, non-blocking I/O model that makes it lightweight and
 +efficient, perfect for data-intensive real-time applications that run
 +across distributed devices.
 +EOF
 +
 +echo | fakeroot checkinstall --install=no \
 + --strip \
 + --nodoc \
 + --exclude '/home,/usr/local/include' \
 + --gzman \
 + --reset-uids \
 + --maintainer 'Plop \<plop@acme.fr\>' \
 + --pkglicense 'GPL' \
 + --pkgname nodejs \
 + --pkgrelease 1 \
 + --pkgversion 8.9.3 \
 + --pkggroup web \
 + --pkgsource 'https://nodejs.org/dist/v8.9.3/node-v8.9.3.tar.gz' \
 + --requires 'libc-ares2 (>= 1.8.0), libc6 (>= 2.14), libgcc1 (>= 1:4.1.1), libssl1.0.0 (>= 1.0.1), libstdc++6 (>= 4.1.1), libv8-3.14.5, zlib1g (>= 1:1.1.4)'
 +# --review-control
 +~~~
 +
 +
 +## Méthode 2
 +
 +
 +Voir :
 +* dpkg-dev: /usr/bin/dpkg-buildpackage
 +* lintian
 +* dh-make
 +* debhelper 
 +
 +~~~bash
 +apt-get install dh-make debhelper lintian
 +apt-get install dpkg-dev # dpkg-buildpackage
 +~~~
 +
 +~~~bash
 +dh_make --single --native --yes --email root@localhost
 +
 +cd  /debian/
 +dos2unix preinst postinst prerm postrm copyright control
 +
 +# Modification de la cible dh_install dans le fichier debian/rules
 +cat >> debian/rules << FIN_AJOUT_debian_rules
 +override_dh_install:
 +        dh_install --sourcedir=$X_BASEDIR/src
 +FIN_AJOUT_debian_rules
 +
 +dpkg-buildpackage -us -uc 2>&1 > /dev/null
 +
 +# Vérification par lintian
 +lintian --suppress-tags dir-or-file-in-opt,embedded-library,executable-not-elf-or-script ../${PKG_NAME}_${PKG_VERSION}_amd64.deb
 +~~~
 +
 +## Notes
 +
 +Les scripts de postinstall et autres sont dans `/var/lib/dpkg/info`
 +~~~
 +# ls -1 /var/lib/dpkg/info/atop.*
 +/var/lib/dpkg/info/atop.conffiles
 +/var/lib/dpkg/info/atop.list
 +/var/lib/dpkg/info/atop.md5sums
 +/var/lib/dpkg/info/atop.postinst
 +/var/lib/dpkg/info/atop.postrm
 +/var/lib/dpkg/info/atop.preinst
 +/var/lib/dpkg/info/atop.prerm
 +~~~
 +
 +
 +## Autres
 +
 +`/usr/share/apport/package-hooks/wsl-pro-service.py`
 +~~~python
 +`'apport package hook for wsl-pro-service
 +
 +(c) Canonical Ltd.
 +`'
 +
 +import apport.hookutils
 +
 +def add_info(report):
 +    pass
 +~~~
 +
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki