如何在 aptcache 中添加 apt-utils 以便cowbuilder/pbuilder 可以使用它?

如何在 aptcache 中添加 apt-utils 以便cowbuilder/pbuilder 可以使用它?

我正在跑步cowbuilder --update并得到以下信息 -

$ sudo cowbuilder --update
[sudo] password for shirish: 
I: Copying COW directory
I: forking: rm -rf /var/cache/pbuilder/build/cow.12496
I: forking: cp -al /var/cache/pbuilder/sid-amd64/base.cow /var/cache/pbuilder/build/cow.12496
I: removed stale ilistfile /var/cache/pbuilder/build/cow.12496/.ilist
I: Invoking pbuilder
I: forking: pbuilder update --buildplace /var/cache/pbuilder/build/cow.12496 --mirror http://deb.debian.org/debian/ --distribution sid --no-targz --internal-chrootexec 'chroot /var/cache/pbuilder/build/cow.12496 cow-shell'
I: Running in no-targz mode
I: Current time: Sun Sep  2 01:16:22 IST 2018
I: pbuilder-time-stamp: 1535831182
I: copying local configuration
W: --override-config is not set; not updating apt.conf Read the manpage for details.
I: mounting /proc filesystem
I: mounting /sys filesystem
I: creating /{dev,run}/shm
I: mounting /dev/pts filesystem
I: redirecting /dev/ptmx to /dev/pts/ptmx
I: policy-rc.d already exists
I: Refreshing the base.tgz 
I: upgrading packages
Get:1 http://cdn-fastly.deb.debian.org/debian sid InRelease [233 kB]
Get:2 http://cdn-fastly.deb.debian.org/debian sid/main amd64 Packages.diff/Index [27.9 kB]
Get:3 http://cdn-fastly.deb.debian.org/debian sid/main amd64 Packages 2018-09-01-1408.47.pdiff [11.0 kB]
Get:3 http://cdn-fastly.deb.debian.org/debian sid/main amd64 Packages 2018-09-01-1408.47.pdiff [11.0 kB]
Fetched 272 kB in 3s (97.6 kB/s)
Reading package lists...
I: Obtaining the cached apt archive contents
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following packages will be upgraded:
  libidn2-0
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 76.4 kB of archives.
After this operation, 120 kB of additional disk space will be used.
Get:1 http://cdn-fastly.deb.debian.org/debian sid/main amd64 libidn2-0 amd64 2.0.5-1 [76.4 kB]
Fetched 76.4 kB in 1s (79.8 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 11986 files and directories currently installed.)
Preparing to unpack .../libidn2-0_2.0.5-1_amd64.deb ...
Unpacking libidn2-0:amd64 (2.0.5-1) over (2.0.4-2.2) ...
Setting up libidn2-0:amd64 (2.0.5-1) ...
Processing triggers for libc-bin (2.27-5) ...
Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
aptitude is already the newest version (0.8.10-9).
build-essential is already the newest version (12.5).
dpkg-dev is already the newest version (1.19.0.5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
I: Copying back the cached apt archive contents
I: new cache content 'libidn2-0_2.0.5-1_amd64.deb' added
I: unmounting dev/ptmx filesystem
I: unmounting dev/pts filesystem
I: unmounting dev/shm filesystem
I: unmounting proc filesystem
I: unmounting sys filesystem
I: removing cowbuilder working copy
I: Moving work directory [/var/cache/pbuilder/build/cow.12496] to final location [/var/cache/pbuilder/sid-amd64/base.cow] and cleaning up old copy
I: forking: rm -rf /var/cache/pbuilder/build/cow.12496-12496-tmp

现在在 /var/cache/pbuilder 中我得到以下目录 -

/var/cache/pbuilder$ ls
aptcache  build  result  sid-amd64

现在,我从一点点了解到 aptcache 具有可能需要的 .deb 软件包,build正在构建软件包的位置,result成功构建软件包的位置,以及sid-amd64需要这些软件包进行软件包构建的 base.cow 或最小 Debian 发行版的位置那里。 IIUC,那么随着新软件包的构建,aptcache 和 base.cow 都会随着时间的推移而变胖。

我的这种理解正确吗?

如果是,我该如何添加 apt-utils aptcache以及base.cow

请参阅之前分享的操作中的这一行 -

debconf: delaying package configuration, since apt-utils is not installed. 

更新 - 02/09/18 -

我尝试了以下方法 -

$ sudo pbuilder --autocleanaptcache
pbuilder - a personal builder
Copyright 2001-2007 Junichi Uekawa
Distributed under GNU Public License version 2 or later

pbuilder [operation] [pbuilder-options]
pdebuild [pdebuild-options] -- [pbuilder-options]
........

由于某种原因,该命令似乎不起作用,要么我拼写错误,要么它需要显式路径才能使命令起作用。

在此之前我确实尝试过$cowbuilder ----autocleanaptcache,但即使如此也没有得到任何结果。

最后我不得不去 -

$ sudo pbuilder clean
I: Cleaning [/var/cache/pbuilder/build]
I: removing directory /var/cache/pbuilder/build and its subdirectories
I: Cleaning [/var/cache/pbuilder/aptcache/]
shirish@debian:~$ cd /var/cache/pbuilder/aptcache/

答案1

IIUC,那么随着新软件包的构建,aptcache 和 base.cow 都会随着时间的推移而变胖。

APT 缓存会,但您应该使用clean命令 (pbuilder cleancowbuilder clean) 或--autocleanaptcache选项(与命令一起使用,例如 pbuilder update --autocleanaptcache)。基础镜像仅反映基础 Debian 安装;构建所需的软件包仅安装在用于构建的副本中,而不是安装在基础映像中。 (我使用pbuilder update --autocleanaptcache在所有基础映像上运行的每日 cron 作业。)

pbuilder login --save-after-login要在基础映像中安装附加包,您可以使用或“登录”映像cowbuilder login --save-after-login,进行更改并退出。然而,这不是一个好主意,因为它改变了包构建的期望。特别是apt-utils,您可以忽略该debconf警告 - 它只是抱怨缺少apt-extracttemplates,这意味着无法预先配置包(使用dpkg-preconfigure),但必须在安装过程中进行配置。由于构建运行的方式,这没有影响。

相关内容