Changeset 234 for trunk/dasscm


Ignore:
Timestamp:
Oct 8, 2008, 4:29:29 PM (16 years ago)
Author:
joergs
Message:

removed the requirement for perl-libconfigfile, because it didn't exist for all systems. Replaced by the simple get_config function

Location:
trunk/dasscm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dasscm/dasscm

    r233 r234  
    1515use File::Path;
    1616use Term::ReadKey;
    17 
    18 #
    19 # used ConfigFile instead of SmartClient::Config,
    20 # because the huge amount of SmartClient dependencies
    21 #use SmartClient::Config;
    22 use ConfigFile;
     17#use Data::Dumper;
    2318
    2419#####################################################################
     
    3227# configuration file
    3328my $config_file = "/etc/dasscm.conf";
    34 my $config      = ConfigFile::read_config_file($config_file);
     29my $config      = get_config($config_file);
    3530my $DASSCM_LOCAL_REPOSITORY_BASE;
    3631my $DASSCM_REPOSITORY_NAME;
     
    9792    exit 1
    9893}
     94
     95sub get_config
     96{
     97    my $file   = $_[0];
     98
     99    if( ! $file ) {
     100        fatalerror( "failed to open config file" . $file );
     101    }
     102
     103    my $data = {};
     104
     105    # try to open config file
     106    if ( !open( FH, $file ) ) {
     107        fatalerror( "failed to open config file" . $file );
     108    } else {
     109        while (<FH>) {
     110            chomp;
     111            if (/^#/) {
     112                next;
     113            }
     114            if ( $_ =~ /=/g ) {
     115                ## splitting in 2 fields at maximum
     116                my ( $option, $value ) = split( /=/, $_, 2 );
     117                $option =~ s/^\s+//g;
     118                $option =~ s/\s+$//g;
     119                $option =~ s/\"+//g;
     120                $value  =~ s/^\s+//g;
     121                $value  =~ s/\s+$//g;
     122                $value  =~ s/\"+//g;
     123
     124                if ( length($option) ) {
     125                    $data->{$option} = $value;
     126                }
     127            }
     128        }
     129    }
     130    close(FH);
     131
     132    return $data;
     133}
     134
    99135
    100136sub check_env()
  • trunk/dasscm/dasscm.spec

    r232 r234  
    1212Autoreqprov:    on
    1313Summary:        dass configuration management tool
    14 Version:        0.7
     14Version:        0.8
    1515Release:        0
    16 Requires:       subversion perl perl-TermReadKey perl-libconfigfile
     16Requires:       subversion perl perl-TermReadKey
    1717Source:         %{name}-%{version}.tar.bz2
    1818Packager:       joerg.steffens@dass-it.de
Note: See TracChangeset for help on using the changeset viewer.