您可能想查看repoman,至少可以从中借鉴一些想法。
例如获取 deb 包信息,如https://github.com/synack/repoman#get-detailed-information-about-a-package-1
[
{
"SHA1": "cae8b9a4a821237a24b5757566efdc95391090d4",
"Maintainer": "Jeremy Grosser <synack@digg.com>",
"Description": "server-side, HTML-embedded scripting language (meta-package) This package is a meta-package that, when installed, guarantees that you have at least one of the four server-side versions of the PHP5 interpreter installed. Removing this package won't remove PHP5 from your system, however it may remove other packages that depend on this one. . PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly. . Homepage: http://www.php.net/",
"Package": "php5",
"Section": "web",
"MD5sum": "0efa615337f0ba59d8369e4469884730",
"Installed-Size": "20",
"Filename": "pool/main/p/php5/php5_5.2.9-digg8_all.deb",
"Priority": "normal",
"Depends": "libapache2-mod-php5 (>= 5.2.9-digg8) | php5-cgi (>= 5.2.9-digg8), php5-common (>= 5.2.9-digg8)",
"Version": "5.2.9-digg8",
"Architecture": "all",
"SHA256": "26844b968f6b51c1a02fd59c21455bf6ba47e46e47e53c6676af0ee4c2dd799b",
"Size": "1024"
}
]
代码https://github.com/synack/repoman/blob/master/repoman/repository.py#L187