mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
Rewrote 404main
This commit is contained in:
parent
9ebf3062e4
commit
9ba953ba80
121
404main
121
404main
@ -1,66 +1,87 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# The author of this script is unknown
|
|
||||||
# License: Public Domain
|
|
||||||
#
|
#
|
||||||
# This script is used to check in what components ("main", "restricted",
|
# Copyright 2007 (C) Siegfried-A. Gevatter <siggi.gevatter@gmail.com>
|
||||||
# "universe" or "multiverse") the dependencies of a package are.
|
# Based upon a script by an unknown author
|
||||||
|
# License: GPLv2 or later
|
||||||
|
#
|
||||||
|
# This script is used to check if a certain package in main has all its
|
||||||
|
# dependencies and build dependencies there too, or not.
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
packages={}
|
|
||||||
|
|
||||||
def find_main(pack, version):
|
def process_deps(deps):
|
||||||
|
"""Takes a list of (build) dependencies and processes it."""
|
||||||
|
|
||||||
|
for package in [ package.split('|')[0] for package in deps ]:
|
||||||
|
|
||||||
|
# Cut package name (from something like "name ( >= version)")
|
||||||
|
name = package.split(' ')[0]
|
||||||
|
|
||||||
|
if not packages.has_key(name):
|
||||||
|
# Check the (build) dependencies recursively
|
||||||
|
find_main(name)
|
||||||
|
|
||||||
|
|
||||||
|
def find_main(pack):
|
||||||
|
"""Searches the dependencies and build dependencies of a package recursively
|
||||||
|
to determine if they are all in the 'main' component or not."""
|
||||||
|
|
||||||
global packages
|
global packages
|
||||||
mad = subprocess.Popen(['apt-cache madison '+pack], shell=True, stdout=subprocess.PIPE)
|
|
||||||
out = mad.stdout.read()
|
# Retrieve information about the package
|
||||||
if out.find("/main")!=-1 or out.find("http")==-1:
|
out = subprocess.Popen('apt-cache madison ' + pack, shell=True, stdout=subprocess.PIPE).stdout.read()
|
||||||
packages[(pack)]="In main"
|
|
||||||
return
|
if out.find("/main") != -1 or out.find("http") == -1:
|
||||||
|
packages[pack] = True
|
||||||
|
return 1
|
||||||
else:
|
else:
|
||||||
if not packages.has_key(pack):
|
if not packages.has_key(pack):
|
||||||
packages[(pack)]="Not in main"
|
packages[pack] = False
|
||||||
test = subprocess.Popen(['apt-cache show '+pack], shell=True, stdout=subprocess.PIPE)
|
|
||||||
|
# Retrive package dependencies
|
||||||
|
deps = subprocess.Popen("dpkg-query -W -f='${Depends}' " + pack, shell=True, stdout=subprocess.PIPE).stdout.read().split(', ')
|
||||||
|
|
||||||
|
process_deps(deps)
|
||||||
|
|
||||||
|
# Retrieve package build dependencies
|
||||||
|
deps1 = subprocess.Popen('apt-cache showsrc ' + pack, shell=True, stdout=subprocess.PIPE).stdout.readlines()
|
||||||
deps = []
|
deps = []
|
||||||
for j in test.stdout.readlines():
|
|
||||||
if j.startswith("Depend"):
|
|
||||||
deps = j.strip("\n").strip("Depends: ").split(",")
|
|
||||||
depse = []
|
|
||||||
for p in deps:
|
|
||||||
a = p.split("|")
|
|
||||||
for k in a:
|
|
||||||
depse.append(k)
|
|
||||||
for i in depse:
|
|
||||||
info=i.strip(") ").split("(")
|
|
||||||
if len(info) == 2:
|
|
||||||
version = info[1].strip(" ")
|
|
||||||
name = info[0].strip(" ")
|
|
||||||
if not packages.has_key(name):
|
|
||||||
find_main(name, version)
|
|
||||||
|
|
||||||
test = subprocess.Popen(['apt-cache showsrc '+pack], shell=True, stdout=subprocess.PIPE)
|
for builddep in deps1:
|
||||||
deps = []
|
if builddep.startswith('Build-Depends'):
|
||||||
for j in test.stdout.readlines():
|
deps += builddep.strip('\n').strip('Build-Depends: ').strip('Build-Depends-Indep: ').split(', ')
|
||||||
if j.startswith("Build-Depend"):
|
|
||||||
deps = j.strip("\n").strip("Build-Depends: ").split(",")
|
|
||||||
depse = []
|
|
||||||
for p in deps:
|
|
||||||
a = p.split("|")
|
|
||||||
for k in a:
|
|
||||||
depse.append(k)
|
|
||||||
for i in depse:
|
|
||||||
info=i.strip(") ").split("(")
|
|
||||||
if len(info) == 2:
|
|
||||||
version = info[1].strip(" ")
|
|
||||||
name = info[0].strip(" ")
|
|
||||||
if not packages.has_key(name):
|
|
||||||
find_main(name, version)
|
|
||||||
|
|
||||||
pkg = sys.argv[1]
|
process_deps(deps)
|
||||||
|
|
||||||
find_main(pkg,0)
|
|
||||||
|
|
||||||
for j in packages:
|
if __name__ == '__main__':
|
||||||
if packages[(j)] == "Not in main":
|
|
||||||
print j + ": "+packages[(j)]
|
# 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("dpkg-query -W -f='${Package}' " + sys.argv[1] + " 2>/dev/null", shell=True, stdout=subprocess.PIPE).stdout.read() == '':
|
||||||
|
print "Package «%s» doesn't exist." % sys.argv[1]
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
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:"
|
||||||
|
all_in_main = False
|
||||||
|
print ' ', package
|
||||||
|
|
||||||
|
if all_in_main:
|
||||||
|
print package, "and all its dependencies are in main."
|
||||||
|
2
AUTHORS
2
AUTHORS
@ -3,8 +3,8 @@ Daniel Holbach <daniel.holbach@ubuntu.com>
|
|||||||
Jamin W. Collins <jcollins@asgardsrealm.net>
|
Jamin W. Collins <jcollins@asgardsrealm.net>
|
||||||
Jordan Mantha <mantha@ubuntu.com>
|
Jordan Mantha <mantha@ubuntu.com>
|
||||||
Luke Yelavich <themuso@ubuntu.com>
|
Luke Yelavich <themuso@ubuntu.com>
|
||||||
Michael Bienia <geser@ubuntu.com>
|
|
||||||
Martin Pitt <martin.pitt@ubuntu.com>
|
Martin Pitt <martin.pitt@ubuntu.com>
|
||||||
|
Michael Bienia <geser@ubuntu.com>
|
||||||
Kees Cook <kees@ubuntu.com>
|
Kees Cook <kees@ubuntu.com>
|
||||||
Siegfried-A. Gevatter <siggi.gevatter@gmail.com>
|
Siegfried-A. Gevatter <siggi.gevatter@gmail.com>
|
||||||
Soren Hansen <soren@ubuntu.com>
|
Soren Hansen <soren@ubuntu.com>
|
||||||
|
3
README
3
README
@ -3,7 +3,8 @@
|
|||||||
================================
|
================================
|
||||||
|
|
||||||
404main <package>
|
404main <package>
|
||||||
... will check in what components the dependencies of <package> are.
|
... will check if the dependencies and build dependencies of
|
||||||
|
<package> are in 'main' or in another component.
|
||||||
|
|
||||||
check-symbols <package> [<directory>]
|
check-symbols <package> [<directory>]
|
||||||
... will compare and give you a diff of the exported symbols of all .so
|
... will compare and give you a diff of the exported symbols of all .so
|
||||||
|
8
debian/changelog
vendored
8
debian/changelog
vendored
@ -11,9 +11,15 @@ ubuntu-dev-tools (0.23) UNRELEASED; urgency=low
|
|||||||
* update-maintainer: Exit after displaying usage for --help.
|
* update-maintainer: Exit after displaying usage for --help.
|
||||||
|
|
||||||
[ Siegfried-Angel Gevatter Pujals (RainCT) ]
|
[ Siegfried-Angel Gevatter Pujals (RainCT) ]
|
||||||
* pbuilder-dist: Move warning about changing $COMPONENTS's value to
|
* pbuilder-dist:
|
||||||
|
- move warning about changing $COMPONENTS's value to
|
||||||
the right place (it should be displayed if the installed version
|
the right place (it should be displayed if the installed version
|
||||||
of pbuilder is too old, not otherwise).
|
of pbuilder is too old, not otherwise).
|
||||||
|
* dgetlp:
|
||||||
|
- add "-h", "--help" and "--debug" (-d was already there)
|
||||||
|
* 404main:
|
||||||
|
- rewrite most of it; cleanup and improvements
|
||||||
|
- change license to GPLv2+
|
||||||
|
|
||||||
-- Siegfried-Angel Gevatter Pujals (RainCT) <sgevatter@ubuntu.cat> Fri, 23 Nov 2007 22:07:58 +0100
|
-- Siegfried-Angel Gevatter Pujals (RainCT) <sgevatter@ubuntu.cat> Fri, 23 Nov 2007 22:07:58 +0100
|
||||||
|
|
||||||
|
10
debian/copyright
vendored
10
debian/copyright
vendored
@ -12,6 +12,7 @@ Upstream Author:
|
|||||||
Kees Cook <kees@ubuntu.com>
|
Kees Cook <kees@ubuntu.com>
|
||||||
Siegfried-A. Gevatter <siggi.gevatter@gmail.com>
|
Siegfried-A. Gevatter <siggi.gevatter@gmail.com>
|
||||||
Soren Hansen <soren@ubuntu.com>
|
Soren Hansen <soren@ubuntu.com>
|
||||||
|
Steve Kowalik <stevenk@ubuntu.com>
|
||||||
Terence Simpson <stdin@stdin.me.uk>
|
Terence Simpson <stdin@stdin.me.uk>
|
||||||
|
|
||||||
|
|
||||||
@ -28,8 +29,9 @@ Copyright:
|
|||||||
|
|
||||||
Licenses:
|
Licenses:
|
||||||
|
|
||||||
check-symbols, dch-repeat, mk-sbuild-lv, pbuilder-dist, pull-debian-debdiff,
|
404main, check-symbols, dch-repeat, dgetlp, mk-sbuild-lv, pbuilder-dist,
|
||||||
submittodebian, update-maintainer, dgetlp and what-patch are licensed under GPLv2:
|
pull-debian-debdiff, submittodebian, update-maintainer, and what-patch
|
||||||
|
are licensed under GPLv2:
|
||||||
|
|
||||||
This package is free software; you can redistribute it and/or modify
|
This package is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -65,5 +67,5 @@ On Debian systems, the complete text of the GNU General Public License v3
|
|||||||
can be found in `/usr/share/common-licenses/GPL-3'.
|
can be found in `/usr/share/common-licenses/GPL-3'.
|
||||||
|
|
||||||
The following of the scripts can be used, at your option, regarding any
|
The following of the scripts can be used, at your option, regarding any
|
||||||
later version of the previously specified license: pbuilder-dist, dgetlp,
|
later version of the previously specified license: 404main, pbuilder-dist,
|
||||||
suspicious-source, get-build-deps.
|
dgetlp, suspicious-source and get-build-deps.
|
||||||
|
8
dgetlp
8
dgetlp
@ -32,7 +32,7 @@ Example:
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = "-d" ]
|
if [ $1 ] && [ $1 = "-d" ] || [ $1 = "--debug" ]
|
||||||
then
|
then
|
||||||
# Debug Mode
|
# Debug Mode
|
||||||
GET="echo "${GET}
|
GET="echo "${GET}
|
||||||
@ -40,6 +40,12 @@ then
|
|||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $1 ] && [ $1 = "-h" ] || [ $1 = "--help" ]
|
||||||
|
then
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $# -ne 1 ]
|
if [ $# -ne 1 ]
|
||||||
then
|
then
|
||||||
usage
|
usage
|
||||||
|
Loading…
x
Reference in New Issue
Block a user