Fakeroot-ng runs a program while fooling it into thinking it is running with root privileges. When the program does something that only root can do (e.g. create a device file), fakeroot-ng emulates the appropriate system calls so that the program gets a consistent view of its actions. Unlike the original fakeroot, fakeroot-ng uses the ptrace interface, which means that it does not suffer some of the limitations that fakeroot does. In particular, fakeroot-ng supports chroot jails.
The 64 Studio Platform Development Kit (PDK) is a version control system for GNU/Linux distributions, allowing the creation and management of many different projects, based on Debian and Ubuntu sources. PDK is written in Python, and the source code is well commented and contains documented examples.