Я работаю над преемником auto-apt, который индексирует информацию о пакете, используемую apt, и отслеживает запросы ввода-вывода файлов, содержащихся в этих пакетах, в качестве оболочки программы и автоматически устанавливает их.
] Поэтому я хотел бы знать, сколько пакетов в Ubuntu примерно одинаково (потенциал 10 достаточен), поэтому я могу провести некоторые оценки алгоритмической сложности.
Исходный код кажется неподдерживаемым для десятилетия, и автор недоступен по последнему знакомую адресу (я написал ему ~ год назад, но он не ответил). Похоже, что программа была выпущена из Ubuntu в 17.10. Кроме того, код является полным без комментариев и без тестов (никогда не делайте этого, пожалуйста!), И мне нужно угадать, какова цель древовидной структуры данных (может быть, проблема программирования) и могу ли я просто замените его быстрой реализацией стороннего ключевого значения.
Команда apt-file может использоваться для поиска, какой пакет предоставляет данный файл. Вам нужно запустить apt-file update, чтобы он мог загрузить список файлов, и:
$ apt-file update
apt-file is now using the user's cache directory.
If you want to switch back to the system-wide cache directory,
run 'apt-file purge'
Downloading complete file http://jp.archive.ubuntu.com/ubuntu/dists/xenial/Contents-amd64.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
9 31.7M 9 2927k 0 0 282k 0 0:01:54 0:00:10 0:01:44 481k
Таким образом, Contents-amd64.gz - это файл размером 31 МБ после сжатия. Открыв его в Vim, я вижу, что он имеет 5400831 строк, с примерно 30 строк в этом заголовке:
This file maps each file available in the Ubuntu
system to the package from which it originates. It includes packages
from the DIST distribution for the ARCH architecture.
You can use this list to determine which package contains a specific
file, or whether or not a specific file is available. The list is
updated weekly, each architecture on a different day.
When a file is contained in more than one package, all packages are
listed. When a directory is contained in more than one package, only
the first is listed.
The best way to search quickly for a file is with the Unix `grep'
utility, as in `grep <regular expression> CONTENTS':
$ grep nose Contents
etc/nosendfile net/sendfile
usr/X11R6/bin/noseguy x11/xscreensaver
usr/X11R6/man/man1/noseguy.1x.gz x11/xscreensaver
usr/doc/examples/ucbmpeg/mpeg_encode/nosearch.param graphics/ucbmpeg
usr/lib/cfengine/bin/noseyparker admin/cfengine
This list contains files in all packages, even though not all of the
packages are installed on an actual system at once. If you want to
find out which packages on an installed Debian system provide a
particular file, you can use `dpkg --search <filename>':
$ dpkg --search /usr/bin/dselect
dpkg: /usr/bin/dselect
FILE LOCATION
Итак, у нас есть:
Команда apt-file может использоваться для поиска, какой пакет предоставляет данный файл. Вам нужно запустить apt-file update, чтобы он мог загрузить список файлов, и:
$ apt-file update
apt-file is now using the user's cache directory.
If you want to switch back to the system-wide cache directory,
run 'apt-file purge'
Downloading complete file http://jp.archive.ubuntu.com/ubuntu/dists/xenial/Contents-amd64.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
9 31.7M 9 2927k 0 0 282k 0 0:01:54 0:00:10 0:01:44 481k
Таким образом, Contents-amd64.gz - это файл размером 31 МБ после сжатия. Открыв его в Vim, я вижу, что он имеет 5400831 строк, с примерно 30 строк в этом заголовке:
This file maps each file available in the Ubuntu
system to the package from which it originates. It includes packages
from the DIST distribution for the ARCH architecture.
You can use this list to determine which package contains a specific
file, or whether or not a specific file is available. The list is
updated weekly, each architecture on a different day.
When a file is contained in more than one package, all packages are
listed. When a directory is contained in more than one package, only
the first is listed.
The best way to search quickly for a file is with the Unix `grep'
utility, as in `grep <regular expression> CONTENTS':
$ grep nose Contents
etc/nosendfile net/sendfile
usr/X11R6/bin/noseguy x11/xscreensaver
usr/X11R6/man/man1/noseguy.1x.gz x11/xscreensaver
usr/doc/examples/ucbmpeg/mpeg_encode/nosearch.param graphics/ucbmpeg
usr/lib/cfengine/bin/noseyparker admin/cfengine
This list contains files in all packages, even though not all of the
packages are installed on an actual system at once. If you want to
find out which packages on an installed Debian system provide a
particular file, you can use `dpkg --search <filename>':
$ dpkg --search /usr/bin/dselect
dpkg: /usr/bin/dselect
FILE LOCATION
Итак, у нас есть:
Команда apt-file может использоваться для поиска, какой пакет предоставляет данный файл. Вам нужно запустить apt-file update, чтобы он мог загрузить список файлов, и:
$ apt-file update
apt-file is now using the user's cache directory.
If you want to switch back to the system-wide cache directory,
run 'apt-file purge'
Downloading complete file http://jp.archive.ubuntu.com/ubuntu/dists/xenial/Contents-amd64.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
9 31.7M 9 2927k 0 0 282k 0 0:01:54 0:00:10 0:01:44 481k
Таким образом, Contents-amd64.gz - это файл размером 31 МБ после сжатия. Открыв его в Vim, я вижу, что он имеет 5400831 строк, с примерно 30 строк в этом заголовке:
This file maps each file available in the Ubuntu
system to the package from which it originates. It includes packages
from the DIST distribution for the ARCH architecture.
You can use this list to determine which package contains a specific
file, or whether or not a specific file is available. The list is
updated weekly, each architecture on a different day.
When a file is contained in more than one package, all packages are
listed. When a directory is contained in more than one package, only
the first is listed.
The best way to search quickly for a file is with the Unix `grep'
utility, as in `grep <regular expression> CONTENTS':
$ grep nose Contents
etc/nosendfile net/sendfile
usr/X11R6/bin/noseguy x11/xscreensaver
usr/X11R6/man/man1/noseguy.1x.gz x11/xscreensaver
usr/doc/examples/ucbmpeg/mpeg_encode/nosearch.param graphics/ucbmpeg
usr/lib/cfengine/bin/noseyparker admin/cfengine
This list contains files in all packages, even though not all of the
packages are installed on an actual system at once. If you want to
find out which packages on an installed Debian system provide a
particular file, you can use `dpkg --search <filename>':
$ dpkg --search /usr/bin/dselect
dpkg: /usr/bin/dselect
FILE LOCATION
Итак, у нас есть:
В моей системе 17.10 у меня установлено 181 367 файлов и каталогов (этот номер отображается, например, всякий раз, когда вы apt install что-то) в 1360 пакетах (apt list --installed | wc -l).
В 17.10 (apt list | grep -c artful) имеется 58108 пакетов, поэтому, если мои установленные пакеты являются репрезентативными, это дает примерно 7 749 038 файлов и каталогов.
В моей системе 17.10 у меня установлено 181 367 файлов и каталогов (этот номер отображается, например, всякий раз, когда вы apt install что-то) в 1360 пакетах (apt list --installed | wc -l).
В 17.10 (apt list | grep -c artful) имеется 58108 пакетов, поэтому, если мои установленные пакеты являются репрезентативными, это дает примерно 7 749 038 файлов и каталогов.
В моей системе 17.10 у меня установлено 181 367 файлов и каталогов (этот номер отображается, например, всякий раз, когда вы apt install что-то) в 1360 пакетах (apt list --installed | wc -l).
В 17.10 (apt list | grep -c artful) имеется 58108 пакетов, поэтому, если мои установленные пакеты являются репрезентативными, это дает примерно 7 749 038 файлов и каталогов.