~bzr/ubuntu/hardy/debhelper/builddeps-ppa

« back to all changes in this revision

Viewing changes to doc/PROGRAMMING

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-04-24 19:22:46 UTC
  • Revision ID: james.westby@ubuntu.com-20090424192246-ytzyl3azu8bosewc
Tags: 7.2.8ubuntu1
* Merge with Debian unstable. Remaining Ubuntu changes:
  - dh_installudev: Default priority is now 40 by default, the target
    directory is /lib/udev/rules.d, and rules use '-' as separator instead of
    '_'.  Remove files from /etc/udev/rules.d unless they are user modified;
    if modified and of default priority, take care to rename.
    This should eventually go to Debian as well, see Debian #491117.
  - dh_auto_install: add "--install-layout=deb" to setup.py install calls
    (new Python 2.6 policy).
* dh_installxfonts: Drop versioned dependency for xfonts-utils. This
  was only necessary for dapper backports, but since dapper desktop goes
  EOL in two months, and we haven't done dapper backports in ages, this is
  just an unnecessary delta.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 
47
47
There are always exceptions. Just ask me.
48
48
 
49
 
Introducing Dh_Lib.pm:
50
 
---------------------
 
49
Introducing Dh_Lib:
 
50
------------------
51
51
 
52
 
Dh_Lib.pm is the library used by all debhelper programs to parse their
 
52
Dh_Lib is the library used by all debhelper programs to parse their
53
53
arguments and set some useful variables. It's not mandatory that your
54
54
program use Dh_Lib.pm, but it will make it a lot easier to keep it in sync
55
55
with the rest of debhelper if it does, so this is highly encouraged.
56
56
 
57
 
(There used to be a version of Dh_lib.pm that was a library of functions for
58
 
shell scripts. If you want to write a debhelper command that is a shell
59
 
script, I can dig up that old library for you. Only the perl one is
60
 
supported now, though.)
61
 
 
62
 
Use Dh_Lib.pm like this:
 
57
Use Dh_Lib like this:
63
58
 
64
59
use Debian::Debhelper::Dh_Lib
65
60
init();
66
61
 
67
 
The BEGIN block is there to make perl look for the module in all the right
68
 
places.
69
 
 
70
62
The init() function causes Dh_lib to parse the command line and do some other
71
63
initialization tasks.
72
64
 
77
69
-a, and -p. To help you make this work right, Dh_Lib.pm handles argument
78
70
processing. Just call init().
79
71
 
 
72
You can add support for additional options to your command by passing an
 
73
options hash to init(). The hash is then passed on the Getopt::Long to
 
74
parse the command line options. For example, to add a --foo option, which
 
75
sets $dh{FOO}:
 
76
 
 
77
init(options => { foo => \$dh{FOO} });
 
78
 
80
79
After argument processing, some global variables are used to hold the
81
80
results; programs can use them later. These variables are elements of the
82
81
%dh hash.
99
98
-X              EXCLUDE         exclude a something from processing (you
100
99
                                decide what this means for your program)
101
100
                                (This is an array)
102
 
                EXCLUDE_FIND    same as DH_EXCLUDE, except all items are put
 
101
-X              EXCLUDE_FIND    same as EXCLUDE, except all items are put
103
102
                                into a string in a way that they will make
104
103
                                find find them. (Use ! in front to negate
105
104
                                that, of course) Note that this should
106
105
                                only be used inside complex_doit(), not in
107
106
                                doit().
108
 
-x              INCLUDE_CONFFILES
109
 
                                include conffiles. It's -x for obscure
110
 
                                historical reasons.
111
107
-d              D_FLAG          you decide what this means to your program
112
 
-r              R_FLAG          you decide what this means to your program
113
 
-k              K_FLAG          you decide what this means to your program
 
108
-k              K_FLAG          used to turn on keeping of something
114
109
-P              TMPDIR          package build directory (implies only one
115
110
                                package is being acted on)
116
111
-u              U_PARAMS        will be set to a string, that is typically
117
112
                                parameters your program passes on to some
118
113
                                other program. (This is an array)
119
 
-m              M_PARAMS        will be set to a string, you decide what it
120
 
                                means to your program
121
 
-l              L_PARAMS        will be set to a string, you decide what it
122
 
                                means to your program
123
114
-V              V_FLAG          will be set to a string, you decide what it
124
115
                                means to your program
125
116
-V              V_FLAG_SET      will be 1 if -V was specified, even if no
129
120
                                those processed here), will apply to all 
130
121
                                binary packages the program acts on, not just
131
122
                                the first
132
 
--init-script   INIT_SCRIPT     will be set to a string, which specifies an
133
 
                                init script name (probably only
134
 
                                dh_installinit will ever use this)
135
 
--sourcedir     SOURCEDIR       will be set to a string (probably only
136
 
                                dh_movefiles will ever use this)
137
 
--destdir       DESTDIR         will be set to a string (probably only
138
 
                                dh_builddeb will ever use this)
139
 
--filename      FILENAME        will be set to a string
140
 
--flavor        FLAVOR          will be set to a string (probably only
141
 
                                dh_installemacsen will ever use this)
142
 
--number        PRIORITY        will be set to a number (deprecated)
 
123
--sourcedir     SOURCEDIR       will be set to a string
 
124
--destdir       DESTDIR         will be set to a string
143
125
--priority      PRIORITY        will be set to a number
 
126
--mainpackage   MAINPACKAGE     controls which package is treated as the
 
127
                                main package to act on
144
128
--name          NAME            a name to use for installed files, instead of
145
129
                                the package name
146
130
--error-handler ERROR_HANDLER   a function to call on error
147
 
--language      LANGUAGE        specify what language a file is in
148
 
--add-udeb      SHLIBS_UDEB     used by dh_makeshlibs
149
131
 
150
132
Any additional command line parameters that do not start with "-" will be 
151
133
ignored, and you can access them later just as you normally would.
152
134
 
153
 
If you need a new command line option, just ask me, and I will add it.
154
 
 
155
135
Global variables:
156
136
----------------
157
137
 
262
242
inhibit_log()
263
243
        Prevent logging the program's successful finish to
264
244
        debian/*debhelper.log
 
245
load_log($package, $hashref)
 
246
        Loads the log file for the given package and returns a list of
 
247
        logged commands.
 
248
        (Passing a hashref also causes it to populate the hash.)
 
249
write_log($cmd, $package ...)
 
250
        Writes the log files for the specified package(s), adding
 
251
        the cmd to the end.
 
252
 
 
253
Sequence Addons
 
254
---------------
 
255
 
 
256
The dh(1) command has a --with <addon> parameter that ca be used to load
 
257
a sequence addon named Debian::Debhelper::Sequence::<addon>. 
 
258
These addons can add/remove commands to the dh command sequences, by calling
 
259
some functions from Dh_Lib:
 
260
 
 
261
insert_before($existing_command, $new_command)
 
262
        Insert $new_command in sequences before $existing_command
 
263
 
 
264
insert_after($existing_command, $new_command)
 
265
        Insert $new_command in sequences after $existing_command
 
266
 
 
267
remove_command($existing_command)
 
268
        Remove $existing_command from the list of commands to run.
265
269
 
266
270
-- Joey Hess <joeyh@debian.org>