Intelligente Lösungen
in neuer Dimension

Debian-Paket erzeugen

Ich habe ein C-Programm, welches ich gerne in ein Debian-Paket verpackt hätte!

Ausgangslage

  • Quelltext: logmd5.c
  • Makefile: Makefile

Verzeichnisstruktur:

  • logmd5-0.1.tar.gz
  • logmd5-0.1
    • logmd5.c
    • Makefile

Zusatzprogramme installieren

1
sudo apt install debmake

Grundgerüst erzeugen

1
2
debmake
# Erzeugt viele Debian-Dateien

Erster Build

1
debuild

Der Build läuft vielversprechend an, bricht dann aber ab mit einer Fehlermeldung:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
ubuntu@ubuntu-2004-build:~/build/dplog/logmd5-0.1$ debuild
 dpkg-buildpackage -us -uc -ui
dpkg-buildpackage: info: source package logmd5
dpkg-buildpackage: info: source version 0.1-1
dpkg-buildpackage: info: source distribution UNRELEASED
dpkg-buildpackage: info: source changed by  <>
 dpkg-source --before-build .
dpkg-buildpackage: info: host architecture amd64
 fakeroot debian/rules clean
dh clean
   dh_auto_clean
   dh_clean
 dpkg-source -b .
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building logmd5 using existing ./logmd5_0.1.orig.tar.gz
dpkg-source: info: building logmd5 in logmd5_0.1-1.debian.tar.xz
dpkg-source: info: building logmd5 in logmd5_0.1-1.dsc
 debian/rules build
dh build
   dh_update_autotools_config
   dh_autoreconf
   dh_auto_configure
   dh_auto_build
  make -j8 "INSTALL=install --strip-program=true"
make[1]: Entering directory '/home/ubuntu/build/dplog/logmd5-0.1'
cc -o logmd5 logmd5.c -lssl -lcrypto
strip logmd5
make[1]: Leaving directory '/home/ubuntu/build/dplog/logmd5-0.1'
   dh_auto_test
   create-stamp debian/debhelper-build-stamp
 fakeroot debian/rules binary
dh binary
   dh_testroot
   dh_prep
   dh_auto_install
  make -j8 install DESTDIR=/home/ubuntu/build/dplog/logmd5-0.1/debian/logmd5 AM_UPDATE_INFO_DIR=no "INSTALL=install --strip-program=true"
make[1]: Entering directory '/home/ubuntu/build/dplog/logmd5-0.1'
cp logmd5 /usr/local/bin
cp: cannot create regular file '/usr/local/bin/logmd5': Permission denied
make[1]: *** [Makefile:5: install] Error 1
make[1]: Leaving directory '/home/ubuntu/build/dplog/logmd5-0.1'
dh_auto_install: error: make -j8 install DESTDIR=/home/ubuntu/build/dplog/logmd5-0.1/debian/logmd5 AM_UPDATE_INFO_DIR=no "INSTALL=install --strip-program=true" returned exit code 2
make: *** [debian/rules:9: binary] Error 25
dpkg-buildpackage: error: fakeroot debian/rules binary subprocess returned exit status 2
debuild: fatal error at line 1182:
dpkg-buildpackage -us -uc -ui failed

Überarbeitung des Makefiles

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
ubuntu@ubuntu-2004-build:~/build/dplog$ diff -u logmd5-0.1.alt/Makefile logmd5-0.3/Makefile
--- logmd5-0.1.alt/Makefile  2020-06-23 07:31:16.000000000 +0200
+++ logmd5-0.3/Makefile  2020-06-23 08:26:41.000000000 +0200
@@ -1,7 +1,20 @@
+#DESTDIR=/
+LDLIBS=-lssl -lcrypto
+prefix = /usr
+
 logmd5:  logmd5.c
-    $(CC) -o $@ $< -lssl -lcrypto
+    $(CC)  $(CPPFLAGS) $(CFLAGS) $(LDCFLAGS) -o $@ $^ $(LDLIBS)
  strip $@
-install:
-    cp logmd5 /usr/local/bin

+install:    logmd5
+    install -D logmd5 $(DESTDIR)$(prefix)/bin/logmd5
+
+clean:
+    -rm -f logmd5
+
+distclean:  clean
+
+uninstall:
+    -rm -f $(DESTDIR)$(prefix)/bin/logmd5

+.PHONY: all install clean distclean uninstall

Damit läuft der Build ein Stückchen weiter:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
ubuntu@ubuntu-2004-build:~/build/dplog/logmd5-0.3$ debuild
...
   dh_md5sums
   dh_builddeb
dpkg-deb: building package 'logmd5' in '../logmd5_0.3-1_amd64.deb'.
 dpkg-genbuildinfo
 dpkg-genchanges  >../logmd5_0.3-1_amd64.changes
dpkg-genchanges: info: including full source code in upload
 dpkg-source --after-build .
dpkg-buildpackage: info: full upload (original source is included)
Now running lintian logmd5_0.3-1_amd64.changes ...
E: logmd5 changes: changed-by-address-malformed <>
E: logmd5 changes: changed-by-address-missing <>
E: logmd5 changes: changed-by-name-missing <>
E: logmd5: changelog-is-dh_make-template
E: logmd5: debian-changelog-file-contains-invalid-email-address
E: logmd5 source: maintainer-address-malformed <>
E: logmd5: maintainer-address-malformed <>
E: logmd5 source: maintainer-address-missing <>
E: logmd5: maintainer-address-missing <>
E: logmd5 source: maintainer-name-missing <>
E: logmd5: maintainer-name-missing <>
E: logmd5: section-is-dh_make-template
W: logmd5 source: bad-homepage <insert the upstream URL, if relevant>
W: logmd5: bad-homepage <insert the upstream URL, if relevant>
W: logmd5: binary-without-manpage usr/bin/hello
W: logmd5: copyright-has-url-from-dh_make-boilerplate
W: logmd5: copyright-without-copyright-notice
W: logmd5 source: extra-whitespace-around-name-in-changelog-trailer
W: logmd5 source: file-without-copyright-information debian/README.Debian
W: logmd5 source: file-without-copyright-information debian/changelog
W: logmd5 source: file-without-copyright-information debian/compat
W: logmd5 source: file-without-copyright-information debian/control
W: logmd5 source: file-without-copyright-information debian/copyright
W: logmd5 source: file-without-copyright-information debian/patches/series
W: logmd5 source: file-without-copyright-information debian/rules
W: logmd5 source: file-without-copyright-information debian/source/format
W: logmd5 source: file-without-copyright-information debian/watch
W: logmd5 source: missing-license-paragraph-in-dep5-copyright __no_copyright_nor_license__ (paragraph at line 7)
W: logmd5: new-package-should-close-itp-bug
W: logmd5: readme-debian-contains-debmake-template
W: logmd5 source: superfluous-clutter-in-homepage <insert the upstream URL, if relevant>
W: logmd5: superfluous-clutter-in-homepage <insert the upstream URL, if relevant>
W: logmd5: wrong-bug-number-in-closes l3:#nnnn
Finished running lintian.

Korrektur der Lintian-Fehler

maintainer-address

  • Datei: debian/control
  • Zeile: Maintainer: Uli Heller <uli.heller@daemons-point.com>

changed-by-address und changed-by-name

  • Datei: debian/changelog
  • Inhalt:
1
2
3
4
5
logmd5 (0.3-1dp01~focal1) focal; urgency=low
    
      * Initial release.
    
     -- Uli Heller <uli.heller@daemons-point.com>  Tue, 23 Jun 2020 08:27:15 +0200

section-is-dh_make-template

  • Datei: debian/control
  • Zeile: Section: x11

Korrektur der Lintian-Warnungen

file-without-copyright-information debian/README.Debian

  • Datei: debian/copyright
  • Inhalt:
1
2
3
4
5
6
7
...
    Files:     Makefile
               logmd5.c
                *
    Copyright: 2020 daemons point Gesellschaft fuer Datenverarbeitung mbH
    License:   Apache
    ...

copyright-has-url-from-dh_make-boilerplate

  • Datei: debian/copyright
  • Zeile: Source: https://www.daemons-point.com

bad-homepage

  • Datei: debian/control
  • Zeile: Homepage: https://www.daemons-point.com

Links

Änderungen

  • 2020-06-26 – erste Version