mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-07-06 04:21:29 +00:00
Fixed mk-sbuild-lv and switched out reverse-build-depends for an Ubuntu port of build-rdeps
This commit is contained in:
parent
ca10641308
commit
1a217816e4
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,8 +1,14 @@
|
|||||||
ubuntu-dev-tools (0.72) UNRELEASED; urgency=low
|
ubuntu-dev-tools (0.72) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
[ Jonathan Davies ]
|
||||||
* README.updates: Added - lists steps to take when updating this package.
|
* README.updates: Added - lists steps to take when updating this package.
|
||||||
* grab-merge: Added --help option and manpage (LP: #349109).
|
* grab-merge: Added --help option and manpage (LP: #349109).
|
||||||
|
|
||||||
|
[ Ryan Kavanagh ]
|
||||||
|
* Fixed mk-sbuild-lv (s/DEBOOTSTRAP_MIRRORS/DEBOOTSTRAP_MIRROR/).
|
||||||
|
* Ported devscripts' build-rdeps to Ubuntu and named it ubuild-rdeps. Added
|
||||||
|
a manpage. Dropped reverse-build-depends and it's manpage. (LP: #272273)
|
||||||
|
|
||||||
-- Jonathan Davies <jpds@ubuntu.com> Thu, 26 Mar 2009 00:22:01 +0000
|
-- Jonathan Davies <jpds@ubuntu.com> Thu, 26 Mar 2009 00:22:01 +0000
|
||||||
|
|
||||||
ubuntu-dev-tools (0.71) jaunty; urgency=low
|
ubuntu-dev-tools (0.71) jaunty; urgency=low
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
.TH REVERSE\-BUILD\-DEPENDS 1 "January 17, 2008" "ubuntu-dev-tools"
|
|
||||||
|
|
||||||
.SH NAME
|
|
||||||
reverse\-build\-depends \- find a package's reverse build dependencies
|
|
||||||
|
|
||||||
.SH SYNOPSIS
|
|
||||||
\fBreverse\-build\-depends\fP [\fB\-c\fP|\fB\-s\fP] <\fIpackage name\fR>
|
|
||||||
|
|
||||||
.SH DESCRIPTION
|
|
||||||
\fBreverse\-build\-depends\fP is a little script that prints a list of
|
|
||||||
all those Debian package that have a build dependency upon the package
|
|
||||||
you indicate, that is, they search for its reverse build dependencies.
|
|
||||||
|
|
||||||
.SH OPTIONS
|
|
||||||
.TP
|
|
||||||
\fB\-c\fP
|
|
||||||
This option will disable normal output and print only the number of
|
|
||||||
reverse dependencies instead.
|
|
||||||
.TP
|
|
||||||
\fB\-s\fP
|
|
||||||
If you prefer to see all build dependencies in a single line, use this
|
|
||||||
option.
|
|
||||||
Otherwise, each one will be printed on its own line.
|
|
||||||
|
|
||||||
.SH KNOWN BUGS AND LIMITATIONS
|
|
||||||
Note that to use \fBreverse\-build\-depends\fP it is required for the source
|
|
||||||
repositories (deb\-src lines) to be enabled in your sources.list.
|
|
||||||
|
|
||||||
.SH SEE ALSO
|
|
||||||
\fBgrep\-dctrl\fR, \fBapt\-cache\fR
|
|
||||||
|
|
||||||
.SH AUTHORS
|
|
||||||
\fBreverse\-build\-depends\fP and this manual page were written by
|
|
||||||
Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com> for YOU.
|
|
||||||
Both are released under the terms of the GNU General Public License (version
|
|
||||||
2 or later).
|
|
172
doc/ubuild-rdeps.1
Normal file
172
doc/ubuild-rdeps.1
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05)
|
||||||
|
.\"
|
||||||
|
.\" Standard preamble:
|
||||||
|
.\" ========================================================================
|
||||||
|
.de Sp \" Vertical space (when we can't use .PP)
|
||||||
|
.if t .sp .5v
|
||||||
|
.if n .sp
|
||||||
|
..
|
||||||
|
.de Vb \" Begin verbatim text
|
||||||
|
.ft CW
|
||||||
|
.nf
|
||||||
|
.ne \\$1
|
||||||
|
..
|
||||||
|
.de Ve \" End verbatim text
|
||||||
|
.ft R
|
||||||
|
.fi
|
||||||
|
..
|
||||||
|
.\" Set up some character translations and predefined strings. \*(-- will
|
||||||
|
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
||||||
|
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
|
||||||
|
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
|
||||||
|
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
|
||||||
|
.\" nothing in troff, for use with C<>.
|
||||||
|
.tr \(*W-
|
||||||
|
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
||||||
|
.ie n \{\
|
||||||
|
. ds -- \(*W-
|
||||||
|
. ds PI pi
|
||||||
|
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
||||||
|
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
||||||
|
. ds L" ""
|
||||||
|
. ds R" ""
|
||||||
|
. ds C` ""
|
||||||
|
. ds C' ""
|
||||||
|
'br\}
|
||||||
|
.el\{\
|
||||||
|
. ds -- \|\(em\|
|
||||||
|
. ds PI \(*p
|
||||||
|
. ds L" ``
|
||||||
|
. ds R" ''
|
||||||
|
'br\}
|
||||||
|
.\"
|
||||||
|
.\" Escape single quotes in literal strings from groff's Unicode transform.
|
||||||
|
.ie \n(.g .ds Aq \(aq
|
||||||
|
.el .ds Aq '
|
||||||
|
.\"
|
||||||
|
.\" If the F register is turned on, we'll generate index entries on stderr for
|
||||||
|
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
|
||||||
|
.\" entries marked with X<> in POD. Of course, you'll have to process the
|
||||||
|
.\" output yourself in some meaningful fashion.
|
||||||
|
.ie \nF \{\
|
||||||
|
. de IX
|
||||||
|
. tm Index:\\$1\t\\n%\t"\\$2"
|
||||||
|
..
|
||||||
|
. nr % 0
|
||||||
|
. rr F
|
||||||
|
.\}
|
||||||
|
.el \{\
|
||||||
|
. de IX
|
||||||
|
..
|
||||||
|
.\}
|
||||||
|
.\"
|
||||||
|
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
||||||
|
.\" Fear. Run. Save yourself. No user-serviceable parts.
|
||||||
|
. \" fudge factors for nroff and troff
|
||||||
|
.if n \{\
|
||||||
|
. ds #H 0
|
||||||
|
. ds #V .8m
|
||||||
|
. ds #F .3m
|
||||||
|
. ds #[ \f1
|
||||||
|
. ds #] \fP
|
||||||
|
.\}
|
||||||
|
.if t \{\
|
||||||
|
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
||||||
|
. ds #V .6m
|
||||||
|
. ds #F 0
|
||||||
|
. ds #[ \&
|
||||||
|
. ds #] \&
|
||||||
|
.\}
|
||||||
|
. \" simple accents for nroff and troff
|
||||||
|
.if n \{\
|
||||||
|
. ds ' \&
|
||||||
|
. ds ` \&
|
||||||
|
. ds ^ \&
|
||||||
|
. ds , \&
|
||||||
|
. ds ~ ~
|
||||||
|
. ds /
|
||||||
|
.\}
|
||||||
|
.if t \{\
|
||||||
|
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
||||||
|
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
||||||
|
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
||||||
|
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
||||||
|
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
||||||
|
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
||||||
|
.\}
|
||||||
|
. \" troff and (daisy-wheel) nroff accents
|
||||||
|
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
||||||
|
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
||||||
|
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
||||||
|
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
||||||
|
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
||||||
|
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
||||||
|
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
||||||
|
.ds ae a\h'-(\w'a'u*4/10)'e
|
||||||
|
.ds Ae A\h'-(\w'A'u*4/10)'E
|
||||||
|
. \" corrections for vroff
|
||||||
|
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
||||||
|
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
||||||
|
. \" for low resolution devices (crt and lpr)
|
||||||
|
.if \n(.H>23 .if \n(.V>19 \
|
||||||
|
\{\
|
||||||
|
. ds : e
|
||||||
|
. ds 8 ss
|
||||||
|
. ds o a
|
||||||
|
. ds d- d\h'-1'\(ga
|
||||||
|
. ds D- D\h'-1'\(hy
|
||||||
|
. ds th \o'bp'
|
||||||
|
. ds Th \o'LP'
|
||||||
|
. ds ae ae
|
||||||
|
. ds Ae AE
|
||||||
|
.\}
|
||||||
|
.rm #[ #] #H #V #F C
|
||||||
|
.\" ========================================================================
|
||||||
|
.\"
|
||||||
|
.IX Title "BUILD-RDEPS 1"
|
||||||
|
.TH BUILD-RDEPS 1 "2008-08-14" "Debian Utilities" " "
|
||||||
|
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
||||||
|
.\" way too many mistakes in technical documents.
|
||||||
|
.if n .ad l
|
||||||
|
.nh
|
||||||
|
.SH "NAME"
|
||||||
|
build\-rdeps \- find packages that depend on a specific package to build (reverse build depends)
|
||||||
|
.SH "SYNOPSIS"
|
||||||
|
.IX Header "SYNOPSIS"
|
||||||
|
\&\fBubuild-rdeps\fR \fIpackage\fR
|
||||||
|
.SH "DESCRIPTION"
|
||||||
|
.IX Header "DESCRIPTION"
|
||||||
|
\&\fBubuild-rdeps\fR searches for all packages that build-depend on the specified package.
|
||||||
|
.SH "OPTIONS"
|
||||||
|
.IX Header "OPTIONS"
|
||||||
|
.IP "\fB\-u\fR \fB\-\-update\fR" 4
|
||||||
|
.IX Item "-u --update"
|
||||||
|
Run apt-get update before searching for build-depends.
|
||||||
|
.IP "\fB\-s\fR \fB\-\-sudo\fR" 4
|
||||||
|
.IX Item "-s --sudo"
|
||||||
|
Use sudo when running apt-get update. Has no effect if \-u is ommitted.
|
||||||
|
.IP "\fB\-\-distribution\fR" 4
|
||||||
|
.IX Item "--distribution"
|
||||||
|
Select another distribution, which is searched for build-depends.
|
||||||
|
.IP "\fB\-m\fR \fB\-\-print\-maintainer\fR" 4
|
||||||
|
.IX Item "-m --print-maintainer"
|
||||||
|
Print the value of the maintainer field for each package.
|
||||||
|
.IP "\fB\-d\fR \fB\-\-debug\fR" 4
|
||||||
|
.IX Item "-d --debug"
|
||||||
|
Run the debug mode
|
||||||
|
.IP "\fB\-\-help\fR" 4
|
||||||
|
.IX Item "--help"
|
||||||
|
Show the usage information.
|
||||||
|
.IP "\fB\-\-version\fR" 4
|
||||||
|
.IX Item "--version"
|
||||||
|
Show the version information.
|
||||||
|
.SH "LICENSE"
|
||||||
|
.IX Header "LICENSE"
|
||||||
|
This code is copyright by Patrick Schoenfeld
|
||||||
|
<schoenfeld@in\-medias\-res.com>, all rights reserved.
|
||||||
|
This program comes with \s-1ABSOLUTELEY\s0 \s-1NO\s0 \s-1WARRANTY\s0.
|
||||||
|
You are free to redistribute this code under the terms of the
|
||||||
|
\&\s-1GNU\s0 General Public License, version 2 or later.
|
||||||
|
.SH "AUTHOR"
|
||||||
|
.IX Header "AUTHOR"
|
||||||
|
Patrick Schoenfeld <schoenfeld@in\-medias\-res.com>
|
@ -250,7 +250,7 @@ sudo mount "$CHROOT_PATH" "$MNT"
|
|||||||
if [ $DEBIAN ]; then
|
if [ $DEBIAN ]; then
|
||||||
sudo cdebootstrap -f build $arch_opt $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://ftp.debian.org/debian}"
|
sudo cdebootstrap -f build $arch_opt $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://ftp.debian.org/debian}"
|
||||||
else
|
else
|
||||||
sudo debootstrap $arch_opt $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu}"
|
sudo debootstrap --variant=buildd $arch_opt $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu}"
|
||||||
fi
|
fi
|
||||||
# Update the package sources
|
# Update the package sources
|
||||||
TEMP_SOURCES=`mktemp -t sources-XXXXXX`
|
TEMP_SOURCES=`mktemp -t sources-XXXXXX`
|
||||||
@ -263,8 +263,8 @@ else
|
|||||||
# Start DEBIAN
|
# Start DEBIAN
|
||||||
if [ $DEBIAN ]; then
|
if [ $DEBIAN ]; then
|
||||||
cat > "$TEMP_SOURCES" << EOM
|
cat > "$TEMP_SOURCES" << EOM
|
||||||
deb ${DEBOOTSTRAP_MIRRORS:-http://ftp.debian.org/debian} RELEASE main non-free contrib
|
deb ${DEBOOTSTRAP_MIRROR:-http://ftp.debian.org/debian} RELEASE main non-free contrib
|
||||||
deb-src ${DEBOOTSTRAP_MIRRORS:-http://ftp.debian.org/debian} RELEASE main non-free contrib
|
deb-src ${DEBOOTSTRAP_MIRROR:-http://ftp.debian.org/debian} RELEASE main non-free contrib
|
||||||
EOM
|
EOM
|
||||||
if [ "$RELEASE" != "sid" ]; then
|
if [ "$RELEASE" != "sid" ]; then
|
||||||
cat >> "$TEMP_SOURCES" << EOM
|
cat >> "$TEMP_SOURCES" << EOM
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Siegfried-A. Gevatter <rainct@ubuntu.com>
|
|
||||||
# Based upon a short script by an unknown author
|
|
||||||
#
|
|
||||||
# ##################################################################
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU General Public License
|
|
||||||
# as published by the Free Software Foundation; either version 2
|
|
||||||
# of the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# See file /usr/share/common-licenses/GPL for more details.
|
|
||||||
#
|
|
||||||
# ##################################################################
|
|
||||||
#
|
|
||||||
# This script is used to find the reverse build dependencies
|
|
||||||
# that a package has.
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
echo "Usage: $0 [-c|-s] <package name>"
|
|
||||||
echo "Options:"
|
|
||||||
echo " -c: Print only the number of reverse dependencies."
|
|
||||||
echo " -s: Print all reverse dependencies in a single line."
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$1" = '-c' ]
|
|
||||||
then
|
|
||||||
count=1
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$1" = '-s' ]
|
|
||||||
then
|
|
||||||
single_line=1
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $# -ne 1 ];
|
|
||||||
then
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$1" = '-h' ] || [ "$1" = '--help' ]
|
|
||||||
then
|
|
||||||
usage
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
result=$(
|
|
||||||
grep-dctrl -sPackage -F Build-Depends,Build-Depends-Indep $1 \
|
|
||||||
/var/lib/apt/lists/*Sources | cut -d ' ' -f 2)
|
|
||||||
|
|
||||||
if [ -z $count ] && [ -z $single_line ]
|
|
||||||
then
|
|
||||||
echo "$result"
|
|
||||||
else
|
|
||||||
if [ -z $count ]
|
|
||||||
then
|
|
||||||
echo $result
|
|
||||||
else
|
|
||||||
echo "$result" | wc -l
|
|
||||||
fi
|
|
||||||
fi
|
|
269
ubuild-rdeps
Executable file
269
ubuild-rdeps
Executable file
@ -0,0 +1,269 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
# Copyright (C) Patrick Schoenfeld
|
||||||
|
# Copyright (C) 2009 Ryan Kavanagh
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
build-rdeps - find packages that depend on a specific package to build (reverse build depends)
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
B<build-rdeps> I<package>
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
B<build-rdeps> searches for all packages that build-depend on the specified package.
|
||||||
|
|
||||||
|
=head1 OPTIONS
|
||||||
|
|
||||||
|
=over 4
|
||||||
|
|
||||||
|
=item B<-u> B<--update>
|
||||||
|
|
||||||
|
Run apt-get update before searching for build-depends.
|
||||||
|
|
||||||
|
=item B<-s> B<--sudo>
|
||||||
|
|
||||||
|
Use sudo when running apt-get update. Has no effect if -u is ommitted.
|
||||||
|
|
||||||
|
=item B<--distribution>
|
||||||
|
|
||||||
|
Select another distribution, which is searched for build-depends.
|
||||||
|
|
||||||
|
=item B<-m> B<--print-maintainer>
|
||||||
|
|
||||||
|
Print the value of the maintainer field for each package.
|
||||||
|
|
||||||
|
=item B<-d> B<--debug>
|
||||||
|
|
||||||
|
Run the debug mode
|
||||||
|
|
||||||
|
=item B<--help>
|
||||||
|
|
||||||
|
Show the usage information.
|
||||||
|
|
||||||
|
=item B<--version>
|
||||||
|
|
||||||
|
Show the version information.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
use warnings;
|
||||||
|
use strict;
|
||||||
|
use File::Basename;
|
||||||
|
use File::Find;
|
||||||
|
use Getopt::Long;
|
||||||
|
use Pod::Usage;
|
||||||
|
use Data::Dumper;
|
||||||
|
my $progname = basename($0);
|
||||||
|
my $version = '1.0';
|
||||||
|
my $dctrl = "/usr/bin/grep-dctrl";
|
||||||
|
my $sources_path = "/var/lib/apt/lists/";
|
||||||
|
my $source_pattern = ".*_dists_jaunty_.*Sources\$";
|
||||||
|
my @source_files;
|
||||||
|
my $sources_count=0;
|
||||||
|
my $opt_debug;
|
||||||
|
my $opt_update;
|
||||||
|
my $opt_sudo;
|
||||||
|
my $opt_maintainer;
|
||||||
|
my $opt_mainonly;
|
||||||
|
my $opt_distribution;
|
||||||
|
|
||||||
|
if (!(-x $dctrl)) {
|
||||||
|
die "$progname: Fatal error. grep-dctrl is not available.\nPlease install the 'dctrl-tools' package.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub version {
|
||||||
|
print <<"EOT";
|
||||||
|
This is $progname $version, from the Debian devscripts package, v. ###VERSION###
|
||||||
|
This code is copyright by Patrick Schoenfeld, all rights reserved.
|
||||||
|
It comes with ABSOLUTELY NO WARRANTY. You are free to redistribute this code
|
||||||
|
under the terms of the GNU General Public License, version 2 or later.
|
||||||
|
EOT
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub usage {
|
||||||
|
print <<"EOT";
|
||||||
|
usage: $progname packagename
|
||||||
|
$progname --help
|
||||||
|
$progname --version
|
||||||
|
|
||||||
|
Searches for all packages that build-depend on the specified package.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-u, --update Run apt-get update before searching for build-depends.
|
||||||
|
(needs root privileges)
|
||||||
|
-s, --sudo Use sudo when running apt-get update
|
||||||
|
(has no effect when -u is ommitted)
|
||||||
|
-d, --debug Enable the debug mode
|
||||||
|
-m, --print-maintainer Print the maintainer information (experimental)
|
||||||
|
--distribution distribution Select a distribution to search for build-depends
|
||||||
|
(Default: jaunty)
|
||||||
|
--only-main Ignore universe and multiverse
|
||||||
|
|
||||||
|
EOT
|
||||||
|
version;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub findsources {
|
||||||
|
if (/$source_pattern/ and $sources_count <= 3) {
|
||||||
|
unless ($opt_mainonly and /(universe|multiverse)/) {
|
||||||
|
push(@source_files, $_);
|
||||||
|
$sources_count+=1;
|
||||||
|
print STDERR "DEBUG: Added source file: $_ (#$sources_count)\n" if ($opt_debug);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub findreversebuilddeps {
|
||||||
|
my ($package, $source_file) = @_;
|
||||||
|
my %packages;
|
||||||
|
my $depending_package;
|
||||||
|
my $count=0;
|
||||||
|
my $maintainer_info='';
|
||||||
|
|
||||||
|
open(PACKAGES, "$dctrl -F Build-Depends,Build-Depends-Indep $package -s Package,Build-Depends,Build-Depends-Indep,Maintainer $source_file|");
|
||||||
|
|
||||||
|
while(<PACKAGES>) {
|
||||||
|
chomp;
|
||||||
|
print STDERR "$_\n" if ($opt_debug);
|
||||||
|
if (/Package: (.*)$/) {
|
||||||
|
$depending_package = $1;
|
||||||
|
$packages{$depending_package}->{'Build-Depends'} = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/Maintainer: (.*)$/) {
|
||||||
|
if ($depending_package) {
|
||||||
|
$packages{$depending_package}->{'Maintainer'} = $1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/Build-Depends: (.*)$/ or /Build-Depends-Indep: (.*)$/) {
|
||||||
|
if ($depending_package) {
|
||||||
|
print STDERR "$1\n" if ($opt_debug);
|
||||||
|
if ($1 =~ /^(.*\s)?$package([\s,]|$)/) {
|
||||||
|
$packages{$depending_package}->{'Build-Depends'} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while($depending_package = each(%packages)) {
|
||||||
|
if ($packages{$depending_package}->{'Build-Depends'} != 1) {
|
||||||
|
print STDERR "Ignoring package $depending_package because its not really build depending on $package.\n" if ($opt_debug);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
if ($opt_maintainer) {
|
||||||
|
$maintainer_info = "($packages{$depending_package}->{'Maintainer'})";
|
||||||
|
}
|
||||||
|
|
||||||
|
$count+=1;
|
||||||
|
print "$depending_package $maintainer_info \n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($count == 0) {
|
||||||
|
print "No reverse build-depends found for $package.\n\n"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print "\nFound a total of $count reverse build-depend(s) for $package.\n\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($#ARGV < 0) { usage; exit(0); }
|
||||||
|
|
||||||
|
|
||||||
|
Getopt::Long::Configure('bundling');
|
||||||
|
GetOptions(
|
||||||
|
"u|update" => \$opt_update,
|
||||||
|
"s|sudo" => \$opt_sudo,
|
||||||
|
"m|print-maintainer" => \$opt_maintainer,
|
||||||
|
"distribution=s" => \$opt_distribution,
|
||||||
|
"only-main" => \$opt_mainonly,
|
||||||
|
"d|debug" => \$opt_debug,
|
||||||
|
"h|help" => sub { usage; },
|
||||||
|
"v|version" => sub { version; }
|
||||||
|
);
|
||||||
|
|
||||||
|
my $package = shift;
|
||||||
|
|
||||||
|
if (!$package) {
|
||||||
|
die "$progname: missing argument. expecting packagename\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print STDERR "DEBUG: Package => $package\n" if ($opt_debug);
|
||||||
|
|
||||||
|
if ($opt_update) {
|
||||||
|
print STDERR "DEBUG: Updating apt-cache before search\n" if ($opt_debug);
|
||||||
|
my @cmd;
|
||||||
|
if ($opt_sudo) {
|
||||||
|
print STDERR "DEBUG: Using sudo to become root\n" if ($opt_debug);
|
||||||
|
push(@cmd, 'sudo');
|
||||||
|
}
|
||||||
|
push(@cmd, 'apt-get', 'update');
|
||||||
|
system @cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opt_distribution) {
|
||||||
|
print STDERR "DEBUG: Setting distribution to $opt_distribution" if ($opt_debug);
|
||||||
|
$source_pattern = ".*_dists_" . $opt_distribution . "_.*Sources\$";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Find sources files
|
||||||
|
find(\&findsources, $sources_path);
|
||||||
|
|
||||||
|
if (($#source_files+1) <= 0) {
|
||||||
|
die "$progname: unable to find sources files.\nDid you forget to run apt-get update (or add --update to this command)?";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $source_file (@source_files) {
|
||||||
|
if ($source_file =~ /main/) {
|
||||||
|
print "Reverse Build-depends in main:\n";
|
||||||
|
print "------------------------------\n\n";
|
||||||
|
findreversebuilddeps($package, "$sources_path/$source_file");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($source_file =~ /universe/) {
|
||||||
|
print "Reverse Build-depends in universe:\n";
|
||||||
|
print "---------------------------------\n\n";
|
||||||
|
findreversebuilddeps($package, "$sources_path/$source_file");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($source_file =~ /multiverse/) {
|
||||||
|
print "Reverse Build-depends in multiverse:\n";
|
||||||
|
print "----------------------------------\n\n";
|
||||||
|
findreversebuilddeps($package, "$sources_path/$source_file");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
=head1 LICENSE
|
||||||
|
|
||||||
|
This code is copyright by Patrick Schoenfeld
|
||||||
|
<schoenfeld@in-medias-res.com>, all rights reserved.
|
||||||
|
This program comes with ABSOLUTELEY NO WARRANTY.
|
||||||
|
You are free to redistribute this code under the terms of the
|
||||||
|
GNU General Public License, version 2 or later.
|
||||||
|
|
||||||
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
Patrick Schoenfeld <schoenfeld@in-medias-res.com>
|
||||||
|
|
||||||
|
=cut
|
Loading…
x
Reference in New Issue
Block a user