dpkg-buildtree(1)

πŸ’… dpkg-buildtree β€” bestie's guide ✨

okay so real talk, this is the dpkg-buildtree manual page from the dpkg suite, and it's actually so much simpler than it looks. it's a helper for build tree operations during package builds. let me walk you through it 🫢


✨ NAME ✨

dpkg-buildtree β€” helper for build tree operations during package builds

like, the ultimate little sidekick for your build tree. no cap πŸ’–


🌸 SYNOPSIS 🌸

dpkg-buildtree [option...] [command]

that's it. options, then a command. iconic and minimal πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so dpkg-buildtree is a tool that performs common operations on the build tree for a source package. that's the whole vibe β€” it does the recurring chores so you don't have to think about them 🧹✨

this program was introduced in dpkg 1.22.3. mark your calendars bestie πŸŽ€

πŸ‘‘ COMMANDS πŸ‘‘

here's where it gets fun. pick your fighter:

  • clean β€” removes all artifacts generated during a build by the various dpkg tools, plus pathnames used or controlled by dpkg tools that are safe to clean. ngl these files are used to track state between package build runs, and in many cases they're straight-up internal implementation details the packager should not be concerned about, or they're staging directories containing build artifacts. so yeah β€” it yeets all of that πŸ—‘οΈπŸ’¨
  • is-rootless β€” checks whether the build tree can be built with no root privileges. the way this one is designed to be safe though?? you can use it safely even with versions where the command was not yet available, because the default will then be the historic one where root was required. so no breaking πŸ’€βœ¨
supported since dpkg 1.22.12 🫢
  • --help β€” show the usage message and exit. your classic escape hatch πŸ™ˆ
  • --version β€” show the version and exit. slay, show me the lore ⭐

🌈 ENVIRONMENT 🌈

  • DPKG_COLORS β€” sets the color mode. the currently accepted values are: auto (default), always and never. yes bestie, you can force the rainbow πŸŒˆπŸ’–
  • DPKG_NLS β€” if set, it will be used to decide whether to activate Native Language Support, also known as internationalization (or i18n) support. the accepted values are: 0 and 1 (default). global girlie behavior 🌍✨

πŸŽ€ FILES πŸŽ€

🧺 Cleaned files

  • debian/files
  • debian/files.new

β†’ files generated by dpkg-distaddfile(1). cute, but they get cleaned πŸ’…

  • debian/substvars
  • debian/substvars.new

β†’ files generated by dpkg-shlibdeps(1). also getting cleaned, sorry babes 🫢

  • debian/tmp

β†’ staging directory containing the contents to be used when creating a package. both dpkg-gencontrol(1) and dpkg-gensymbols(1) generate files within. so it's like the communal closet of the build and clean empties it πŸšͺ✨


πŸ’œ EXAMPLES πŸ’œ

🧚 Usage in debian/rules

okay so you can call dpkg-buildtree clean from the debian/rules clean target, after having performed other necessary cleanups. order matters bestie, do the other stuff first πŸ”₯

for example, for an autoconf-like build system:

clean:
    [ ! -f Makefile ] || $(MAKE) distclean
    dpkg-buildtree clean

see? distclean if there's a Makefile, then dpkg-buildtree clean. chef's kiss 🀌🌸


and that's the whole page, bestie. go forth and clean responsibly πŸ’–βœ¨

dpkg-buildtree(1) β€” dpkg suite, version 1.23.11-dirty, dated 2026-09-09. periodt. πŸ’…πŸ‘‘
πŸ“¦ where this page comes from