Debian::Rules(3pm)
β¨ Debian::Rules β¨
okay bestie, welcome to Debian::Rules β the Perl module that gives you handy manipulation of debian/rules π
it's living in the User Contributed Perl Documentation corner of the 3pm section, and honestly? she's iconic.
πΈ NAME πΈ
Debian::Rules β handy manipulation of debian/rules π
π¦ SYNOPSIS π¦
my $r = Debian::Rules->new('debian/rules');
my $r = Debian::Rules->new( { filename => 'debian/rules' } );
$r->is_dhtiny && print "Using the latest and greatest\n";
$r->is_quiltified && print "quilt rules the rules\n";
# file contents changed externally
$r->parse;
$r->drop_quilt;
$r->write; # or undef($r);
π DESCRIPTION π
so like, sometimes you just need to know whether debian/rules is using the dh(1) tiny variant, or whether it's all integrated with quilt(1). bestie, Debian::Rules has you β she provides the facilities to check that, plus adding/removing quilt integration. so versatile. so slay. β¨
and the modified contents? they get written to the file either via the write method, or when the object reference goes out of scope (via DESTROY). no cap, she cleans up after herself π«Ά
π CONSTRUCTOR π
new is the standard Class::Accessor constructor β except that if only one, non-reference argument is provided, it's treated as a value for the filename field. cute, right?
if a file name is given, the constructor calls read to read the file contents into memory. π
β οΈ important bestie: one offilenameorlinesis mandatory. don't come to her with neither, she will not be okay.
π FIELDS π
filenameβ contains the file name of the rules file ποΈlinesβ a reference to an array pointing to the rules file. initialized bynewπ«
π METHODS π
parse
parses the rules file and stores its findings for later use π she gets called automatically by is_dhtiny and is_quiltified. the result of the parsing gets cached, and subsequent calls to is_XXX use that cache. so if the file contents changed and you need a fresh vibe check, just call parse again π
is_dhtiny
returns true if the contents of the rules file seem to use the so-called tiny variant offered by dh(1). tiny rules are detected by the presence of these two lines:
%:
dh $@
(any options on the dh command line are ignored β she's not nosy like that π)
is_quiltified
returns true if the contents of the rules file indicate that quilt(1) is used. various styles of quilt integration are detected:
dh --with=quiltquilt.makewith$(QUILT_STAMPFN)andunpatchtargets.
drop_quilt
removes quilt(1) integration π§Ή both the dh(1) tiny style (dh --with=quilt) and the traditional approach ($(QUILT_STAMPFN) and unpatch) are detected and removed. bye quilt π
read [file name]
replaces the current rules content with the content of filename. if filename isn't given, she uses the value of the filename member.
write [filename]
writes the in-memory contents to filename. if not given, uses the value of the filename member.
if lines points to an empty array, the file is removed π (yes, gone gone).
π COPYRIGHT & LICENSE π
copyright belongs to:
- Copyright (C) 2009, 2010 Damyan Ivanov
<dmn@debian.org> - Copyright (C) 2014, 2026 gregor herrmann
<gregoa@debian.org>
so 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. periodt π
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.
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. ποΈ
and that's the whole thing bestie β this was Debian::Rules(3pm) from perl v5.40.1, dated 2026-05-08. go forth and manipulate those rules, you absolute main character π«Άβ¨π
π¦ where this page comes from
- ubuntu stonking: libdebian-source-perl 0.133 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms