.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Debian::Rules 3pm" .TH Debian::Rules 3pm 2024-03-14 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Debian::Rules \- handy manipulation of debian/rules .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& my $r = Debian::Rules\->new(\*(Aqdebian/rules\*(Aq); \& \& my $r = Debian::Rules\->new( { filename => \*(Aqdebian/rules\*(Aq } ); \& \& $r\->is_dhtiny && print "Using the latest and greatest\en"; \& $r\->is_quiltified && print "quilt rules the rules\en"; \& \& # file contents changed externally \& $r\->parse; \& \& $r\->add_quilt; \& $r\->drop_quilt; \& \& $r\->write; # or undef($r); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Some times, one needs to know whether \fIdebian/rules\fR uses the \fBdh\fR\|(1) tiny variant, or whether it is integrated with \fBquilt\fR\|(1). Debian::Rules provides facilities to check this, as well as adding/removing quilt integration. .PP Modified contents are written to file either vie the "write" method, or when the object reference goes out of scope (via DESTROY). .SH CONSTRUCTOR .IX Header "CONSTRUCTOR" \&\f(CW\*(C`new\*(C'\fR is the standard Class::Accessor constructor, with the exception that if only one, non-reference argument is provided, it is treated as a value for the filename field. .PP If a file name is given, the constructor calls "read" to read the file contents into memory. .PP One of \fBfilename\fR or \fBlines\fR is mandatory. .SH FIELDS .IX Header "FIELDS" .IP filename 4 .IX Item "filename" Contains the file name of the rules file. .IP lines 4 .IX Item "lines" Reference to an array pointing to the rules file. Initialized by "new". .SH METHODS .IX Header "METHODS" .IP parse 4 .IX Item "parse" Parses the rules file and stores its findings for later use. Called automatically by is_dhtiny and is_quiltified. The result of the parsing is cached and subsequent calls to \f(CW\*(C`is_XXX\*(C'\fR use the cache. To force cache refresh (for example if the contents of the file have been changed), call \&\f(CW\*(C`parse\*(C'\fR again. .IP is_dhtiny 4 .IX Item "is_dhtiny" Returns true if the contents of the rules file seem to use the so called \&\fItiny\fR variant offered by \fBdh\fR\|(1). Tiny rules are detected by the presence of the following two lines: .Sp .Vb 2 \& %: \& dh $@ .Ve .Sp (any options on the \f(CW\*(C`dh\*(C'\fR command line ignored). .IP is_quiltified 4 .IX Item "is_quiltified" Returns true if the contents of the rules file indicate that \fBquilt\fR\|(1) is used. Various styles of \f(CW\*(C`quilt\*(C'\fR integration are detected: .RS 4 .IP "dh \-\-with=quilt" 4 .IX Item "dh --with=quilt" .PD 0 .ie n .IP "\fIquilt.make\fR with ""$(QUILT_STAMPFN)"" and ""unpatch"" targets." 4 .el .IP "\fIquilt.make\fR with \f(CW$(QUILT_STAMPFN)\fR and \f(CWunpatch\fR targets." 4 .IX Item "quilt.make with $(QUILT_STAMPFN) and unpatch targets." .RE .RS 4 .RE .IP add_quilt 4 .IX Item "add_quilt" .PD Integrates \fBquilt\fR\|(1) into the rules. For \fBdh\fR\|(1) \fItiny\fR rules (as determined by "is_dhtiny") \f(CW\*(C`\-\-with=quilt\*(C'\fR is added to every \f(CW\*(C`dh\*(C'\fR invocation. For the more traditional variant, quilt is integrated via \&\fIquilt.make\fR and its \f(CW\*(C`$(QUILT_STAMPFN)\*(C'\fR and \f(CW\*(C`unpatch\*(C'\fR targets. .IP drop_quilt 4 .IX Item "drop_quilt" Removes \fBquilt\fR\|(1) integration. Both \fBdh\fR\|(1) \fItiny\fR style (\f(CW\*(C`dh \&\-\-with=quilt\*(C'\fR) and traditional (\f(CW\*(C`$(QUILT_STAMPFN)\*(C'\fR and \f(CW\*(C`unpatch\*(C'\fR) approaches are detected and removed. .IP "read [\fIfile name\fR]" 4 .IX Item "read [file name]" Replaces the current rules content with the content of \fIfilename\fR. If \&\fIfilename\fR is not given, uses the value of the "filename" member. .IP "write [\fIfilename\fR]" 4 .IX Item "write [filename]" Writes the in-memory contents \fIfilename\fR. If not given, uses the value of the "filename" member. .Sp If "lines" points to an empty array, the file is removed. .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" .IP "Copyright (C) 2009, 2010 Damyan Ivanov " 4 .IX Item "Copyright (C) 2009, 2010 Damyan Ivanov " .PD 0 .IP "Copyright (C) 2014 gregor herrmann " 4 .IX Item "Copyright (C) 2014 gregor herrmann " .PD .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110\-1301 USA.