具有非cadidate依赖关系的apt-get install特定版本

时间:2016-04-20 12:12:49

标签: debian apt

我想构建一个debian包,它有一个Build-Depends字段,其中有一个特定版本的库。我曾经做mk-build-deps -i然后dpkg-builpackage,但是当我指定构建依赖的特定版本时,我遇到了麻烦。

我已经构建了一个最小的可重复示例:

docker run -it --rm debian:jessie bash
apt-get update && apt-get install -y devscripts
mkdir -p /foo/debian
cd foo/
echo "foo (1.0.0) UNRELEASED; urgency=medium

  * Initial release. (Closes: #XXXXXX)

 -- anon  Wed, 20 Apr 2016 13:48:31 +0200" > debian/changelog

echo "Source: foo
Build-Depends:
 libc6-dev (=2.19-18+deb8u3)

Package: foo
Architecture: all" > debian/control

dpkg -l libc6     # returns 2.19-18+deb8u4
dpkg -l libc6-dev # returns 2.19-18+deb8u4

mk-build-deps -i # this fails to install the libc6-dev depedency, but actually the script returns 0 as return code

dpkg -l libc6     # returns 2.19-18+deb8u4
dpkg -l libc6-dev # returns 2.19-18+deb8u4 although it should return  2.19-18+deb8u3
apt-get install -y libc6-dev=2.19-18+deb8u3 # fails
apt-get install -y libc6-dev=2.19-18+deb8u3 libc6=2.19-18+deb8u3 libc-dev-bin=2.19-18+deb8u3 # this finally installs desired versions

但这是非常手工的工作。那么,apt-get install无法安装具有非候选依赖项的软件包吗?我可以使用其他工具吗?或者我必须为每个包手动执行此操作?

由于

更新了输出:

root@4f32a97063a2:/foo# dpkg -l libc6     # returns 2.19-18+deb8u4
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                          Version                     Architecture                Description
+++-=============================================-===========================-===========================-================================================================================================
ii  libc6:amd64                                   2.19-18+deb8u4              amd64                       GNU C Library: Shared libraries



root@4f32a97063a2:/foo# dpkg -l libc6-dev # returns 2.19-18+deb8u4
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                          Version                     Architecture                Description
+++-=============================================-===========================-===========================-================================================================================================
ii  libc6-dev:amd64                               2.19-18+deb8u4              amd64                       GNU C Library: Development Libraries and Header Files



root@4f32a97063a2:/foo# mk-build-deps -i # this fails to install the libc6-dev depedency, but actually the script returns 0 as return code
parsechangelog/debian: warning:     debian/changelog(l5): badly formatted trailer line
LINE:  -- anon  Wed, 20 Apr 2016 13:48:31 +0200
parsechangelog/debian: warning:     debian/changelog(l5): found eof where expected more change data or trailer
dh_testdir
dh_testroot
dh_prep
dh_testdir
dh_testroot
dh_install
dh_installdocs
dh_installchangelogs
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dpkg-deb: building package `foo-build-deps' in `../foo-build-deps_1.0.0_all.deb'.

The package has been created.
Attention, the package has been created in the current directory,
not in ".." as indicated by the message above!
Selecting previously unselected package foo-build-deps.
(Reading database ... 22567 files and directories currently installed.)
Preparing to unpack foo-build-deps_1.0.0_all.deb ...
Unpacking foo-build-deps (1.0.0) ...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
  foo-build-deps
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 2048 B disk space will be freed.
Do you want to continue? [Y/n] 
(Reading database ... 22571 files and directories currently installed.)
Removing foo-build-deps (1.0.0) ...


root@4f32a97063a2:/foo# dpkg -l libc6     # returns 2.19-18+deb8u4
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                          Version                     Architecture                Description
+++-=============================================-===========================-===========================-================================================================================================
ii  libc6:amd64                                   2.19-18+deb8u4              amd64                       GNU C Library: Shared libraries
root@4f32a97063a2:/foo# dpkg -l libc6-dev # returns 2.19-18+deb8u4 although it should return  2.19-18+deb8u3
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                          Version                     Architecture                Description
+++-=============================================-===========================-===========================-================================================================================================
ii  libc6-dev:amd64                               2.19-18+deb8u4              amd64                       GNU C Library: Development Libraries and Header Files



root@4f32a97063a2:/foo# apt-get install -y libc6-dev=2.19-18+deb8u3 # fails
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libc6-dev : Depends: libc6 (= 2.19-18+deb8u3) but 2.19-18+deb8u4 is to be installed
             Depends: libc-dev-bin (= 2.19-18+deb8u3) but 2.19-18+deb8u4 is to be installed
E: Unable to correct problems, you have held broken packages.



root@4f32a97063a2:/foo# apt-get install -y libc6-dev=2.19-18+deb8u3 libc6=2.19-18+deb8u3 libc-dev-bin=2.19-18+deb8u3 # this finally installs desired versions
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  glibc-doc locales
The following packages will be DOWNGRADED:
  libc-dev-bin libc6 libc6-dev
0 upgraded, 0 newly installed, 3 downgraded, 0 to remove and 0 not upgraded.
Need to get 6906 kB of archives.
After this operation, 2048 B of additional disk space will be used.
E: There are problems and -y was used without --force-yes
root@4f32a97063a2:/foo# apt-get install  libc6-dev=2.19-18+deb8u3 libc6=2.19-18+deb8u3 libc-dev-bin=2.19-18+deb8u3 # this finally installs desired versions
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  glibc-doc locales
The following packages will be DOWNGRADED:
  libc-dev-bin libc6 libc6-dev
0 upgraded, 0 newly installed, 3 downgraded, 0 to remove and 0 not upgraded.
Need to get 6906 kB of archives.
After this operation, 2048 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://security.debian.org/ jessie/updates/main libc6-dev amd64 2.19-18+deb8u3 [2003 kB]
Get:2 http://security.debian.org/ jessie/updates/main libc-dev-bin amd64 2.19-18+deb8u3 [237 kB]
Get:3 http://security.debian.org/ jessie/updates/main libc6 amd64 2.19-18+deb8u3 [4666 kB]
Fetched 6906 kB in 0s (14.8 MB/s)
debconf: delaying package configuration, since apt-utils is not installed
dpkg: warning: downgrading libc6-dev:amd64 from 2.19-18+deb8u4 to 2.19-18+deb8u3
(Reading database ... 22567 files and directories currently installed.)
Preparing to unpack .../libc6-dev_2.19-18+deb8u3_amd64.deb ...
Unpacking libc6-dev:amd64 (2.19-18+deb8u3) over (2.19-18+deb8u4) ...
dpkg: warning: downgrading libc-dev-bin from 2.19-18+deb8u4 to 2.19-18+deb8u3
Preparing to unpack .../libc-dev-bin_2.19-18+deb8u3_amd64.deb ...
Unpacking libc-dev-bin (2.19-18+deb8u3) over (2.19-18+deb8u4) ...
dpkg: warning: downgrading libc6:amd64 from 2.19-18+deb8u4 to 2.19-18+deb8u3
Preparing to unpack .../libc6_2.19-18+deb8u3_amd64.deb ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
Unpacking libc6:amd64 (2.19-18+deb8u3) over (2.19-18+deb8u4) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libc6:amd64 (2.19-18+deb8u3) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
Setting up libc-dev-bin (2.19-18+deb8u3) ...
Setting up libc6-dev:amd64 (2.19-18+deb8u3) ...
Processing triggers for libc-bin (2.19-18+deb8u4) ...

0 个答案:

没有答案