Changeset 2241 in ProjectBuilder for devel/pb-modules/lib/ProjectBuilder


Ignore:
Timestamp:
Aug 2, 2017, 6:16:44 PM (7 years ago)
Author:
Bruno Cornec
Message:

revert last commit as this is not ready yet for integration in that tree !

Location:
devel/pb-modules/lib/ProjectBuilder
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Conf.pm

    r2239 r2241  
    1919use ProjectBuilder::Base;
    2020use ProjectBuilder::Version;
     21#use YAML;
    2122
    2223# Inherit from the "Exporter" module which handles exporting functions.
    2324 
    24 use vars qw($VERSION $REVISION $PBCONFVER @ISA @EXPORT);
     25use vars qw($VERSION $REVISION @ISA @EXPORT);
    2526use Exporter;
    2627 
     
    3031our @ISA = qw(Exporter);
    3132our @EXPORT = qw(pb_conf_init pb_conf_add pb_conf_read pb_conf_read_if pb_conf_write pb_conf_get pb_conf_get_if pb_conf_get_all pb_conf_get_hash pb_conf_cache);
    32 ($VERSION,$REVISION,$PBCONFVER) = pb_version_init();
     33($VERSION,$REVISION) = pb_version_init();
    3334
    3435# Global hash of conf files
     
    6970to allow for overwrite to work:
    7071
    71 1. /usr/share/pb/pb.yml    - the read-only system conf file provided by install
    72 2. /etc/pb/pb.yml          - the same global conf file given to the sysadmin in order to make system wide modifications
     721. /usr/share/pb/pb.conf    - the read-only system conf file provided by install
     732. /etc/pb/pb.conf          - the same global conf file given to the sysadmin in order to make system wide modifications
    73743. /path/to/project.pb      - Configuration file for the project we're building for
    74754. /(vm|ve|rm)path/to/.pbrc - configuration file for VM, VE or RM specific parameters. Cumulative should be orthogonal
     
    123124my $cf = shift;
    124125my $lh = shift;
    125 
    126 my $ldfunc;
    127 
    128 eval {
    129     require YAML;
    130     YAML->import();
    131     $ldfunc = \&YAML::LoadFile;
    132 };
    133 if ($@) {
    134     # No YAML found using a more std but less complete one. Old perl only
    135     use Module::Build::YAML;
    136     $ldfunc = \&Module::Build::YAML::LoadFile;
    137 }
     126my $confver = "0.14";
    138127
    139128# Read the content of the config file and cache it in the %h hash then available for queries
    140 if ($PBCONFVER < 1) {
     129if ($confver < 0.15) {
    141130    open(CONF,$cf) || confess "Unable to open $cf";
    142131    # This is the original conf file format for versions up to 0.14
     
    150139    close(CONF);
    151140} else {
    152     $lh = $ldfunc->($cf);
     141    $lh = LoadFile($cf);
    153142}
    154143return($lh);
     
    262251my $conffile = shift;
    263252my $h = shift;
    264 my $dpfunc;
    265 
    266 eval {
    267     require YAML;
    268     YAML->import();
    269     $dpfunc = \&YAML::Dump;
    270 };
    271 if ($@) {
    272     # No YAML found using a more std but less complete one. Old perl only
    273     use Module::Build::YAML;
    274     $dpfunc = \&Module::Build::YAML::Dump;
    275 }
     253my $confver = "0.14";
    276254
    277255confess "No configuration file defined to write into !" if (not defined $conffile);
     
    279257open(CONF,"> $conffile") || confess "Unable to write into $conffile";
    280258
    281 if ($PBCONFVER < 1) {
     259if ($confver < 0.15) {
    282260    # This is the original conf file format for versions up to 0.14
    283261    foreach my $p (sort keys %$h) {
     
    289267} else {
    290268    # This is the new YAML format
    291     print CONF $dpfunc->($h);
     269    print CONF Dump($h);
    292270}
    293271close(CONF);
  • devel/pb-modules/lib/ProjectBuilder/Distribution.pm

    r2239 r2241  
    2626# Inherit from the "Exporter" module which handles exporting functions.
    2727 
    28 use vars qw($VERSION $REVISION $PBCONFVER @ISA @EXPORT);
     28use vars qw($VERSION $REVISION @ISA @EXPORT);
    2929use Exporter;
    3030 
     
    3434our @ISA = qw(Exporter);
    3535our @EXPORT = qw(pb_distro_init pb_distro_conffile pb_distro_sysconffile pb_distro_get pb_distro_getlsb pb_distro_installdeps pb_distro_getdeps pb_distro_only_deps_needed pb_distro_setuprepo pb_distro_setuposrepo pb_distro_setuprepo_gen pb_distro_get_param pb_distro_get_context pb_distro_to_keylist pb_distro_conf_print pb_apply_conf_proxy);
    36 ($VERSION,$REVISION,$PBCONFVER) = pb_version_init();
     36($VERSION,$REVISION) = pb_version_init();
    3737
    3838=pod
     
    7777sub pb_distro_conffile {
    7878
    79 if ($PBCONFVER < 1) {
    80     return("CCCC/pb.conf");
    81 } else {
    82     return("CCCC/pb.yml");
    83 }
     79return("CCCC/pb.conf");
    8480}
    8581
     
    9288sub pb_distro_sysconffile {
    9389
    94 if ($PBCONFVER < 1) {
    95     return("SSSS/pb.conf");
    96 } else {
    97     return("SSSS/pb.yml");
    98 }
     90return("SSSS/pb.conf");
    9991}
    10092
     
    10799Mandriva, Open SuSE and Fedora have all the same "rpm" type of build system. Ubuntu and Debian have the same "deb" type of build system.
    108100And "fc" is the extension generated for all Fedora packages (Version will be added by pb).
    109 All this information is stored in an external configuration file typically at /etc/pb/pb.yml
     101All this information is stored in an external configuration file typically at /etc/pb/pb.conf
    110102
    111103When passing the distribution name and version as parameters, the B<pb_distro_init> function returns the parameter of that distribution instead of the underlying one.
     
    643635            my $dirdest = "";
    644636            my $reponame = "";
    645             # TODO: could go in pb.yml in fact
     637            # TODO: could go in pb.conf in fact
    646638            if ($pbos->{install} =~ /\byum\b/) {
    647639                $reponame="yum";
  • devel/pb-modules/lib/ProjectBuilder/Version.pm

    r2239 r2241  
    2929my $projectbuilderver = $VERSION;
    3030my $projectbuilderrev = $REVISION;
    31 # We fix the format of the conf file for this version of pb
    32 my $projectbuilderconfver = 1;
    3331
    34 return($projectbuilderver,$projectbuilderrev,$projectbuilderconfver);
     32return($projectbuilderver,$projectbuilderrev);
    3533}
    36341;
Note: See TracChangeset for help on using the changeset viewer.