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
123
404main
123
404main
@ -1,66 +1,87 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# The author of this script is unknown
|
||||
# License: Public Domain
|
||||
#
|
||||
# This script is used to check in what components ("main", "restricted",
|
||||
# "universe" or "multiverse") the dependencies of a package are.
|
||||
# Copyright 2007 (C) Siegfried-A. Gevatter <siggi.gevatter@gmail.com>
|
||||
# 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 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
|
||||
mad = subprocess.Popen(['apt-cache madison '+pack], shell=True, stdout=subprocess.PIPE)
|
||||
out = mad.stdout.read()
|
||||
if out.find("/main")!=-1 or out.find("http")==-1:
|
||||
packages[(pack)]="In main"
|
||||
return
|
||||
|
||||
# Retrieve information about the package
|
||||
out = subprocess.Popen('apt-cache madison ' + pack, shell=True, stdout=subprocess.PIPE).stdout.read()
|
||||
|
||||
if out.find("/main") != -1 or out.find("http") == -1:
|
||||
packages[pack] = True
|
||||
return 1
|
||||
else:
|
||||
if not packages.has_key(pack):
|
||||
packages[(pack)]="Not in main"
|
||||
test = subprocess.Popen(['apt-cache show '+pack], shell=True, stdout=subprocess.PIPE)
|
||||
packages[pack] = False
|
||||
|
||||
# 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 = []
|
||||
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)
|
||||
|
||||
for builddep in deps1:
|
||||
if builddep.startswith('Build-Depends'):
|
||||
deps += builddep.strip('\n').strip('Build-Depends: ').strip('Build-Depends-Indep: ').split(', ')
|
||||
|
||||
process_deps(deps)
|
||||
|
||||
test = subprocess.Popen(['apt-cache showsrc '+pack], shell=True, stdout=subprocess.PIPE)
|
||||
deps = []
|
||||
for j in test.stdout.readlines():
|
||||
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]
|
||||
if __name__ == '__main__':
|
||||
|
||||
# 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)
|
||||
|
||||
find_main(pkg,0)
|
||||
|
||||
for j in packages:
|
||||
if packages[(j)] == "Not in main":
|
||||
print j + ": "+packages[(j)]
|
||||
# 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>
|
||||
Jordan Mantha <mantha@ubuntu.com>
|
||||
Luke Yelavich <themuso@ubuntu.com>
|
||||
Michael Bienia <geser@ubuntu.com>
|
||||
Martin Pitt <martin.pitt@ubuntu.com>
|
||||
Michael Bienia <geser@ubuntu.com>
|
||||
Kees Cook <kees@ubuntu.com>
|
||||
Siegfried-A. Gevatter <siggi.gevatter@gmail.com>
|
||||
Soren Hansen <soren@ubuntu.com>
|
||||
|
3
README
3
README
@ -3,7 +3,8 @@
|
||||
================================
|
||||
|
||||
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>]
|
||||
... will compare and give you a diff of the exported symbols of all .so
|
||||
|
12
debian/changelog
vendored
12
debian/changelog
vendored
@ -11,9 +11,15 @@ ubuntu-dev-tools (0.23) UNRELEASED; urgency=low
|
||||
* update-maintainer: Exit after displaying usage for --help.
|
||||
|
||||
[ Siegfried-Angel Gevatter Pujals (RainCT) ]
|
||||
* pbuilder-dist: Move warning about changing $COMPONENTS's value to
|
||||
the right place (it should be displayed if the installed version
|
||||
of pbuilder is too old, not otherwise).
|
||||
* pbuilder-dist:
|
||||
- move warning about changing $COMPONENTS's value to
|
||||
the right place (it should be displayed if the installed version
|
||||
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
|
||||
|
||||
|
10
debian/copyright
vendored
10
debian/copyright
vendored
@ -12,6 +12,7 @@ Upstream Author:
|
||||
Kees Cook <kees@ubuntu.com>
|
||||
Siegfried-A. Gevatter <siggi.gevatter@gmail.com>
|
||||
Soren Hansen <soren@ubuntu.com>
|
||||
Steve Kowalik <stevenk@ubuntu.com>
|
||||
Terence Simpson <stdin@stdin.me.uk>
|
||||
|
||||
|
||||
@ -28,8 +29,9 @@ Copyright:
|
||||
|
||||
Licenses:
|
||||
|
||||
check-symbols, dch-repeat, mk-sbuild-lv, pbuilder-dist, pull-debian-debdiff,
|
||||
submittodebian, update-maintainer, dgetlp and what-patch are licensed under GPLv2:
|
||||
404main, check-symbols, dch-repeat, dgetlp, mk-sbuild-lv, pbuilder-dist,
|
||||
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
|
||||
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'.
|
||||
|
||||
The following of the scripts can be used, at your option, regarding any
|
||||
later version of the previously specified license: pbuilder-dist, dgetlp,
|
||||
suspicious-source, get-build-deps.
|
||||
later version of the previously specified license: 404main, pbuilder-dist,
|
||||
dgetlp, suspicious-source and get-build-deps.
|
||||
|
Loading…
x
Reference in New Issue
Block a user