Just to toot my own horn, I have creating a solution for this exact circumstance. You can have a Debian package downloaded, unpacked, built, and reinstalled in 2 or 3 commands.
It is a shell script debtool and is available on GitHub via the aforementioned link.
Building Debian packages from source can be cumbersome, especially on a daily driver that you don't necessarily want to muddle up with numerous build dependencies and the like.
Assuming libvirt is available via sources, run the following command:
debtool --download --unpack libvirt
The above command just downloaded the libvirt_0.9.8_all.deb file and unpacked it into the directory libvirt_0.9.8_all.
Alternatively, you can unpack the version of libvirt that is currently installed on your system:
debtool --unpack libvirt
At this point you should make all of your changes to the files in the directory. You will also likely want to bump up the package's version number (i.e. 0.9.8-custom1) located in ./libvirt_0.9.8_all/DEBIAN/control.
Now build the package by running the following command:
debtool --build ./libvirt_0.9.8_all
Your finished package is now in the current directory as libvirt_0.9.8-custom1_all.deb.
You can quickly reinstall this package by running
debtool --reinst ./libvirt_0.9.8-custom1_all.deb or alternatively
debtool --build --reinst ./libvirt_0.9.8_all to build and reinstall in one fell swoop.
You can do a couple of other related tasks with debtool as well.
Show Available Versions
If there are several versions of a package available in the repositories, you can list them as follows:
debtool --show zsh
The above command will return the following:
zsh 5.0.5-4ubuntu1~ubuntu14.04.1 amd64
zsh 5.0.2-3ubuntu6 amd64
If you'd like to download the packages manually then you can use the
debtool --show --show-format zsh
Will return the following:
apt-get download zsh=5.0.5-4ubuntu1~ubuntu14.04.1 -a=amd64
apt-get download zsh=5.0.2-3ubuntu6 -a=amd64
Download Debian Archives
You can download the most recent version of a package as follows:
debtool --download zsh
You can download a specific version as follows:
debtool --download zsh=5.0.2-3ubuntu6
You can unpack a package on your hard drive:
debtool --unpack package.deb
You can also unpack a package that is currently installed on your system:
debtool --unpack package
If you have made changes to any of the installed files, they will be incorporated as well. This is perfect if you want to work with a package that is no longer available from sources or if you want to incorporate pre-existing fixes into a 'patched' deb.