1 Initialising a dak database schema
2 ==================================
4 The following packages are needed for the database:
5 * postgresql-9.0 postgresql-client-9.0 postgresql-plperl-9.0 postgresql-plpython-9.0 postgresql-9.0-debversion
6 and the following packages for dak itself:
7 * python-psycopg2 python-sqlalchemy python-apt gnupg dpkg-dev lintian
8 binutils-multiarch python-yaml less python-ldap python-pyrss2gen python-rrdtool
11 (the schema assumes at least postgresql 9.0; ftpmaster in Debian currently uses
12 the squeeze postgresql 9.0 backport)
14 The following roles are assumed to exist:
15 * dak: database superuser: needs to be an actual user
16 * ftpmaster: role which should be given to archive administrators
17 * ftpteam: people who can do NEW processing, overrides, removals, etc
18 * ftptrainee: people who can add notes to packages in NEW
20 For the purposes of this document, we'll be working in /srv/dak
22 Set up the dak user on both the system and in postgres:
23 # sudo addgroup --system ftpmaster
24 # sudo adduser --system dak --ingroup ftpmaster --shell /bin/bash
25 # sudo -u postgres createuser -s dak
27 Set up the dak directory:
30 # sudo chown dak:ftpmaster /srv/dak
31 # sudo chmod 2775 /srv/dak
33 Create a symlink to /srv/dak/dak.conf in /etc/dak
34 (we'll create the config file in a bit)
35 # sudo ln -s /srv/dak/dak.conf /etc/dak/dak.conf
40 Create the additional roles:
41 # createuser -S -R -D ftpmaster
42 # createuser -S -R -D ftpteam
43 # createuser -S -R -D ftptrainee
44 # psql -d projectb -c "ALTER GROUP ftpteam ADD USER ftpmaster"
45 # psql -d projectb -c "ALTER GROUP ftptrainee ADD USER ftpmaster"
46 # psql -d projectb -c "ALTER GROUP ftptrainee ADD USER ftpteam"
48 Create an empty database with SQL_ASCII encoding:
49 # createdb -T template0 -E SQL_ASCII -O dak projectb
51 Import the schema. We redirect STDOUT to /dev/null as otherwise it's
52 impossible to see if something fails.
53 # psql -1 -f current_schema.sql -d projectb >/dev/null
55 Set up some core data in projectb to get started (read the init_vars file if
56 you wish to customise various aspects):
59 Create a minimal dak.conf
60 # ./init_minimal_conf > /srv/dak/dak.conf
62 Set up a symlink somewhere
64 # ln -s /path/to/dak.py ~dak/bin/dak
66 At this point, you should be able to test that the database schema is
70 Run dak init-dirs to set up the initial /srv/dak tree
73 Copy the email templates into the /srv/dak tree.
74 WARNING: Please check these templates over and customise as necessary
75 # cp templates/* /srv/dak/templates/
77 Set up a private signing key: don't set a passphrase as dak will not
78 pass one through to gpg. Guard this key carefully!
79 The key only needs to be able to sign, it doesn't need to be able
81 # gpg --no-default-keyring --secret-keyring /srv/dak/keyrings/s3kr1t/dot-gnupg/secring.gpg --keyring /srv/dak/keyrings/s3kr1t/dot-gnupg/pubring.gpg --gen-key
82 Remember the signing key id for when creating the suite below.
83 Here we'll pretend it is DDDDDDDD for convenience
85 Import some developer keys.
86 Either import from keyservers (here AAAAAAAA):
87 # gpg --no-default-keyring --keyring /srv/dak/keyrings/upload-keyring.gpg --recv-key AAAAAAAA
89 # gpg --no-default-keyring --keyring /srv/dak/keyrings/upload-keyring.gpg --import /path/to/keyfile
91 Import the developer keys into the database
92 The -U '%s' tells dak to add UIDs automatically
93 # dak import-keyring -U '%s' /srv/dak/keyrings/upload-keyring.gpg
95 Add some architectures you care about:
96 # dak admin architecture add i386 "Intel x86 port"
97 # dak admin architecture add amd64 "AMD64 port"
99 Add a suite (origin=, label= and codename= are optional)
100 signingkey= will ensure that Release files are signed
101 # dak admin suite add-all-arches unstable x.y.z origin=MyDistro label=Master codename=sid signingkey=DDDDDDDD
103 Re-run dak init-dirs to add new suite directories to /srv/dak
106 #######################################################################
107 # Example package flow
108 #######################################################################
110 For this example, we've grabbed and built the hello source package
111 for AMD64 and copied it into /srv/dak/queue/unchecked.
113 We start by performing initial package checks which will
114 result in the package being moved to NEW
115 # cd /srv/dak/queue/unchecked
116 # dak process-upload *.changes
118 -----------------------------------------------------------------------
119 hello_2.6-1_amd64.changes
123 (new) hello_2.6-1.debian.tar.gz optional devel
124 (new) hello_2.6-1.dsc optional devel
125 (new) hello_2.6-1_amd64.deb optional devel
126 The classic greeting, and a good example
127 The GNU hello program produces a familiar, friendly greeting. It
128 allows non-programmers to use a classic computer science tool which
129 would otherwise be unavailable to them.
131 Seriously, though: this is an example of how to do a Debian package.
132 It is the Debian version of the GNU Project's `hello world' program
133 (which is itself an example for the GNU Project).
134 (new) hello_2.6.orig.tar.gz optional devel
135 Changes: hello (2.6-1) unstable; urgency=low
137 * New upstream release.
138 * Drop unused INSTALL_PROGRAM stuff.
139 * Switch to 3.0 (quilt) source format.
140 * Standards-Version: 3.9.1 (no special changes for this).
143 Override entries for your package:
145 Announcing to debian-devel-changes@lists.debian.org
150 -----------------------------------------------------------------------
152 We can now look at the NEW queue-report
154 -----------------------------------------------------------------------
158 hello | 2.6-1 | source amd64 | 5 seconds old
160 1 new source package / 1 new package in total.
161 -----------------------------------------------------------------------
163 And we can then process the NEW queue:
164 # cd /srv/dak/queue/new
165 # dak process-new *.changes
167 -----------------------------------------------------------------------
168 hello_2.6-1_amd64.changes
172 Add overrides, Edit overrides, Check, Manual reject, Note edit, Prod, [S]kip, Quit ?A
174 -----------------------------------------------------------------------
176 At this stage, the package has been ACCEPTed from NEW into NEWSTAGE.
177 We now need to finally ACCEPT it into the pool:
179 # cd /srv/dak/queue/newstage
180 # dak process-upload *.changes
182 -----------------------------------------------------------------------
183 hello_2.6-1_amd64.changes
187 hello_2.6-1.debian.tar.gz
188 to main/h/hello/hello_2.6-1.debian.tar.gz
190 to main/h/hello/hello_2.6-1.dsc
191 hello_2.6-1_amd64.deb
192 to main/h/hello/hello_2.6-1_amd64.deb
193 hello_2.6.orig.tar.gz
194 to main/h/hello/hello_2.6.orig.tar.gz
197 Override entries for your package:
198 hello_2.6-1.dsc - optional devel
199 hello_2.6-1_amd64.deb - optional devel
201 Announcing to debian-devel-changes@lists.debian.org
202 [A]ccept, Skip, Quit ?A
204 Installed 1 package set, 646 KB.
205 -----------------------------------------------------------------------
207 We can now see that dak knows about the package:
210 -----------------------------------------------------------------------
211 hello | 2.6-1 | unstable | source, amd64
212 -----------------------------------------------------------------------
214 # dak control-suite -l unstable
216 -----------------------------------------------------------------------
219 -----------------------------------------------------------------------
221 Next, we can generate the packages and sources files:
222 # dak generate-packages-sources2
223 (zcat /srv/dak/ftp/dists/unstable/main/binary-amd64/Packages.gz for instance)
225 And finally, we can generate the signed Release files:
226 # dak generate-release
228 -----------------------------------------------------------------------
230 -----------------------------------------------------------------------
231 (Look at /srv/dak/ftp/dists/unstable/Release, Release.gpg and InRelease)
234 #######################################################################
236 #######################################################################
238 The debian archive automates most of these steps in jobs called
239 cron.unchecked, cron.hourly and cron.dinstall.
241 TODO: Write example (simplified) versions of these cronjobs which will
242 do for most installs.