如何強制 apt-get source 取得您要求的套件

如何強制 apt-get source 取得您要求的套件
$ apt-get source libtiff4
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Picking 'tiff3' as source package instead of 'libtiff4'
E: Unable to find a source package for tiff3

如果我添加 -f,它不會改變行為。是什麼導致它這樣做以及如何強制它下載我想要的包?

根據搜索,我什至不知道它從哪裡得到 tiff3 的想法

$ apt-cache search libtiff
libtiff-doc - TIFF manipulation and conversion documentation
libtiff-tools - TIFF manipulation and conversion tools
libtiff5 - Tag Image File Format (TIFF) library
libtiff5-alt-dev - Tag Image File Format library (TIFF), alternative development files
libtiff5-dev - Tag Image File Format library (TIFF), development files
libtiffxx5 - Tag Image File Format (TIFF) library -- C++ interface
gem-plugin-tiff - Graphics Environment for Multimedia - TIFF support
libtiff-opengl - TIFF manipulation and conversion tools
libtiff4 - Tag Image File Format (TIFF) library (old version)
libtiff4-dev - Tag Image File Format (TIFF) library (old version), development files
libtiffxx0c2 - Tag Image File Format (TIFF) library (old version) -- C++ interface
pngtools - series of tools for PNG (Portable Network Graphics) images
python-libtiff - wrapper to the libtiff library to Python using ctypes

答案1

二進位包與其對應的源碼包之間不存在一一對應的關係。其原因包括:

  • 在某些情況下,多個二進位包將從單一來源派生
  • 名稱將略有不同,以反映二進制包的版本控制
  • 有些套件不直接包含二進位文件,而是僅指定應安裝的依賴套件。

我無法重現您的特定問題,可能是因為我安裝了較新版本的 Ubuntu。以下是使用類似程式庫的類似問題的演練(請注意,我的範例中的所有內容都已安裝,但顯示的有關映射和依賴項的資訊仍然相關)。這應該為如何處理此類問題提供一些很好的提示。

我已經成功安裝了一個名為libjpeg8

$ sudo apt-get install libjpeg8
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libjpeg8 is already the newest version.

我嘗試獲取原始程式碼,但它被重新映射到帶有後綴的內容-empty

$ apt-get source libjpeg8
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Picking 'libjpeg8-empty' as source package instead of 'libjpeg8'
Skipping unpack of already unpacked source in libjpeg8-empty-8c

我列出了所需包的依賴項,並注意libjpeg-turbo8

$ apt-cache depends libjpeg8
libjpeg8
  Depends: libjpeg-turbo8
  Replaces: libjpeg8:i386
  Breaks: libjpeg8:i386

我安裝了 的源代碼libjpeg-turbo8,並得到了我需要的源代碼:

$ apt-get source libjpeg-turbo8
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Picking 'libjpeg-turbo' as source package instead of 'libjpeg-turbo8'
Skipping unpack of already unpacked source in libjpeg-turbo-1.3.0

答案2

確保您在“軟體和更新”中標記了“原始程式碼”條目。

軟體和更新截圖

如果沒有,請選中它並打開終端並:

sudo apt-get update

(如果您在勾選了「如果不是」後出現一個對話框,要求您重新載入套件列表,那麼您可能不需要執行此操作),然後執行以下操作:

apt-get source libtiff4-dev

取得 libtiff4 的源碼。

相關內容