mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-14 00:21:08 +00:00
404main changes
This commit is contained in:
parent
53cef1a285
commit
8a518715e0
58
404main
58
404main
@ -31,7 +31,7 @@ def find_main(pack):
|
||||
global packages
|
||||
|
||||
# Retrieve information about the package
|
||||
out = subprocess.Popen('apt-cache madison ' + pack + ' | grep hardy | grep -m 1 Packages', shell=True, stdout=subprocess.PIPE).stdout.read()
|
||||
out = subprocess.Popen('apt-cache madison ' + pack + ' | grep ' + distro + ' | grep -m 1 Packages', shell=True, stdout=subprocess.PIPE).stdout.read()
|
||||
|
||||
if out.find("/main") != -1:
|
||||
packages[pack] = True
|
||||
@ -41,12 +41,12 @@ def find_main(pack):
|
||||
packages[pack] = False
|
||||
|
||||
# Retrive package dependencies
|
||||
deps = subprocess.Popen("apt-cache show " + pack + " | grep -m 1 ^Depends", shell=True, stdout=subprocess.PIPE).stdout.read().split('\n')[0].replace('Depends: ', '').split(', ')
|
||||
deps = subprocess.Popen('apt-cache show ' + pack + ' | grep -m 1 ^Depends', shell=True, stdout=subprocess.PIPE).stdout.read().split('\n')[0].replace('Depends: ', '').split(', ')
|
||||
|
||||
process_deps(deps)
|
||||
|
||||
# Retrieve package build dependencies
|
||||
deps1 = subprocess.Popen("apt-cache showsrc " + pack + " | grep -m 1 ^Build-Depends", shell=True, stdout=subprocess.PIPE).stdout.readlines()
|
||||
deps1 = subprocess.Popen('apt-cache showsrc ' + pack + ' | grep -m 1 ^Build-Depends', shell=True, stdout=subprocess.PIPE).stdout.readlines()
|
||||
deps = []
|
||||
|
||||
for builddep in deps1:
|
||||
@ -56,35 +56,55 @@ def find_main(pack):
|
||||
process_deps(deps)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
|
||||
global packages, distro
|
||||
|
||||
# Check if the amount of arguments is correct
|
||||
if len(sys.argv) != 2 or sys.argv[1] in ('help', '-h', '--help'):
|
||||
print "Usage: %s <package name>" % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
# Global variable to hold the status of all packages
|
||||
packages = {}
|
||||
|
||||
if subprocess.Popen("apt-cache show " + sys.argv[1] + " 2>/dev/null", shell=True, stdout=subprocess.PIPE).stdout.read() == '':
|
||||
print "Package «%s» doesn't exist." % sys.argv[1]
|
||||
if len(sys.argv) < 2 or len(sys.argv) > 3 or sys.argv[1] in ('help', '-h', '--help'):
|
||||
print 'Usage: %s <package name> [<distribution>]' % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
find_main(sys.argv[1])
|
||||
except KeyboardInterrupt:
|
||||
print 'Aborted.'
|
||||
if len(sys.argv) == 3 and sys.argv[2]:
|
||||
distro = sys.argv[2]
|
||||
if not subprocess.Popen('apt-cache madison bash | grep ' + distro, shell=True, stdout=subprocess.PIPE).stdout.read():
|
||||
print '«%s» is not a valid distribution.' % distro
|
||||
print 'Remember that for 404main to work with a certain distribution it must be in your /etc/apt/sources.list file.'
|
||||
sys.exit(1)
|
||||
else:
|
||||
distro = subprocess.Popen('lsb_release -cs', shell=True, stdout=subprocess.PIPE).stdout.read().strip('\n')
|
||||
|
||||
if not subprocess.Popen('apt-cache madison ' + sys.argv[1] + ' | grep ' + distro, shell=True, stdout=subprocess.PIPE).stdout.read():
|
||||
print 'Can\'t find package «%s» in distribution «%s».' % (sys.argv[1], distro)
|
||||
sys.exit(1)
|
||||
|
||||
print 'Checking package «%s» in distribution «%s»...' % (sys.argv[1], distro)
|
||||
|
||||
find_main(sys.argv[1])
|
||||
|
||||
# True if everything checked until the point is in main
|
||||
all_in_main = True
|
||||
|
||||
for package in packages:
|
||||
if not packages[package]:
|
||||
if all_in_main:
|
||||
print "Following packages aren't in main:"
|
||||
print 'The following packages aren\'t in main:'
|
||||
all_in_main = False
|
||||
print ' ', package
|
||||
|
||||
if all_in_main:
|
||||
print package, "and all its dependencies are in main."
|
||||
print 'Package «%s» and all its dependencies and build dependencies are in main.' % sys.argv[1]
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
# Global variable to hold the status of all packages
|
||||
packages = {}
|
||||
|
||||
# Global variable to hold the target distribution
|
||||
distro = ''
|
||||
|
||||
try:
|
||||
main()
|
||||
except KeyboardInterrupt:
|
||||
print 'Aborted.'
|
||||
sys.exit(1)
|
||||
|
1
TODO
1
TODO
@ -1,3 +1,4 @@
|
||||
- Create missing manpages (for all commands).
|
||||
- Document ubuntutools Python modules.
|
||||
- Add the process-interdiff script to ubuntu-dev-tools.
|
||||
- Modify 404main to use the more robust python-apt module.
|
||||
|
4
debian/changelog
vendored
4
debian/changelog
vendored
@ -29,8 +29,12 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low
|
||||
- Escape many variables to avoid possible problems there.
|
||||
- Reorganize the code a bit and comment it.
|
||||
- Accept "upgrade" as an alias for "update".
|
||||
- Hide lsb_release's traceback if pbuilder-dist is manually aborted
|
||||
while the distribution was being detected.
|
||||
* 404main:
|
||||
- Filter out entries from Debian, thanks to Adrien Cunin! (LP: #194704)
|
||||
- Add limited support for multiple distributions (and update it's manpage).
|
||||
- TODO: Use python-apt instead of lots of pipes.
|
||||
* debian/copyright.
|
||||
- Add ppaput (the executable has been removed for now -see below-,
|
||||
but there is still the module in the source package).
|
||||
|
@ -4,12 +4,20 @@
|
||||
404main \- check if all build dependencies of a package are in main
|
||||
|
||||
.SH SYNOPSIS
|
||||
\fB404main\fP <\fIpackage name\fP>
|
||||
\fB404main\fP <\fIpackage name\fP> [<\fIdistribution\fP>]
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fB404main\fP is a script that can be used to check if a package and
|
||||
all its build dependencies are in Ubuntu's main component or not.
|
||||
|
||||
.SH CAVEATS
|
||||
\fB404main\fP will take the dependencies and build dependencies of the
|
||||
packages from the distribution you have first in your
|
||||
/etc/apt/sources.list file.
|
||||
.PP
|
||||
Also, because of this the <\fIdistribution\fP> option is NOT trustful, if
|
||||
the dependencies changed YOU WILL GET INCORRECT RESULTS.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR apt-cache (8)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user