2013-05-15 2 views
2

로컬 .deb 파일과 원격 리포지토리를보고 종속성 등을 추론하여 자신의 리포지토리와 부분 미러 (아마도 reprepro의 구성 파일을 만들어서)를 만들 수 있기를 원합니다.파이썬에서 데비안 패키지 저장소를 쿼리하고 관리하는 방법은 무엇입니까?

도전 과제는 (apt-rdepends 등) 많은 도움을주는 명령 줄 도구가 대상 시스템에서 실행 중이며 로컬 APT 캐시를 사용한다고 가정하는 반면, 현재 실행중인 다른 Ubuntu 및 Debian 배포본을 처리하기 때문에 좀 더 편하게 해보고 싶습니다.

실용적이지만 문서화가 잘 안되는 python-apt 패키지를 사용하면 로컬 파일 시스템에서 .deb 파일을 검사하고 종속성을 제거 할 수 있습니다. 저장소에서 Packages.gz 파일을 구문 분석하는 비슷한 도구가 있는지 궁금합니다. (너무 까다 롭지는 않지만 휠을 재발 명하고 싶지는 않습니다!)

전반적인 목표는 두 개의 저장소를 생성하고 유지하는 것입니다 : 우리 자신의 패키지가있는 하나의 패키지와 우분투 배포판의 부분 미러 알려진 필수 패키지와 그 자체 또는 우리 자신의 패키지가 의존하는 패키지.

답변

0

매우 효과적인 방법은 모든 관련 배포판에 대해 로컬 aptap 캐시를 만드는 것입니다. devscripts 패키지의 chdist 도구를 사용하면 루트 권한 없이도 여러 가지 캐시를 만들 수 있습니다. 그런 다음 사용하는 도구 (예 : apt-rdepends)를 사용하여 캐시를 chdist에 래핑하여 쿼리 할 수 ​​있습니다. rootdir 키워드 인수를 apt.cache.Cache으로 사용하여 로컬 캐시에서 python-apt를 가리킬 수도 있습니다. 그러면 종속성을 해결할 수 있습니다.

0

repoman을 확인해보고 최소한 아이디어를 빌릴 수 있습니다.

예. https://github.com/synack/repoman#get-detailed-information-about-a-package-1

[ 
{ 
    "SHA1": "cae8b9a4a821237a24b5757566efdc95391090d4", 
    "Maintainer": "Jeremy Grosser <[email protected]>", 
    "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