~ubuntu-branches/ubuntu/saucy/dahdi-tools/saucy

« back to all changes in this revision

Viewing changes to menuselect/contrib/menuselect-dummy

  • Committer: Bazaar Package Importer
  • Author(s): Jean-Michel Dault, Tzafrir Cohen
  • Date: 2010-02-16 13:44:09 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100216134409-4y4k26mgzyra537o
Tags: 1:2.2.1-0ubuntu1
* Merge from Debian pkg-voip.
  * Changes from Debian:
  - debian/control: Change Maintainer
  - debian/control: Removed Uploaders field.
  - debian/control: Removed Debian Vcs-Svn entry and replaced with
      ubuntu-voip Vcs-Bzr, to reflect divergence in packages.
  - debian/control: Package dahdi Depends on  dahdi-dkms | dahdi-source

* From Debian pkg-voip:
[ Tzafrir Cohen ]
* New upstream release (Closes: #536257, #564381).
* Patch 'bashism' dropped: merged upstream. 
* Patch xpp_no_extra_at dropped: merged upstream. 
* Add an example genconf_parameters.
* Compat level 7.
* Bump standars version to 3.8.3.0 (no change needed)
* Udev rules are now in dahdi-linux.
* Patches perl_fix_noserial, perl_fix_transportdir: Fixes for some
  minor perl issues.
* Add the missing ${misc:Depends}, as per lintian. 
* Patch astribank_allow_ignoreend: an extra missing patch from upstream. 
* Patches init_unload_modules and init_unload_oslec: also unload OSLEC
  when unloading all modules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
# If those modules are not present, the build will fail (PCRE patterns)
87
87
my @RequiredModules = ();
88
88
 
89
 
my @Subdirs = qw/apps cdr channels codecs formats funcs main pbx res utils/;
 
89
my @Subdirs = qw/addons apps bridges cdr cel channels codecs formats funcs main pbx res tests utils/;
90
90
 
91
91
my @XmlCategories = 'cflags';
92
92
 
220
220
                        if (! exists $member->{$key}) {
221
221
                                $member->{$key} = [];
222
222
                        }
 
223
                        
 
224
                        # Make sure dependencies are upper-case.
 
225
                        # FIXME: this is not the proper place for such a fix
 
226
                        $val = uc($val) if ($key =~ /Depend|Use/);
 
227
 
223
228
                        # Using "unshift' rather than 'push'.
224
229
                        # For a singleton value this makes the action an 
225
230
                        # override, as only the first value counts.
551
556
                        my ($var, $value) = split /: /, $_, 2;
552
557
                        $item{$var} = $value;
553
558
                }
 
559
                # FIXME: dependencies are a list. This should not be a 
 
560
                # special case.
 
561
                if (exists $item{Depend}) {
 
562
                        $item{Depend} = [split /\s*,\s*/,$item{Depend}];
 
563
                }
554
564
                $items{$item{Key}} = \%item;
555
565
        }
556
566
        close DUMP_FILE;
558
568
        return \%items;
559
569
}
560
570
 
 
571
# Explain why a module (read from the dump file) was not enabled.
 
572
# (We assume here that $item->{Avail} is 0)
 
573
sub fail_reason($) {
 
574
        my $item = shift;
 
575
        if ($item->{Type} eq 'lib') {
 
576
                return " Not found: system library";
 
577
        } elsif ($item->{Type} eq 'XML') {
 
578
                if ($item->{Defaultenabled} !~ /^y/) {
 
579
                        return "Not enabled";
 
580
                } else {
 
581
                        return "Missing dependencies";
 
582
                }
 
583
        } elsif ($item->{Type} eq 'module') {
 
584
                if (exists ($item->{Defaultenabled}) && 
 
585
                        $item->{Defaultenabled} =~ /^n/) {
 
586
                        return "Disabled";
 
587
                } else {
 
588
                        return "Missing dependencies";
 
589
                }
 
590
        }
 
591
}
 
592
 
 
593
sub item_used($) {
 
594
        my $item = shift;
 
595
        my $type = $item->{Type};
 
596
 
 
597
        return $item->{Avail} if ($type eq 'lib');
 
598
        return $item->{Checked};
 
599
}
 
600
 
561
601
sub print_module_status {
 
602
        my $flag_verbose = shift;
562
603
        my $items = read_dump();
563
604
        my %items_matched = ();
564
605
 
574
615
 
575
616
        foreach my $item_name (@items_list) {
576
617
                my $item = $items->{$item_name};
577
 
                printf "%s %-8s %-30s\n",
578
 
                        (($item->{Avail})? 'Y':'n'),
579
 
                        $item->{Type},
580
 
                        $item->{Key};
 
618
                if ($flag_verbose) {
 
619
                        printf "%s %-8s %-30s\n",
 
620
                                (item_used($item)? 'Y':'n'),
 
621
                                $item->{Type},
 
622
                                $item->{Key};
 
623
                        if (!$item->{Avail}) {
 
624
                                my $reason = fail_reason($item);
 
625
                                print " $reason\n";
 
626
                        }
 
627
                        foreach (@{$item->{Depend}}) {
 
628
                                my $depmod = $items->{$_};
 
629
                                        printf(" * %-12s ",$_);
 
630
                                        print (item_used($depmod)? '': "un");
 
631
                                        print "available\n";
 
632
                        }
 
633
                } else {
 
634
                        printf "%s %-8s %-30s",
 
635
                                (item_used($item)? 'Y':'n'),
 
636
                                $item->{Type},
 
637
                                $item->{Key};
 
638
                        foreach (@{$item->{Depend}}) {
 
639
                                my $depmod = $items->{$_};
 
640
                                if (item_used($depmod)) {
 
641
                                        print "$_ ";
 
642
                                } else {
 
643
                                        printf "[%s] ", $_;
 
644
                                }
 
645
                        }
 
646
                        print "\n";
 
647
                }
581
648
        }
582
649
}
583
650
 
587
654
        print "Usage:\n";
588
655
        print "$0  # menuselect processing\n";
589
656
        print "$0 -m|--modinfo|--moduls-info PATTERN # Status of modules\n";
 
657
        print "$0 -v|--verbose                       # verbose (modinfo)\n";
590
658
        print "$0 -c|--check-deps                    # Check for dependencies\n";
591
659
        print "\n";
592
660
        print "PATTERN is a partial perl regex. Use '-m .' to list all.\n";
594
662
 
595
663
my @module_status = ();
596
664
 
 
665
my $flag_verbose = 0;
 
666
 
597
667
my $action = '';
598
668
 
599
669
my $rc = GetOptions(
600
670
        'modinfo|modules-info|m=s' => \@module_status,
 
671
        'verbose|v' => \$flag_verbose,
601
672
        'check-deps|c:s' => sub { $action = 'check_dependencies'},
602
673
        'help|h' => sub { usage(); exit 0 },
603
674
);
611
682
}
612
683
 
613
684
if ($action eq 'module_status') {
614
 
        print_module_status(@module_status);
 
685
        print_module_status($flag_verbose, @module_status);
615
686
        exit 0;
616
687
} elsif ( $action eq 'check_dependencies') {
617
688
        check_dependencies();