mirror of
https://github.com/yaobinwen/dpkg.git
synced 2026-01-12 08:20:35 +00:00
master
…
…
…
…
…
…
…
…
dpkg: Annotated Version
Overview
I've added comments to the code for a learning purpose. See the package's original README for more details.
When installed on a machine, the main dpkg scripts (e.g, dpkg-buildpackage) are installed by the package dpkg (in /usr/bin), but the Dpkg module is installed by libdpkg-perl (in /usr/share/perl5/Dpkg).
Quick Pickup
If you haven't looked at the source code for a wile, you will likely have forgotten what you had learned earlier. Here is the list to help you quickly pick up what you learned about dpkg before:
- Start with
scripts/dpkg-buildpackage.plbecause this file has many notes about basic syntax and usage of Perl. Find the comments withNOTE(ywen)and read through them from top to bottom. .plfiles are Perl scripts;.pmfiles are Perl modules. If you want to find some code, e.g., a subroutine, do find in both kinds of files.- The module
Dpkg::ErrorHandlingdefines the subroutineerror(seesub error($;@)) that prints a message and exits. You can use this function to test the behavior of the code. - Perl uses
printto print a message. For example:print "SOURCE_DATE_EPOCH = $ENV{SOURCE_DATE_EPOCH}\n";. See this doc and this tutorial for more details. - Perl requires
;to end a statement. Make sure you write it.
Description
Languages
C
41.7%
Perl
31.9%
Roff
7.6%
C++
6.4%
Makefile
6%
Other
6.4%