~ubuntu-branches/ubuntu/oneiric/sbuild/oneiric

« back to all changes in this revision

Viewing changes to bin/wanna-build-catdb

  • Committer: Bazaar Package Importer
  • Author(s): Lorenzo De Liso
  • Date: 2011-05-01 16:55:16 UTC
  • mfrom: (8.1.19 upstream) (3.3.17 sid)
  • Revision ID: james.westby@ubuntu.com-20110501165516-8g3uwrnhv2bzjt8y
Tags: 0.62.2-1ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/patches/do-not-install-debfoster-into-chroots.patch: 
    do not install debfoster into the chroots because it is in universe and 
    not needed for package building itself.
  - debian/patches/run-pre-build-hooks-as-root.patch: 
    run pre-build hooks as root (Closes: #607228)
* Now that the package uses a patch system, don't modify the files directly;
  instead, put the changes in the respective patches and add the DEP-3
  patch tagging guidelines to them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
#
3
 
# Copyright © 1999 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
4
 
# Copyright © 2008 Roger Leigh <rleigh@debian.org
5
 
#
6
 
# This program is free software: you can redistribute it and/or modify
7
 
# it under the terms of the GNU General Public License as published by
8
 
# the Free Software Foundation, either version 2 of the License, or
9
 
# (at your option) any later version.
10
 
#
11
 
# This program is distributed in the hope that it will be useful, but
12
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 
# General Public License for more details.
15
 
#
16
 
# You should have received a copy of the GNU General Public License
17
 
# along with this program.  If not, see
18
 
# <http://www.gnu.org/licenses/>.
19
 
#
20
 
#######################################################################
21
 
 
22
 
use strict;
23
 
use warnings;
24
 
use File::Basename;
25
 
my $progname = basename($0);
26
 
my %db;
27
 
 
28
 
use DB_File;
29
 
use GDBM_File;
30
 
use MLDBM qw(GDBM_File Storable);
31
 
 
32
 
die "Filename missing\n" if !@ARGV;
33
 
die "$ARGV[0]: $!\n" if !-f $ARGV[0];
34
 
 
35
 
if ($progname =~ /catdb/) {
36
 
    tie %db, 'DB_File', $ARGV[0], O_RDONLY, 0664, $DB_HASH;
37
 
}
38
 
elsif ($progname =~ /catgdbm/) {
39
 
    tie %db, 'GDBM_File', $ARGV[0], GDBM_READER, 0644;
40
 
}
41
 
elsif ($progname =~ /catmldbm/) {
42
 
    tie %db, 'MLDBM', $ARGV[0], GDBM_READER, 0644;
43
 
}
44
 
else {
45
 
    die "Called for unknown db type\n";
46
 
}
47
 
shift;
48
 
 
49
 
my ($key, $val);
50
 
 
51
 
my @keys = sort(keys(%db));
52
 
@keys = @ARGV if (@ARGV > 0);
53
 
 
54
 
foreach $key (@keys) {
55
 
    print "-"x78, "\n";
56
 
    if (exists $db{$key}) {
57
 
        my $val = $db{$key};
58
 
        if (ref($val) eq "HASH") {
59
 
            print "$key:\n";
60
 
            foreach (keys(%{$val})) {
61
 
                print "  $_: $val->{$_}\n";
62
 
            }
63
 
        } else {
64
 
            print "$key:\n$db{$key}\n";
65
 
        }
66
 
    }
67
 
    else {
68
 
        print "*UNDEFINED*\n";
69
 
    }
70
 
}
71
 
 
72
 
untie %db;
73
 
exit 0;