Changeset 291


Ignore:
Timestamp:
Dec 20, 2007, 11:10:49 AM (12 years ago)
Author:
bruno
Message:
  • Removes AppConfig? dependency by using just a perl regexp instead.
  • Interface to the version field has also changed
Location:
devel
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r290 r291  
    1414use Data::Dumper;
    1515use English;
    16 use AppConfig qw(:argcount :expand);
    1716use File::Basename;
    1817use File::Copy;
     
    401400            foreach my $f (@specfile) {
    402401                if ($f =~ /\.spec$/) {
    403                     pb_system("rpmbuild --define \"packager $pbpackager\" --define \"_topdir $ENV{'PBBUILDDIR'}\" -ba $f","Building package with $f under $ENV{'PBBUILDDIR'}");
     402                    pb_system("rpmbuild --define \'packager $pbpackager\' --define \"_topdir $ENV{'PBBUILDDIR'}\" -ba $f","Building package with $f under $ENV{'PBBUILDDIR'}");
    404403                    last;
    405404                }
     
    569568            # This is a test pkg => target dir is under test
    570569            $tdir .= "/test";
     570        }
    571571    } else {
    572572        return;
  • devel/pb/contrib/pbsetupqemu

    r274 r291  
    8282    #chomp($topbuilddir);
    8383
    84     if ( $dver <= 4 ) {
    85         # FC4 - AppConfig unavailable
    86         system "yum -y $opt install neon newt-devel slang-devel autoconf automake libtool gcc rpm-build wget gcc-c++ docbook-utils-pdf ImageMagick man patch cdrecord mkisofs perl-DateManip ntp sudo ; rm -rf AppConfig-* ; rm -rf AppConfig* ; wget http://search.cpan.org/CPAN/authors/id/A/AB/ABW/AppConfig-1.66.tar.gz ; tar xvfz AppConfig-1.66.tar.gz ; cd AppConfig* ; perl Makefile.PL ; make ; make install ; cd ..";
    87     } else {
    88         # FC5/6/7
    89         system "yum -y $opt install neon newt-devel slang-devel autoconf automake libtool gcc rpm-build wget gcc-c++ docbook-utils-pdf ImageMagick man patch cdrecord mkisofs ntp sudo perl-AppConfig perl-DateManip";
    90     }
     84    system "yum -y $opt install neon newt-devel slang-devel autoconf automake libtool gcc rpm-build wget gcc-c++ docbook-utils-pdf ImageMagick man patch cdrecord mkisofs ntp sudo perl-DateManip";
    9185} elsif (( $dfam eq "rh" ) || ($ddir eq "sles") || (($ddir eq "suse") && (($dver eq "10.1") || ($dver eq "10.0"))) || (($ddir eq "mandrake") && ($dver eq "10.1"))) {
    9286    # Suppose pkg are installed already
    9387    system "rpm -e lsb 2>&1 > /dev/null";
    94     system "rm -rf AppConfig-* ; wget http://search.cpan.org/CPAN/authors/id/A/AB/ABW/AppConfig-1.66.tar.gz ; tar xvfz AppConfig-1.66.tar.gz ; cd AppConfig* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf DateManip* ; wget http://search.cpan.org/CPAN/authors/id/S/SB/SBECK/Date-Manip-5.46.tar.gz ; tar xvfz Date-Manip-5.46.tar.gz ; cd Date-Manip* ; perl Makefile.PL ; make ; make install ; cd .. ";
     88    system "rm -rf DateManip* ; wget http://search.cpan.org/CPAN/authors/id/S/SB/SBECK/Date-Manip-5.46.tar.gz ; tar xvfz Date-Manip-5.46.tar.gz ; cd Date-Manip* ; perl Makefile.PL ; make ; make install ; cd .. ";
    9589} elsif ($ddir eq "suse") {
    9690    # New OpenSuSE
    97     system "export TERM=linux ; liste=\"\" ; for i in neon newt-devel slang-devel autoconf automake libtool make gcc wget gcc-c++ docbook-utils ImageMagick man patch mkisofs sudo perl-DateManip perl-AppConfig perl-File-HomeDir xntp; do rpm -q \$i 1> /dev/null 2> /dev/null ; if [ \$\? != 0 ]; then liste=\"\$liste \$i\"; fi; done; echo \"Liste: \$liste\" ; if [ \"\$liste\" != \"\" ]; then yast2 -i \$liste ; fi";
     91    system "export TERM=linux ; liste=\"\" ; for i in neon newt-devel slang-devel autoconf automake libtool make gcc wget gcc-c++ docbook-utils ImageMagick man patch mkisofs sudo perl-DateManip perl-File-HomeDir xntp; do rpm -q \$i 1> /dev/null 2> /dev/null ; if [ \$\? != 0 ]; then liste=\"\$liste \$i\"; fi; done; echo \"Liste: \$liste\" ; if [ \"\$liste\" != \"\" ]; then yast2 -i \$liste ; fi";
    9892} elsif ( $dfam eq "md" ) {
    9993    if (( $dver eq "2006.0" ) || ( $dver eq "10.2" )) {
    10094        # mondo not available
    101         system "urpmi.update -a ; urpmi --auto neon newt-devel slang-devel glibc-static-devel autoconf automake libtool gcc rpm-build wget gcc-c++ docbook-utils-pdf ImageMagick sudo man patch mkisofs cdrecord ntp-client perl-AppConfig perl-DateManip";
     95        system "urpmi.update -a ; urpmi --auto neon newt-devel slang-devel glibc-static-devel autoconf automake libtool gcc rpm-build wget gcc-c++ docbook-utils-pdf ImageMagick sudo man patch mkisofs cdrecord ntp-client perl-DateManip";
    10296    } else {
    103         system "urpmi.update -a ; urpmi --auto neon newt-devel slang-devel glibc-static-devel autoconf automake libtool gcc rpm-build wget gcc-c++ sudo docbook-utils-pdf ImageMagick man patch mondo mkisofs cdrecord ntp-client perl-AppConfig perl-DateManip";
     97        system "urpmi.update -a ; urpmi --auto neon newt-devel slang-devel glibc-static-devel autoconf automake libtool gcc rpm-build wget gcc-c++ sudo docbook-utils-pdf ImageMagick man patch mondo mkisofs cdrecord ntp-client perl-DateManip";
    10498    }
    10599} elsif ( $dfam eq "du" ) {
    106100    if (( $dver eq "3.1" ) && ($ddir eq "debian")) {
    107         system "apt-get update; apt-get -y install autoconf automake libtool g++ wget patch mondo groff imagemagick docbook-utils docbook2x docbook-to-man ssh dpkg-dev sudo debian-builder dh-make fakeroot libnewt-dev ntpdate libncurses5-dev libdate-manip-perl libappconfig-perl";
     101        system "apt-get update; apt-get -y install autoconf automake libtool g++ wget patch mondo groff imagemagick docbook-utils docbook2x docbook-to-man ssh dpkg-dev sudo debian-builder dh-make fakeroot libnewt-dev ntpdate libncurses5-dev libdate-manip-perl";
    108102    } elsif (( $dver eq "7.10" ) && ($ddir eq "ubuntu")) {
    109         system "apt-get update; apt-get -y install autoconf automake libtool g++ wget patch groff imagemagick docbook-utils docbook2x docbook-to-man openssh-server dpkg-dev sudo debian-builder dh-make fakeroot libnewt-dev ntpdate libncurses5-dev libdate-manip-perl libappconfig-perl wodim genisoimage afio buffer";
     103        system "apt-get update; apt-get -y install autoconf automake libtool g++ wget patch groff imagemagick docbook-utils docbook2x docbook-to-man openssh-server dpkg-dev sudo debian-builder dh-make fakeroot libnewt-dev ntpdate libncurses5-dev libdate-manip-perl wodim genisoimage afio buffer";
    110104    } else  {
    111         system "apt-get update; apt-get -y install autoconf automake libtool g++ wget patch mondo groff imagemagick docbook-utils docbook2x docbook-to-man openssh-server dpkg-dev sudo debian-builder dh-make fakeroot libnewt-dev ntpdate libncurses5-dev libdate-manip-perl libappconfig-perl";
     105        system "apt-get update; apt-get -y install autoconf automake libtool g++ wget patch mondo groff imagemagick docbook-utils docbook2x docbook-to-man openssh-server dpkg-dev sudo debian-builder dh-make fakeroot libnewt-dev ntpdate libncurses5-dev libdate-manip-perl";
    112106    }
    113107} elsif ( $dfam eq "gen" ) {
    114         #system "emerge -u system ; emerge neon newt slang autoconf automake subversion libtool gcc wget vim man groff lynx grub afio buffer sudo ntp AppConfig DateManip";
     108        #system "emerge -u system ; emerge neon newt slang autoconf automake subversion libtool gcc wget vim man groff lynx grub afio buffer sudo ntp DateManip";
    115109} else {
    116110    print "No pkg to install\n";
     
    140134system "/usr/sbin/ntpdate ntp.home.musique-ancienne.org";
    141135
    142 # Patch AppConfig
    143 my $module=`find /usr/*/perl5 -type f -name File.pm | grep AppConfig/File.pm`;
    144 chomp($module);
    145 $found = 0;
    146 open(PBFILE,$module) || die "Unable to open $module";
    147 while (<PBFILE>) {
    148     $found = 1 if (/Fix a bug if the variable is a hash/);
    149 }
    150 close(PBFILE);
    151 
    152 if ( $found == 0 ) {
    153     chdir basename($module);
    154     open(PBFILE,$module) || die "Unable to open $module";
    155     my $module1 = $module."new";
    156     open(PBOUT," > $module1") || die "Unable to open $module1";
    157     while (<PBFILE>) {
    158             s/^use AppConfig;/use AppConfig qw(:argcount);/;
    159             if (/# variables prefixed '-' are reset to their default values/) {
    160 print PBOUT << 'EOF';
    161                  # Fix a bug if the variable is a hash - 1 has been created as a key
    162                  if ($nargs eq AppConfig::ARGCOUNT_HASH) {
    163                      delete $state->{ VARIABLE }->{ $variable }{1};
    164                  }
    165 
    166 EOF
    167             }
    168             print PBOUT "$_";
    169     }
    170     close(PBFILE);
    171     close(PBOUT);
    172     rename($module1,$module);
    173 }
    174 
    175136system "rm -rf project-builder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/project-builder-latest.tar.gz ; tar xvfz project-builder-latest.tar.gz ; cd project-builder-* ; perl Makefile.PL ; make ; make install ; cd ..";
    176137
  • devel/pb/lib/ProjectBuilder/Base.pm

    r288 r291  
    1111use File::Path;
    1212use File::Temp qw /tempdir/;
    13 use AppConfig qw(ARGCOUNT_HASH);
    1413use Data::Dumper;
    1514
     
    127126        }
    128127    }
    129     die "Invalid version name $ENV{'PBVER'} in $ENV{'PBCONF'}/$proj.pb" if (($ENV{'PBVER'} !~ /[0-9.]+/) && (not exists $version{$ENV{'PBVER'}}));
     128    die "Invalid version name $ENV{'PBVER'} in $ENV{'PBCONF'}/$proj.pb" if (($ENV{'PBVER'} !~ /[0-9.]+/) && (not defined $version) && ($ENV{'PBVER'} =~ /$version{$proj}/));
    130129   
    131130    if (not defined $ENV{'PBTAG'}) {
     
    754753}
    755754
    756 sub pb_no_err {
    757 }
    758 
    759755# Function which returns a pointer on a hash
    760756# corresponding to a declaration (arg2) in a conf file (arg1)
     
    765761my $trace;
    766762my @ptr;
     763my %h;
    767764
    768765my $debug = 0;
    769766
    770 if ($debug > 0) {
    771     $trace = 1;
    772 } else {
    773     $trace = 0;
    774 }
    775 
    776 
    777 my $config = AppConfig->new({
    778                             # Auto Create variables mentioned in Conf file
    779                             CREATE => 1,
    780                             DEBUG => $trace,
    781                             ERROR => \&pb_no_err,
    782                             GLOBAL => {
    783                                 # Each conf item is a hash
    784                                 ARGCOUNT => ARGCOUNT_HASH,
    785                             },
    786                         });
    787 $config->file($conffile);
     767open(CONF,$conffile) || die "Unable to open $conffile";
     768while(<CONF>) {
     769    if (/^\s*([A-z0-9-_]+)\s+([[A-z0-9-_]+)\s*=\s*(.+)$/) {
     770        print "DEBUG: 1:$1 2:$2 3:$3\n" if ($debug >= 1);
     771        $h{$1}{$2}=$3;
     772    }
     773}
     774close(CONF);
     775
    788776for my $param (@param) {
    789     push @ptr,$config->get($param);
    790 }
    791 print "DEBUG: params: ".Dumper(@param)." ".Dumper(@ptr)."\n" if ($debug >= 1);
     777    push @ptr,$h{$param};
     778}
     779print "DEBUG: h:".Dumper(%h)." param:".Dumper(@param)." ptr:".Dumper(@ptr)."\n" if ($debug >= 1);
    792780return(@ptr);
    793781}
     
    10301018my $ptr; # returned value pointer on the hash of filters
    10311019my %ptr;
     1020my %h;
    10321021
    10331022# Global filter files first, then package specificities
     
    10621051    print $LOG "DEBUG ffiles: ".Dumper(\@ffiles)."\n" if ($debug >= 1);
    10631052
    1064     my $config = AppConfig->new({
    1065         # Auto Create variables mentioned in Conf file
    1066         CREATE => 1,
    1067         DEBUG => 0,
    1068         GLOBAL => {
    1069             # Each conf item is a hash
    1070             ARGCOUNT => AppConfig::ARGCOUNT_HASH
     1053    foreach my $f (@ffiles) {
     1054        open(CONF,$f) || next;
     1055        while(<CONF>)  {
     1056            if (/^\s*([A-z0-9-_]+)\s+([[A-z0-9-_]+)\s*=\s*(.+)$/) {
     1057                $h{$1}{$2}=$3;
     1058            }
    10711059        }
    1072     });
    1073 
    1074     $config->file(@ffiles);
    1075     $ptr = $config->get("filter");
    1076     print $LOG "DEBUG f:".Dumper($ptr)."\n" if ($debug >= 1);
     1060        close(CONF);
     1061
     1062        $ptr = $h{"filter"};
     1063        print $LOG "DEBUG f:".Dumper($ptr)."\n" if ($debug >= 1);
     1064    }
    10771065} else {
    10781066    $ptr = { };
  • devel/pbconf/pb.pb

    r290 r291  
    6666#pkgver project-builder = devel
    6767#pkgtag project-builder = 1
    68 pkgver nil
    69 pkgtag nil
    7068
    7169# Is it a test version
    72 testver pb
     70testver pb = true
    7371
    7472# Hash of default package/package directory
     
    7977
    8078# Hash of valid version names
    81 version devel
    82 version stable
     79version pb = devel,stable
    8380
    8481# List of files per pkg on which to apply filters
  • devel/pbconf/project-builder/rpm/project-builder.spec

    r287 r291  
    1616BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
    1717BuildArch:  noarch
    18 Requires:   perl >= 5.8.4, perl-DateManip, perl-AppConfig, PBDEP
     18Requires:   perl >= 5.8.4, perl-DateManip, PBDEP
    1919Provides:   perl(ProjectBuilder::Changelog), perl(ProjectBuilder::Base), perl(ProjectBuilder::Distribution), perl(ProjectBuilder::Version)
    2020
Note: See TracChangeset for help on using the changeset viewer.