是否忽略特定未满足的依赖关系?

是否忽略特定未满足的依赖关系?

这是我的情况:我通过 deb 包“强制”安装了一个名为 的程序ipe;原因是ipe依赖于,但是我已经通过texlive-latex-base维护了 的单独安装。但是,这种 的安装没有问题,只要我记得从终端运行它,这对我来说很好。latextlmgripe

问题是,这个破坏的依赖关系现在不允许我安装完全不相关的软件包 - 在本例中是dropbox:

$ sudo apt-get install dropbox
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 ipe : Depends: texlive-latex-base but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

现在,如果我尝试-f install,它将尝试修复ipe安装,这就是我所做的不是想。

事实证明,aptitude它似乎可以提供一种忽略/跳过这种依赖关系的方法:

$ sudo aptitude install dropbox
The following NEW packages will be installed:
  dropbox 
The following partially installed packages will be configured:
  ipe{b} 
0 packages upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 93,0 kB of archives. After unpacking 410 kB will be used.
The following packages have unmet dependencies:
  ipe: Depends: texlive-latex-base but it is not going to be installed.
The following actions will resolve these dependencies:

     Remove the following packages:
1)     ipe                         



Accept this solution? [Y/n/q/?] 1
Action "1": Removing ipe

Package: ipe
State: unpacked
Automatically installed: no
Version: 7.0.10-2
Priority: optional
...

This action was selected because ipe depends upon texlive-latex-base.

Enter "r 1" to prevent this action from appearing in new solutions.
Enter "a 1" to require that new solutions include this action if possible.

Accept this solution? [Y/n/q/?] r 1
Rejecting the removal of ipe
The following actions will resolve these dependencies:

     Remove the following packages:
1) R   ipe                         



Accept this solution? [Y/n/q/?] y
The following NEW packages will be installed:
  dropbox 
The following packages will be REMOVED:
  ipe{a} 
0 packages upgraded, 1 newly installed, 1 to remove and 1 not upgraded.
Need to get 93,0 kB of archives. After unpacking 5.034 kB will be freed.
Do you want to continue? [Y/n/?] n
Abort.

奇怪的是:即使我指定r 1- 并且程序实际上用“ Rejecting the removal of ipe”确认 - 我仍然The following packages will be REMOVED最后得到“ ”,这就是我具体做的不是想做什么?(顺便说一句,我也尝试过a 1,最终结果完全相同,“...将被删除”,尽管这是我期望该选择的操作)。

我哪里做错了?我误解了他们所说的“新解决方案”吗?有没有办法让 apt/aptitude 系统知道,我宁愿它忽略(在本例中)未满足的依赖关系ipe

答案1

编辑:好的,如下所示,“拒绝删除......”功能aptitude不起作用 - 但这对我来说确实有效......

例如,在查找时Package: ipe,可能会找到如下文件:

$ grep -r 'Package: ipe' /var/lib/apt/lists/
...
/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_natty_universe_binary-i386_Packages:Package: ipe
...
/var/lib/apt/lists/old-releases.ubuntu.com_ubuntu_dists_natty_universe_binary-i386_Packages:Package: ipe
...

...然而,这些都是不正确的 - 显然,等的运行时信息apt-get存储在/var/lib/dpkg/status(通过尝试更新时,如何修复“MergeList 存在问题”或“无法解析状态文件”错误?)。

因此,我通过 打开该文件sudo nano /var/lib/dpkg/status,查找“Package: ipe”,然后尝试注释texlive-latex-base“Depends:”部分 - 首先将其放在单独的行中,然后用数字符号/井号注释它#。请注意,这确实不是工作——首先你会得到如下错误:

dpkg: error: parsing file '/var/lib/dpkg/status' near line 8140 package 'ipe':
 field name `#,' must be followed by colon
E: Sub-process /usr/bin/dpkg returned an error code (2)

...然后如果您尝试添加冒号,如#:,您将得到:

dpkg: error: parsing file '/var/lib/dpkg/status' near line 8141 package 'ipe':
 user-defined field name `#' too short
E: Sub-process /usr/bin/dpkg returned an error code (2)

显然,这些文件没有使用注释;它们似乎记录在Debian 政策手册 - 控制文件及其字段.然后我发现:

#353040 - [DPKG-DEB] 不要对 DEBIAN/control 中的用户定义字段太过关心 - Debian 错误报告日志

在 .deb 中包含字段的正确方法是使用名为“XB-*”的字段。

...所以,基本上,我没有使用注释字符来“注释掉” - 而是使用了一个用户定义的字段,我任意称之为XB-Ignore:;所以那部分/var/lib/dpkg/status最终看起来像这样:

Package: ipe
...
Depends: libc6 (>= 2.4), libcairo2 (>= 1.2.4), libgcc1 (>= 1:4.1.1), libipe7.0.10, liblua5.1-0, libqtcore4 (>= 4:4.6.$
XB-Ignore: , texlive-latex-base, gsfonts
...

保存此更改后,我可以直接使用以下命令执行安装apt-get,不会出现问题:

$ sudo apt-get install dropbox
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  python-gpgme
The following NEW packages will be installed:
  dropbox
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
Need to get 0 B/93,0 kB of archives.
After this operation, 410 kB of additional disk space will be used.
Selecting previously deselected package dropbox.
...
Setting up dropbox (1.6.1) ...
Processing triggers for menu ...

我只想指出,这/var/lib/dpkg/status不是一个持久文件 - 事实上,就在之后apt-get install,如果您再次检查该文件,Depends:XB-Ignore:将不再位于相邻的行上(因为它们原来是这样的,如上面的代码片段所示)!


虽然忽略未满足的依赖关系的问题仍然悬而未决,但事实证明我做过aptitude误解了这些“新解决方案”的含义:如果您对“是否接受此解决方案?”问题回答“否”,则这些新解决方案就是您可选择的方案:

...
The following packages have unmet dependencies:
  ipe: Depends: texlive-latex-base but it is not going to be installed.
The following actions will resolve these dependencies:

     Remove the following packages:
1)     ipe                         


Accept this solution? [Y/n/q/?] r 1
Rejecting the removal of ipe
The following actions will resolve these dependencies:

     Remove the following packages:
1) R   ipe                         


Accept this solution? [Y/n/q/?] n                      # <==== here not accepting above solution
The following actions will resolve these dependencies: # <==== new solution offered here:

      Install the following packages:           
1)      lmodern [2.004.1-3 (natty)]             
2)      luatex [0.65.0-1ubuntu3 (natty)]        
3)      tex-common [2.09 (natty)]               
4)      texlive-base [2009-11 (natty)]          
5)      texlive-binaries [2009-8ubuntu2 (natty)]
6)      texlive-common [2009-11 (natty)]        
7)      texlive-doc-base [2009-2 (natty)]       
8)      texlive-latex-base [2009-11 (natty)]    
9)      texlive-latex-base-doc [2009-11 (natty)]
10)     texlive-luatex [2009-11 (natty)]        

Accept this solution? [Y/n/q/?] r 1
Rejecting the installation of lmodern version 2.004.1-3 (natty)
The following actions will resolve these dependencies:

      Install the following packages:           
1)  R   lmodern [2.004.1-3 (natty)]             
2)      luatex [0.65.0-1ubuntu3 (natty)]        
...

Accept this solution? [Y/n/q/?] r 10
Rejecting the installation of texlive-luatex version 2009-11 (natty)
The following actions will resolve these dependencies:

      Install the following packages:           
1)  R   lmodern [2.004.1-3 (natty)]             
2)  R   luatex [0.65.0-1ubuntu3 (natty)]        
3)  R   tex-common [2.09 (natty)]               
4)  R   texlive-base [2009-11 (natty)]          
5)  R   texlive-binaries [2009-8ubuntu2 (natty)]
6)  R   texlive-common [2009-11 (natty)]        
7)  R   texlive-doc-base [2009-2 (natty)]       
8)  R   texlive-latex-base [2009-11 (natty)]    
9)  R   texlive-latex-base-doc [2009-11 (natty)]
10) R   texlive-luatex [2009-11 (natty)]        


Accept this solution? [Y/n/q/?] n
*** No more solutions available ***

The following actions will resolve these dependencies:

      Install the following packages:           
1)  R   lmodern [2.004.1-3 (natty)]             
2)  R   luatex [0.65.0-1ubuntu3 (natty)]        
3)  R   tex-common [2.09 (natty)]               
4)  R   texlive-base [2009-11 (natty)]          
5)  R   texlive-binaries [2009-8ubuntu2 (natty)]
6)  R   texlive-common [2009-11 (natty)]        
7)  R   texlive-doc-base [2009-2 (natty)]       
8)  R   texlive-latex-base [2009-11 (natty)]    
9)  R   texlive-latex-base-doc [2009-11 (natty)]
10) R   texlive-luatex [2009-11 (natty)]        


Accept this solution? [Y/n/q/?] y
The following NEW packages will be installed:
  dropbox lmodern{a} luatex{a} tex-common{a} texlive-base{a} texlive-binaries{a} texlive-common{a} 
  texlive-doc-base{a} texlive-latex-base{a} texlive-latex-base-doc{a} texlive-luatex{a} 
The following partially installed packages will be configured:
  ipe 
0 packages upgraded, 11 newly installed, 0 to remove and 1 not upgraded.
Need to get 87,4 MB of archives. After unpacking 181 MB will be used.
Do you want to continue? [Y/n/?] n
Abort.

所以是的 - 如果我继续拒绝所有解决方案,最后我会得到“*** 没有更多可用的解决方案 ***”,并且aptitude可以采用这些解决方案,或者中止 - 但不幸的是不能用这种技术忽略它们......

相关内容