将 Debian 包固定到存储库和版本的正确语法是什么?

将 Debian 包固定到存储库和版本的正确语法是什么?

我正在尝试从 snapshot.debian.org 安装以前版本的 subversion,如中所述如何安装以前版本的 .deb 包并固定它?。我已经设置了存储库和固定,我认为这是正确的,但它没有按我的预期工作,如输出apt-cache-policy所示。其中的错误在哪里呢?

/etc/apt/sources.list.d/snapshots.list

# snapshots.debian.org                                          
# added for subversion 1.9.2 subversion bug #803725             
deb http://snapshot.debian.org/archive/debian unstable main 

/etc/apt/preferences.d/subversion

Package: subversion
Pin: origin snapshot.debian.org
Pin: version 1.9.2-1
Pin-Priority: 700

apt-cache policy subversion

subversion:
  Installed: (none)
  Candidate: 1.9.2-3
  Package pin: (not found)
  Version table:
     1.9.2-3 700
        500 http://http.debian.net/debian/ unstable/main amd64 Packages

答案1

我认为问题是你不能直接使用 snapshot.debian.org 作为软件包的来源。要查看此内容,请从该站点选择一个 URL 作为sources.list 中的源,例如,

deb http://snapshot.debian.org/archive/debian/20151018T155352Z/ testing main
deb-src http://snapshot.debian.org/archive/debian/20151018T155352Z/ testing main

(注释掉其他设置),然后做

apt-get update

强制它使用仅有的该来源(如将 Debian 上的某些软件包降级并强制为以前的版本)。当我这样做时,我得到

$ apt-get update
Hit http://snapshot.debian.org testing InRelease
E: Release file for http://snapshot.debian.org/archive/debian/20151018T155352Z/dists/testing/InRelease is expired (invalid since 16d 9h 47min 8s). Updates for this repository will not be applied.

这是 1.9.2-2 发布之前的最后一个快照。相反,在邮件列表回复中找到回复:在 Stretch 上更新后 Plasma 5 无法启动马蒂亚斯·博登宾德 (Matthias Bodenbinder) 提出,

  • 下载需要的特定版本
  • 安装软件包,即使用dpkg
  • 别针(现在安装的)包(他的示例不使用起源)。

为了测试这些说明,我使用了 subversion_1.9.1-1 初始版本中的以下链接:

并安装它们:

$ dpkg -i libsvn1_1.9.1-1_amd64.deb subversion-tools_1.9.1-1_amd64.deb subversion_1.9.1-1_amd64.deb
dpkg: warning: downgrading libsvn1:amd64 from 1.9.2-2 to 1.9.1-1
(Reading database ... 371500 files and directories currently installed.)
Preparing to unpack libsvn1_1.9.1-1_amd64.deb ...
Unpacking libsvn1:amd64 (1.9.1-1) over (1.9.2-2) ...
Preparing to unpack subversion-tools_1.9.1-1_amd64.deb ...
Unpacking subversion-tools (1.9.1-1) over (1.9.1-1) ...
Preparing to unpack subversion_1.9.1-1_amd64.deb ...
Unpacking subversion (1.9.1-1) over (1.9.1-1) ...
Setting up libsvn1:amd64 (1.9.1-1) ...
Setting up subversion (1.9.1-1) ...
Setting up subversion-tools (1.9.1-1) ...
Processing triggers for libc-bin (2.19-22) ...
Processing triggers for man-db (2.7.4-1) ...

那么(在/etc/apt/preferences.d/subversion):

Package: libsvn1
Pin: version 1.9.1-1
Pin-Priority: 1000

Package: subversion-tools
Pin: version 1.9.1-1
Pin-Priority: 1000

Package: subversion
Pin: version 1.9.1-1
Pin-Priority: 1000

最后

$ apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://ftp.us.debian.org/debian/ testing-updates/main Translation-en
 500 http://ftp.us.debian.org/debian/ testing-updates/main amd64 Packages
     release o=Debian,a=testing-updates,n=stretch-updates,l=Debian,c=main
     origin ftp.us.debian.org
 500 http://security.debian.org/ testing/updates/main Translation-en
 500 http://security.debian.org/ testing/updates/main amd64 Packages
     release o=Debian,a=testing,n=stretch,l=Debian-Security,c=main
     origin security.debian.org
 500 http://ftp.us.debian.org/debian/ testing/main Translation-en
 500 http://ftp.us.debian.org/debian/ testing/main amd64 Packages
     release o=Debian,a=testing,n=stretch,l=Debian,c=main
     origin ftp.us.debian.org
Pinned packages:
     subversion -> 1.9.1-1
     libsvn1 -> 1.9.1-1
     subversion-tools -> 1.9.1-1

相关内容