~fta/+junk/ppa-scripts

101 by Fabien Tassin
* Add some initial documentations hoping it could help others
1
This package contains a bot that could be used to automatically create
2
new revisions of one or more packages and submit them to one or more
3
repositories, most likely PPAs. It could do several distributions in a row,
4
assuming the packaging is ready for that.
5
It could run in cron to produce daily/nightly builds, or manually whenever
6
needed to help with the package maintenance.
7
8
Prerequisites: bzr bzr-builddeb
9
10
The packaging (debian/ directory) has to be in a bazaar branch in order to
11
be mergeable with bzr-builddeb. Native packages are also allowed.
12
102 by Fabien Tassin
* Improve the documentation
13
The bot will create a few bzr branches per package and it will never touch
14
the packaging branch itself.
15
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
16
The packaging *must* provide a get-orig-source target (in debian/rules) in order
17
for the bot to create the proper tarballs. Special attention must be given to
18
the versionning scheme. Versions *must* always increase. If the package is also
19
in the official Ubuntu repositories, it is also advised to make sure that
20
packages created by this bot integrate well with the official packages.
102 by Fabien Tassin
* Improve the documentation
21
Please read the official recommendations regarding Versionning in PPAs:
22
https://help.launchpad.net/Packaging/PPA#Versioning
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
23
24
The bot is composed of some scripts and some configuration files. Those scripts
25
could be run independently or chained (by daily.sh).
26
27
- ppabot.conf:
28
29
=====
30
{
31
  # 'dist'          => `lsb_release -c -s`,
32
  # 'alt_dists'     => [ 'intrepid', 'hardy' ], # other than $dist, will be taggued as ~dist
33
  # 'who'           => `bzr whoami`,
119 by Fabien Tassin
* Add a system to send logs by email to 'watchers'. This is per pocket
34
  # 'watchers'      => `bzr whoami`, # list of contacts who will receive the logs
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
35
  # 'dput_target'   => "ppa", # from ~/.dput.cf
36
  # 'iteration_tag' => "ppa", # "xxx" => -0ubuntu1~xxx1
37
  # 'ppa_branchtag' => "ppa", # "xxx" => package.head.xxx
38
  # 'gpg_key'       => undef, # "ABCDEF"
39
  # 'test_suffix'   => "test",
40
  # 'build_dir'     => "$ENV{'HOME'}/ppa",
144 by Fabien Tassin
* Allow per pocket tarball dir. This is needed if you have more than one
41
  # 'tarballs_dir'  => "../tarballs", # absolute dir or relative to the branch dir
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
42
}
43
=====
44
45
Those are the default values for all packages of a given pocket (group).
46
If some values need to be changed, the corresponding lines must be uncommented.
47
144 by Fabien Tassin
* Allow per pocket tarball dir. This is needed if you have more than one
48
If you have more than one version of the same source package (like a stable and a
49
dev version), you need to put then in different pockets and assign them different
50
build_dir and tarballs_dir values (one pair could stay the default).
51
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
52
note: it's a perl script so the syntax could be manually checked with perl -c
53
54
- ppabot-pkgs.conf
55
56
This file describes a given pocket.
57
58
=====
59
{
60
  'pkgs' => {
61
    # 'nspr'               => { 'branch' => 'nspr.head' },
62
    # 'nss'                => { 'branch' => 'nss.head' },
63
    # 'xulrunner-1.9.1'    => { 'branch' => 'xulrunner-1.9.1.head' },
64
    # 'firefox-3.1'        => { 'branch' => 'firefox-3.1.head' },
65
    # 'fennec'             => { 'branch' => 'fennec.head'},
66
   },
67
68
  'order' => [
69
    # 'nspr', 'nss',
70
    # 'xulrunner-1.9.1', 'firefox-3.1',
71
    # 'fennec',
72
  ],
73
74
  'deps' => {       # bin => src
75
    # 'libnspr4-dev'        => 'nspr',
76
    # 'libnss3-dev'         => 'nss',
77
    # 'xulrunner-1.9.1-dev' => 'xulrunner-1.9.1',
78
  },
79
80
  # Don't update dependencies for those packages
81
  'nodeps' => [
82
    # 'fennec',
83
  ],
84
};
85
=====
86
87
note: it's a perl script so the syntax could be manually checked with perl -c
88
102 by Fabien Tassin
* Improve the documentation
89
More fields are recognized, especially in the 'pkgs' subsection.
90
91
The comprehensive list is:
92
93
  Mandatory: 
94
  * 'branch': basename of the packaging branch (as stored locally)
95
  * 'lp': full URL of the remote bzr branch (usually on Launchpad)
96
109 by Fabien Tassin
* Add a 'no_update' field in pkg conf files, similar to 'no_auto' but just skip
97
  Optional:
102 by Fabien Tassin
* Improve the documentation
98
  * 'no_auto': a boolean allowing a package to be skipped by the bot while
99
     remaining usable manually. Default: 0 / "false"
109 by Fabien Tassin
* Add a 'no_update' field in pkg conf files, similar to 'no_auto' but just skip
100
  * 'no_update': similar to 'no_auto' but just skip the tarball update. The
101
     sync is still performed, allowing packaging changes to be merged in.
102
     Default: 0 / "false"
102 by Fabien Tassin
* Improve the documentation
103
  * 'upstream': directory where to keep a local copy of the upstream branch.
104
     It is passed to get-orig-source through LOCAL_BRANCH by update-pkg.sh
105
     (see below). No default (no cache)
106
  * 'local_init': a shell command which could be used to populate the 'upstream'
107
     directory if it's empty or absent. No default (no cache)
145 by Fabien Tassin
* Add an optional per package 'upgrade_flags' allowing user flags to be
108
  * 'upgrade_flags': some flags passed to get-orig-sources. No default.
102 by Fabien Tassin
* Improve the documentation
109
  * 'ppa': basename of the PPA branch containing the result of the merges. This
110
     where work happens. Default: 'branch'.'ppa_branchtag' (from the main
111
     configuration file)
118 by Fabien Tassin
* Introduce 'vpattern' in package config files, used by update-pkg.sh.
112
  * 'vpattern': a regular expression applied on the version. It must match
113
     in order to continue with that new tarball. This is useful if you want
114
     to make sure that a versionned package stays bound. No default (no
115
     matching requested). For example, firefox-3.6 with a vpattern set to
116
     '^3\.6(\~|\.)' will match 3.6.x but not 3.7.
112 by Fabien Tassin
* Introduce a system to dynamically add build-deps either globally, or per
117
  * 'build-deps': a structure used to dynamically add build-dependencies. It
118
     could be global, per package and per distribution. This is useful when
119
     touching the packaging branch is not desirable, or not possible (like
120
     when some build-deps are only available on some distributions).
121
122
     Example:
123
124
     'pkgs' => {
125
       'chromium-browser' => {
126
         'branch'     => 'chromium-browser.head',
127
         'lp'         => 'lp:~chromium-team/chromium-browser/chromium-browser.head',
128
         'upstream'   => 'upstream/chromium-browser.svn',
129
         'build-deps' => {
130
           'all_dists' => [ 'foo | bar', 'baz (>= 1.2.3)' ],
131
           'karmic'    => [ 'binutils-gold' ],
132
         }
133
       }
134
     }
135
     ...
136
     'build-deps' => {
137
       'all_pkgs' => [ 'lintian' ],
138
       'ia32-libs-chromium-browser' => [ 'dep1', 'dep2 [!amd64]' ],
139
     }
140
   
141
     In this example, all packages will have lintian for all arches,
142
     ia32-libs-chromium-browser will have 'dep1, dep2 [!amd64]' for all
143
     arches, 'chromium-browser' will have 'foo | bar, baz (>= 1.2.3)' for
144
     all distributions and binutils-gold only for karmic.
102 by Fabien Tassin
* Improve the documentation
145
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
146
- update-pkg.sh
147
148
=====
149
Usage: update-pkg.sh [-n|--new] [-c conf] [-p pkg-conf] [-d|--date YYYYMMDDtHHMM] [-L .../branch] branch [branch2 [...]]
150
       update-pkg.sh [-n|--new] [-D|--daily] [--test] [-t|--tag SOMETAG=someversion] branch
135 by Fabien Tassin
* Refactor the no-upgrade mode to make it show the packaging changes
151
       update-pkg.sh [-N|--no-upgrade] [...] branch
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
152
153
 By default, email, date and version are always updated.
154
 To create a new version, use -n
155
 To prevent a bzr pull/push, use --test
156
 To prevent a bzr pull, and push in overwrite mode, use --fix
157
 To work from a local branch, use -L
158
 To update the package branch from the last daily snapshot, use --daily
135 by Fabien Tassin
* Refactor the no-upgrade mode to make it show the packaging changes
159
 To prevent the upgrade, but still do all the checking, use --no-upgrade
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
160
=====
161
162
update-pkg.sh performs the following actions:
163
 1/ it tries to 'pull' the packaging branch (in case there are new revisions on
164
    the server)
165
   *Note* it implies the location has already been registered with --remember
166
    for pull, unless it is specified in the package configuration file.
167
 2/ it calls the get-orig-source target from that branch, possibly with some
168
    attributes:
169
    - DEBIAN_DATE  = value of --date
170
    - DEBIAN_TAG   = value of --tag
171
    - LOCAL_BRANCH = value of -L
172
    get-orig-source could make use of these attributes to get a particular
173
    upstream revision based on a tag or a date. The local branch could be
174
    useful to keep a local copy of the upstream branch and then do an update
175
    instead of a full checkout.
176
    It is important to understand the magic has to be in get-orig-source as
177
    there's no generic way for the script to know the specifics of upstream and
178
    its packaging.
179
 3/ it updates debian/changelog, either by updating the version & date of the
180
    current revision (should be UNRELEASED), or by creating a new entry if --new
181
    was received.
182
 4/ it pushes the packaging branch back
183
   *Note* it implies the location has already been registered with --remember
184
   for push, unless it is specified in the package configuration file.
185
186
 Examples:
187
   $ update-pkg.sh -t FIREFOX_3_5b99_RELEASE=3.5~b99 firefox-3.5.head
188
   $ update-pkg.sh -L ../upstream/chromium-browser.svn chromium-browser.head
103 by Fabien Tassin
* Fix typos in the examples
189
   $ update-pkg.sh -c ../confs/pkg-ucd.conf -p ../confs/pkg-pkgd-ucd.conf chromium-browser.head
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
190
191
- sync-ppa.pl
192
193
=====
110 by Fabien Tassin
* Add -f to sync-ppa.pl to force a merge even if it's not useful. Version
194
Usage: sync-ppa.pl [-d archive] [-c conf] [-p pkgconf] [-f] [-i] [-P] [-t] [-h] [-A] [pkg1] [pkg2] [...]
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
195
  -h           this help screen
196
  -c conf      use 'conf' as alternative conf file
197
  -p pkgconf   use 'pkgconf' as alternative package conf file
198
  -d archive   push to an alternative archive (default: ppa)
199
  -t           use test branches, if necessary branched off the configured ones
200
  -A           don't do alternative dists
201
  -i           initialize the PPA branches and quit
110 by Fabien Tassin
* Add -f to sync-ppa.pl to force a merge even if it's not useful. Version
202
  -f           force the merge, even if it's not needed
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
203
  -P           do the dPut at the end
204
  -r           revert the last sync
205
=====
206
207
sync-ppa.pl creates and maintains one branch per package and per distribution.
208
Those branches are merged down, starting from the packaging branch.
209
It is able to detect when a new upload is needed, either if there's a new
210
tarball, or some changes to the packaging branch. It takes care of the
211
version iterators.
212
213
  Examples:
103 by Fabien Tassin
* Fix typos in the examples
214
   $ sync-ppa.pl -c ../confs/pkg-ucd.conf -p ../confs/pkg-pkgd-ucd.conf -P chromium-browser.head
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
215
102 by Fabien Tassin
* Improve the documentation
216
  Note: when -c (resp. -p) is not specified, sync-ppa.pl will try to use
217
   ~/.ppabot.conf (resp. ~/.ppabot-pkgs.conf), or /etc/ppabot.conf (resp.
218
   /etc/ppabot-pkgs.conf) if they exist (the first found wins).
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
219
220
- daily.sh
221
113 by Fabien Tassin
* Add -f/--force flag to daily.sh forcing a sync. Useful for new projects
222
Usage: daily.sh [-n|--no-tarball-update] [-f|--force] pocket1 [pocket2] [...]
105 by Fabien Tassin
* Add --no-tarball-update to daily.sh so it's easier to respin a build
223
119 by Fabien Tassin
* Add a system to send logs by email to 'watchers'. This is per pocket
224
   -e or --email                Email logs to the pocket watchers
105 by Fabien Tassin
* Add --no-tarball-update to daily.sh so it's easier to respin a build
225
   -n or --no-tarball-update    Don't update tarballs
117 by Fabien Tassin
* Add another flag to daily.sh to prevent the merge (and then the push).
226
   -s or --no-sync              Don't sync the branches (implies --no-push)
116 by Fabien Tassin
* Add a new flag to prevent the final dput, it will grab the new tarball
227
   -p no --no-push              Prevent the final dput to the builders
113 by Fabien Tassin
* Add -f/--force flag to daily.sh forcing a sync. Useful for new projects
228
   -f or --force                Force a sync
105 by Fabien Tassin
* Add --no-tarball-update to daily.sh so it's easier to respin a build
229
   -h or --help                 This help screen
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
230
231
daily.sh is the core the bot, calling the other scripts with the right
232
arguments.
233
119 by Fabien Tassin
* Add a system to send logs by email to 'watchers'. This is per pocket
234
if --email is specified, all the 'watchers' for a given pocket will receive
235
the logs for that pocket. It defaults to 'who'.
236
Note: this requires MIME::Entity (libmime-tools-perl) and a valid sendmail
237
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
238
===
239
FIXME: for now, this script must be edited to update the following variables:
240
241
WORKDIR=/data/bot      => where all the branches live
242
BINDIR=/data/bot/src   => where all the scripts are located
243
CONFDIR=$WORKDIR/confs => where all the conf files are located
244
===
245
246
It expects a specific format for the conf filenames.
247
For a given pocket $POCKET, $CONFDIR/ppabot-pkgs-$POCKET.conf and
248
$CONFDIR/ppabot-$POCKET.conf must exist.
249
This allows the bot to work with several pockets.
250
251
This script could be run in cron.
252
253
===
254
FIXME: the output is really ugly, mostly useful to troubleshoot at this point
255
===
256
257
Here is a full example with gwibber:
258
259
get-orig-source:
260
102 by Fabien Tassin
* Improve the documentation
261
See http://bazaar.launchpad.net/~gwibber-team/gwibber/packaging/annotate/head:/debian/rules
101 by Fabien Tassin
* Add some initial documentations hoping it could help others
262
It takes advantage of DEBIAN_TAG.
263
264
configuration files:
265
http://bazaar.launchpad.net/~fta/+junk/ppa-confs/annotate/head:/ppabot-gwibber.conf
266
http://bazaar.launchpad.net/~fta/+junk/ppa-confs/annotate/head:/ppabot-pkgs-gwibber.conf
267
268
Once get-orig-source and the conf files are in place, it's just a matter of
269
running "daily.sh gwibber" in cron
270
271
The resulting debs are available here:
272
https://edge.launchpad.net/~gwibber-daily/+archive/ppa?field.name_filter=&field.status_filter=any&field.series_filter=any
273
274
The bot also publishes the daily branch:
275
https://code.edge.launchpad.net/~gwibber-daily/gwibber/gwibber.head.daily
276