---
name: "Dpkg::BuildDriver"
section: "3perl"
platform: "linux"
package: "dpkg"
version: "1.23.11-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Dpkg::BuildDriver"
---

# Dpkg::BuildDriver(3perl)

drive the build of a Debian package

## NAME

Dpkg::BuildDriver - drive the build of a Debian package

## DESCRIPTION

This class is used by dpkg-buildpackage to drive the build of a Debian package.

**Note**: This is a private module, its API can change at any time.

## METHODS

- $bd = Dpkg::BuildDriver-\>new(%opts)

  Create a new Dpkg::BuildDriver object. It will load a build driver module as requested in the **Build-Drivers** field in the `$opts`{ctrl} Dpkg::Control::Info object or if not present, it will fall back to load the default **debian-rules** driver.

  Options:

  - **ctrl** (required)

    A Dpkg::Control::Info object.

  - **root\_cmd**

    A string with the gain-root-command to use when needing to execute a command with root-like rights. If needed and unset, it will default to fakeroot if it is available or the module will error out.

  - **as\_root**

    A boolean to force *debian/rules* target calls as root-like, even if they would normally not require to be executed as root-like. This option is applied to all targets globally.

    **Note**: This option is only relevant for drivers that use *debian/rules*.

  - **debian\_rules**

    An array containing the command to execute the *debian/rules* file and any additional arguments. It defaults to **debian/rules**.

    **Note**: This option is only relevant for drivers that use *debian/rules*.

  - **rrr\_override**

    A string that overrides the **Rules-Requires-Root** field value.

    **Note**: This option is only relevant for drivers that use *debian/rules*.

- $bd-\>**pre\_check()**

  Perform build driver specific checks, before anything else.

  This will run after the **init** hook, and before `"dpkg-source --before-build"`.

  **Note**: This is an optional method that can be omitted from the driver implementation.

- $bool = $bd-\>need\_build\_task($build\_task, binary\_task)

  Returns whether we need to use the build task.

  **Note**: This method is needed as long as we support building as root-like. Once that is not needed this method will be deprecated.

- $bd-\>run\_build\_task($build\_task, $binary\_task)

  Executes the build task for the build.

  **Note**: This is an optional method needed as long as we support building as root-like. Once that is not needed this method will be deprecated.

- $bd-\>run\_task($task)

  Executes the given task for the build.

## CHANGES

### Version 0.xx

This is a private module.
