简体   繁体   中英

How to automatically satisfy dependencies in “.dsc” files while building debian package from source?

When I download some package sources, (eg foo-[ver].orig.tar.gz, foo-[ver].dsc), I often encounter dependencies problem while using dpkg-source -x foo-[ver].dsc and dpkg-buildpackage -us -uc ... . In this case, I have to install the building dependencies one by one. Is there some tool to automatically handle this case, eg, dpkg-source-dependencies -x foo-[ver].dsc ?

When trying to build a package the following should grab all dependencies:

apt-get build-dep [package-name]

Also, apt-get can compile source packages if needs be:

apt-get --build [package-name]

There are several ways to go about this (as seen from the other replies). For a package that is already part of a repository, you can simply use:

apt-get build-dep pkgname

For local packages, one of:

apt-get build-dep source-dir/
apt-get build-dep source-name.dsc
/usr/lib/pbuilder/pbuilder-satisfydepends* --control source-name.dsc
mk-build-deps --install source-name.dsc
pbuilder build source-name.dsc
sbuild source-name.dsc

There are probably other solutions, but the above are the most widely used.

pbuilder is just the tool for this job. pbuilder will set up a minimal distribution in a tarball upon install. For building a .dsc file, you supply the file and pbuilder unzips the tarball, chroot s, installs all necessary build dependencies and compiles the package. As a result of this procedure, your build result is independent from the current configuration of the host machine.

I'm extracting the Build-Depends from debian/control and afterwards install them with apt. A few standard packages are not mentioned as Build-Depends (eg build-essentials) and required silently from debuild.

pkgs=$(grep Build-Depends debian/control|sed 's/^Build-Depends: //g)
pkgs=$(echo $pkgs|sed "s/[() ]//g"|tr "," " ")
apt-get install $pkgs build-essential

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM