From d002c90b67d7c58e3260f82e6e6daebd41e07c5b Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 15 May 2020 15:52:28 +0300 Subject: Add debian packaging talk slides --- Makefile | 7 ++- debian.dot | 57 +++++++++++++++++++ debian.md | 182 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 245 insertions(+), 1 deletion(-) create mode 100644 debian.dot create mode 100644 debian.md diff --git a/Makefile b/Makefile index 459a199..2c08234 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,14 @@ pdfs = $(mds:.md=.pdf) all: $(pdfs) -.SUFFIXES: .md .pdf +.SUFFIXES: .md .pdf .dot .svg .md.pdf: pandoc --filter sp-filter -t beamer -o $@ $< +.dot.svg: + dot -Tsvg $< > $@ + $(htmls): Makefile + +debian.pdf: debian.svg diff --git a/debian.dot b/debian.dot new file mode 100644 index 0000000..8a7e446 --- /dev/null +++ b/debian.dot @@ -0,0 +1,57 @@ +digraph "debian" { + labelloc=b; + rankdir="LR"; + + node [style=filled]; + + + subgraph cluster_srctree { + label="Source tree"; + hellodotc [label="hello.c" shape=tab fillcolor=green]; + Makefile [label="Makefile" shape=tab fillcolor=green]; + changelog [label="debian/changelog" shape=tab fillcolor=green]; + control [label="debian/control" shape=tab fillcolor=green]; + rules [label="debian/rules" shape=tab fillcolor=green]; + hello [label="hello" shape=tab style=filled fillcolor=red]; + hellodoto [label="hello.o" shape=tab style=filled fillcolor=red]; + }; + + subgraph cluster_build { + label="dpkg-buildpackage"; + build [label="debian/rules build"]; + install [label="debian/rules install"]; + binary [label="debian/rules binary"]; + tmp [label="debian/tmp/usr/bin/hello" shape=tab]; + DEBIAN [label="debian/tmp/DEBIAN" shape=tab]; + }; + + subgraph cluster_parent { + label=".. (parent directory)"; + deb [label="../hello_0.6-1_amd64.deb" shape=tab fillcolor=cyan]; + tgz [label="../hello_0.6.orig.tar.gz" shape=tab fillcolor=cyan]; + changes [label="../hello_0.6-1_amd64.changes" shape=tab fillcolor=cyan]; + diff [label="../hello_0.6-1_amd64.diff" shape=tab fillcolor=cyan]; + }; + + hellodotc -> tgz; + Makefile -> tgz; + + hellodotc -> build; + Makefile -> build; + rules -> build; + + build -> hellodoto; + build -> hello; + hello -> install; + + install -> tmp; + install -> DEBIAN; + changelog -> install; + control -> install; + rules -> install; + tmp -> binary; + DEBIAN -> binary; + binary -> deb; + binary -> changes; + binary -> diff; +} diff --git a/debian.md b/debian.md new file mode 100644 index 0000000..2727479 --- /dev/null +++ b/debian.md @@ -0,0 +1,182 @@ +# Introduction + +* Why? +* How? + +----------------------------------------------------------------------------- + +# Why? + +* install repeatedly (test environments) +* install on many hosts (scap) +* others need to install + +----------------------------------------------------------------------------- + +# Overview + +![](debian.svg) + + +----------------------------------------------------------------------------- + +# In commands + +~~~sh +$ git archive HEAD | gzip > ../heippa_0.6.orig.tar.gz +$ dpkg-buildpackage -us -uc +$ lintian +$ ls -l .. +heippa +heippa_0.6-1_amd64.buildinfo +heippa_0.6-1_amd64.changes +heippa_0.6-1_amd64.deb +heippa_0.6-1.debian.tar.xz +heippa_0.6-1.dsc +heippa_0.6.orig.tar.gz +heippa-dbgsym_0.6-1_amd64.deb +$ +~~~ + +----------------------------------------------------------------------------- + +# `debian/changelog` + +~~~{.text .numberLines} +heippa (0.6-1) unstable; urgency=medium + + * Trigger release build + + -- Lars W Tue, 17 Jul 2018 23:11:24 +0300 +~~~ + +Use the `dch` command to add a new entry. Formatting MUST be followed +strictly. + +----------------------------------------------------------------------------- + +# `debian/control` + +~~~{.text .numberLines} +Source: heippa +Maintainer: Lars Wirzenius +Section: misc +Priority: optional +Standards-Version: 3.9.2 +Build-Depends: debhelper (>= 7.3.8) + +Package: heippa +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: short desc + Long desc. +~~~ + + +----------------------------------------------------------------------------- + +# `debian/rules` + +~~~{.makefile .numberLines} +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_auto_install: + dh_install +~~~ + +----------------------------------------------------------------------------- + +# `debian/install` + +~~~{.text .numberLines} +heippa usr/bin +~~~ + +----------------------------------------------------------------------------- + +# Hands on! + +* `http://git.liw.fi/heippa/` + +* Debian with the following installed: + - build-essential + - lintian + - fakeroot + - anything listed as a build-dependency in debian/control + - should probably have root + +* `ssh guestX@95.217.208.205` for a suitable X (1..10) + - declare which one you choose + - password on chat + + + +----------------------------------------------------------------------------- + +# Scap `debian/rules` + +~~~{.makefile .numberLines} +#!/usr/bin/make -f +export PYBUILD_NAME=scap +export DEB_BUILD_OPTIONS=nocheck + +PKG_VERSION = $(shell dpkg-parsechangelog -S Version) + +%: + dh $@ --with python2,bash-completion \ + --buildsystem=pybuild + +override_dh_auto_configure: + dh_auto_configure + echo "__version__ = '$(PKG_VERSION)'" \ + > scap/version.py +~~~ + +----------------------------------------------------------------------------- + +# What next? + +* upload to an APT repository? + + - `dput` or `dupload` + - requires permission from the repository admins + +* setting up your own APT repository? + + - reprepro or aptly, probably + - not for the faint of heart + +* make a package? + + - you _will_ run into trouble, don't be shy to ask for help + - WMF employs several current and former Debian developers + + +----------------------------------------------------------------------------- + +# Further reading + + + + + +----------------------------------------------------------------------------- + +# Legalese + +Copyright 2020 Wikimedia Foundation + +This content is licensed under the Creative Commons +Attribution-ShareAlike 4.0 International ([CC BY-SA 4.0][]) licence. + +[CC BY-SA 4.0]: https://creativecommons.org/licenses/by-sa/4.0/ + + +--- +title: "Debian packaging" +author: "Lars Wirzenius / Wikimedia Foundation" +date: "Version for 2020-05-18" +... -- cgit v1.2.1