Changeset 2239 in ProjectBuilder


Ignore:
Timestamp:
Jul 31, 2017, 1:25:12 AM (7 years ago)
Author:
Bruno Cornec
Message:

Start move to YAML conf files

Files:
1 added
15 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-doc/SECURITY

    r2234 r2239  
    99In the Distributions.pm module there are sudo calls, corresponding to the abilty to configure automatically additional repositories. That feature may not be used on RM or solved manually without problem. In case this is used, and sudo isn't configured accordingly, then the additional repo will NOT be added and the build will probably fail.
    1010
    11 In the default pb.conf main configuration files, parameters for osupd and osins for the various distributions call sudo to make the installation of missing packages. These calls are done as 'pb' user by default (or the account configured as rmlogin in the configuration file). In case this is used, and sudo isn't configured accordingly, then the additional required packages will NOT be added and the build will probably fail.
     11In the default pb.yml main configuration files, parameters for osupd and osins for the various distributions call sudo to make the installation of missing packages. These calls are done as 'pb' user by default (or the account configured as rmlogin in the configuration file). In case this is used, and sudo isn't configured accordingly, then the additional required packages will NOT be added and the build will probably fail.
    1212For RM, we may consider that all required packages for the build are already installed on the system, or give rpm/yum/dnf/apt/urpmi/zypper... sudo rights to the build account manually.
    1313Recommended for a manual setup (not using rmsetup): Add manually to your system sudo access for the pb account to the local package install and update command such as /bin/rpm e.g:
  • devel/pb-modules/Makefile.PL

    r2136 r2239  
    7474    $text .= "\t".'chmod 755 $(DESTDIR)'."$sharedir\n";
    7575    $text .= "\t".'cp etc/pb.conf $(DESTDIR)'."$sharedir\n";
     76    $text .= "\t".'cp etc/pb.yml $(DESTDIR)'."$sharedir\n";
    7677
    7778    # Also create a fake version in /etc/pb for sysadmin to modify
     
    7980    $text .= "\t".'chmod 755 $(DESTDIR)'."$sysconfdir\n";
    8081    $text .= "\t".'perl -p -e \'s|^|#|\' etc/pb.conf > $(DESTDIR)/'."$sysconfdir/pb.conf\n";
     82    $text .= "\t".'perl -p -e \'s|^|#|\' etc/pb.yml > $(DESTDIR)/'."$sysconfdir/pb.yml\n";
    8183    # Doesn't seem to work in the makefile generated for now :-(
    8284    #$text .= "\t".'perl -p -e \'s|^([^#])|#$1|\' etc/pb.conf > $(DESTDIR)/'."$sysconfdir/pb.conf\n";
     
    8587    $text .= "\t".'mkdir -p $(DESTDIR)'."$mandir/man5\n";
    8688    $text .= "\t".'pod2man --section=5 etc/pb.conf.pod > $(DESTDIR)'."$mandir/man5/pb.conf.5\n";
     89    $text .= "\t".'pod2man --section=5 etc/pb.conf.pod > $(DESTDIR)'."$mandir/man5/pb.yml.5\n";
    8790    return($text);
    8891}
  • devel/pb-modules/bin/pbdistrocheck

    r2175 r2239  
    9494=head1 CONFIGURATION FILES
    9595
    96 Uses the main /etc/pb/pb.conf (or /usr/local/etc/pb/pb.conf if installed from files) configuration file to give its answers.
     96Uses the main /etc/pb/pb.yml (or /usr/local/etc/pb/pb.yml if installed from files) configuration file to give its answers.
    9797
    9898=head1 AUTHORS
  • devel/pb-modules/bin/pbgetparam

    r2223 r2239  
    7575=head1 CONFIGURATION FILES
    7676
    77 Uses the main /etc/pb/pb.conf (or /usr/local/etc/pb/pb.conf if installed from files) configuration file to give its answers.
     77Uses the main /etc/pb/pb.yml (or /usr/local/etc/pb/pb.yml if installed from files) configuration file to give its answers.
    7878
    7979=head1 AUTHORS
  • devel/pb-modules/etc/pb.conf.pod

    r2234 r2239  
    1717The key could be also default, in which case it will be used as a default value if no more precise content is given for the key.
    1818
    19 Each value is detailed below giving the nature of its use (Mandatory or Optional - only used for certain feature), the value of the key (could be the project, an OS name, default, ...), the value of the parameter field and its format, the default configuration file in which it should be defined (home $HOME/.pbrc, conf /etc/pb/pb.conf or /usr/local/etc/pb/pb.conf, VE vepath/.pbrc, VM vmpath/.pbrc,  or project project.pb) and an example of use.
     19Each value is detailed below giving the nature of its use (Mandatory or Optional - only used for certain feature), the value of the key (could be the project, an OS name, default, ...), the value of the parameter field and its format, the default configuration file in which it should be defined (home $HOME/.pbrc, conf /etc/pb/pb.yml or /usr/local/etc/pb/pb.yml, VE vepath/.pbrc, VM vmpath/.pbrc,  or project project.pb) and an example of use.
    2020
    2121=head1 OPTIONS
  • devel/pb-modules/etc/pb.yml

    r2224 r2239  
     1---
    12# $Id$
    2 # 
     3#
    34# Main configuration file for project-builder.org
    45#
     
    910#
    1011# Define Operating systems
    11 # 
    12 
    13 # 
     12#
     13
     14#
    1415# For the following keys osrelfile and osrelambfile:
    1516# The left member is the key that will be used overall as the OS name
     
    1920# all the keys from osrelfile and osrelambfile, and the values of osrelambfile
    2021#
    21 ---
    2222#
    2323# The following conf info are for pb_distro_get (man ProjectBuilder::Distribution)
     
    558558# What is the regular expression to find the kernel file
    559559  mkbmkernelnamere:
    560     linux: ^linu|^vmlinu|^xen
     560      #linux: ^linu|^vmlinu|^xen
    561561
    562562# Files to add on the boot media to support a full working system
     
    568568    linux:
    569569# Commands to add
    570   mkbmbasecmds
     570  mkbmbasecmds:
    571571    linux: file,bzip2,bunzip2,bash,date,ctrlaltdel,wc,xargs,less,ldconfig,tee,efibootmgr,lilo,grub,elilo,fdisk,parted
    572572#
    573573# To support debug
    574   mkbmdbgfiles
     574  mkbmdbgfiles:
    575575    linux:
    576   mkbmdbgcmds
     576  mkbmdbgcmds:
    577577    linux: ldd,strace,valgrind,dmidecode,lsusb,lshw,lspci,ethtool
    578   mkbmdbgdirs
     578  mkbmdbgdirs:
    579579    linux: /usr/lib/valgrind,/usr/lib64/valgrind
    580580
    581581# Where are the ISO bootloader for this OS
    582   mkbmisobl
     582  mkbmisobl:
    583583    linux: /usr/lib/syslinux/isolinux.bin,/usr/lib64/syslinux/isolinux.bin
    584   mkbmkbd
     584  mkbmkbd:
    585585    mageia: /usr/lib/kbd
    586586
     
    661661    rhel-7: wget,make,ntpdate,patch,perl-Date-Manip,rpm-build,diffutils,perl-Module-Build
    662662    centos-7: wget,make,ntpdate,patch,perl-Date-Manip,rpm-build,diffutils,perl-Module-Build,perl-ExtUtils-MakeMaker,perl-File-MimeInfo,perl-File-BaseDir
    663     redhat =
     663    redhat:
    664664    suse: wget,make,ntp,patch,diffutils
    665665    opensuse: openSUSE-release,wget,make,ntp,patch,perl-Date-Manip,perl-File-HomeDir,diffutils,rpm-build
     
    792792# Do you want to see detailed sudo commands or just the summary of them
    793793# Useful for security concerns, nice to have it as a parameter
    794 pbshowsudo:
     794  pbshowsudo:
    795795    default: false
    796796
    797797# Do not stop on errors by default (VE/VM are still broken with it on)
    798 pbstoponerr:
     798  pbstoponerr:
    799799    default: false
    800800
     
    809809# Where is the associated repo
    810810  osrepo:
    811     redhat-6.2 =
     811    redhat-6.2:
    812812    rpm: ftp://ftp.project-builder.org/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}/pb.repo
    813813    mageia: ftp://ftp.project-builder.org/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}/pb.addmedia
     
    872872# CPAN upload info (info from cpanupload)
    873873#
    874 cpanpause:
     874  cpanpause:
    875875    default: pause.perl.org
    876 cpandir:
     876  cpandir:
    877877    default: incoming
    878 cpansubdir:
     878  cpansubdir:
    879879    default:
    880 cpanurl:
     880  cpanurl:
    881881    default: http://pause.perl.org/pause/authenquery
    882882#cpanuser:
  • devel/pb-modules/lib/ProjectBuilder/Conf.pm

    r2176 r2239  
    1919use ProjectBuilder::Base;
    2020use ProjectBuilder::Version;
    21 #use YAML;
    2221
    2322# Inherit from the "Exporter" module which handles exporting functions.
    2423 
    25 use vars qw($VERSION $REVISION @ISA @EXPORT);
     24use vars qw($VERSION $REVISION $PBCONFVER @ISA @EXPORT);
    2625use Exporter;
    2726 
     
    3130our @ISA = qw(Exporter);
    3231our @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);
    33 ($VERSION,$REVISION) = pb_version_init();
     32($VERSION,$REVISION,$PBCONFVER) = pb_version_init();
    3433
    3534# Global hash of conf files
     
    7069to allow for overwrite to work:
    7170
    72 1. /usr/share/pb/pb.conf    - the read-only system conf file provided by install
    73 2. /etc/pb/pb.conf          - the same global conf file given to the sysadmin in order to make system wide modifications
     711. /usr/share/pb/pb.yml    - the read-only system conf file provided by install
     722. /etc/pb/pb.yml          - the same global conf file given to the sysadmin in order to make system wide modifications
    74733. /path/to/project.pb      - Configuration file for the project we're building for
    75744. /(vm|ve|rm)path/to/.pbrc - configuration file for VM, VE or RM specific parameters. Cumulative should be orthogonal
     
    124123my $cf = shift;
    125124my $lh = shift;
    126 my $confver = "0.14";
     125
     126my $ldfunc;
     127
     128eval {
     129    require YAML;
     130    YAML->import();
     131    $ldfunc = \&YAML::LoadFile;
     132};
     133if ($@) {
     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}
    127138
    128139# Read the content of the config file and cache it in the %h hash then available for queries
    129 if ($confver < 0.15) {
     140if ($PBCONFVER < 1) {
    130141    open(CONF,$cf) || confess "Unable to open $cf";
    131142    # This is the original conf file format for versions up to 0.14
     
    139150    close(CONF);
    140151} else {
    141     $lh = LoadFile($cf);
     152    $lh = $ldfunc->($cf);
    142153}
    143154return($lh);
     
    251262my $conffile = shift;
    252263my $h = shift;
    253 my $confver = "0.14";
     264my $dpfunc;
     265
     266eval {
     267    require YAML;
     268    YAML->import();
     269    $dpfunc = \&YAML::Dump;
     270};
     271if ($@) {
     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}
    254276
    255277confess "No configuration file defined to write into !" if (not defined $conffile);
     
    257279open(CONF,"> $conffile") || confess "Unable to write into $conffile";
    258280
    259 if ($confver < 0.15) {
     281if ($PBCONFVER < 1) {
    260282    # This is the original conf file format for versions up to 0.14
    261283    foreach my $p (sort keys %$h) {
     
    267289} else {
    268290    # This is the new YAML format
    269     print CONF Dump($h);
     291    print CONF $dpfunc->($h);
    270292}
    271293close(CONF);
  • devel/pb-modules/lib/ProjectBuilder/Distribution.pm

    r2234 r2239  
    2626# Inherit from the "Exporter" module which handles exporting functions.
    2727 
    28 use vars qw($VERSION $REVISION @ISA @EXPORT);
     28use vars qw($VERSION $REVISION $PBCONFVER @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) = pb_version_init();
     36($VERSION,$REVISION,$PBCONFVER) = pb_version_init();
    3737
    3838=pod
     
    7777sub pb_distro_conffile {
    7878
    79 return("CCCC/pb.conf");
     79if ($PBCONFVER < 1) {
     80    return("CCCC/pb.conf");
     81} else {
     82    return("CCCC/pb.yml");
     83}
    8084}
    8185
     
    8892sub pb_distro_sysconffile {
    8993
    90 return("SSSS/pb.conf");
     94if ($PBCONFVER < 1) {
     95    return("SSSS/pb.conf");
     96} else {
     97    return("SSSS/pb.yml");
     98}
    9199}
    92100
     
    99107Mandriva, Open SuSE and Fedora have all the same "rpm" type of build system. Ubuntu and Debian have the same "deb" type of build system.
    100108And "fc" is the extension generated for all Fedora packages (Version will be added by pb).
    101 All this information is stored in an external configuration file typically at /etc/pb/pb.conf
     109All this information is stored in an external configuration file typically at /etc/pb/pb.yml
    102110
    103111When 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.
     
    635643            my $dirdest = "";
    636644            my $reponame = "";
    637             # TODO: could go in pb.conf in fact
     645            # TODO: could go in pb.yml in fact
    638646            if ($pbos->{install} =~ /\byum\b/) {
    639647                $reponame="yum";
  • devel/pb-modules/lib/ProjectBuilder/Version.pm

    r2105 r2239  
    2929my $projectbuilderver = $VERSION;
    3030my $projectbuilderrev = $REVISION;
     31# We fix the format of the conf file for this version of pb
     32my $projectbuilderconfver = 1;
    3133
    32 return($projectbuilderver,$projectbuilderrev);
     34return($projectbuilderver,$projectbuilderrev,$projectbuilderconfver);
    3335}
    34361;
  • devel/pb/bin/pb

    r2234 r2239  
    831831    if ($@) {
    832832        # Sys::CPU not found, defaulting to 1
    833         pb_log(1,"ADVISE: Install Sys::CPU to benefit from automatic parallelism optimization.\nOr use pbparallel in your pb.conf file\nOnly 1 process at a time for the moment\n");
     833        pb_log(1,"ADVISE: Install Sys::CPU to benefit from automatic parallelism optimization.\nOr use pbparallel in your pb.yml file\nOnly 1 process at a time for the moment\n");
    834834        $pbparallel = 1;
    835835    } else {
     
    49064906    if ($@) {
    49074907        # Linux::SysInfo not found
    4908         pb_log(1,"ADVISE: Install Linux::SysInfo to benefit from automatic parallelism optimization.\nOr optimize manually pbparallel in your pb.conf file\nUsing $pbparallel processes max at a time for the moment\nWARNING: This may consume too much memory for your system\n");
     4908        pb_log(1,"ADVISE: Install Linux::SysInfo to benefit from automatic parallelism optimization.\nOr optimize manually pbparallel in your pb.yml file\nUsing $pbparallel processes max at a time for the moment\nWARNING: This may consume too much memory for your system\n");
    49094909    } else {
    49104910        # Using the memory size
    49114911        my $si = Linux::SysInfo::sysinfo();
    49124912        if (not defined $si) {
    4913             pb_log(1,"ADVISE: Install Linux::SysInfo to benefit from automatic parallelism optimization.\nOr optimize manually pbparallel in your pb.conf file\nUsing $pbparallel processes max at a time for the moment\nWARNING: This may consume too much memory for your system\n");
     4913            pb_log(1,"ADVISE: Install Linux::SysInfo to benefit from automatic parallelism optimization.\nOr optimize manually pbparallel in your pb.yml file\nUsing $pbparallel processes max at a time for the moment\nWARNING: This may consume too much memory for your system\n");
    49144914        } else {
    49154915            # Keep the number of VM whose memory can be allocated
  • devel/pbmkbm/bin/pbmkbm

    r2032 r2239  
    183183=head1 CONFIGURATION FILE
    184184
    185 Uses Project-Builder.org configuration file (/etc/pb/pb.conf or /usr/local/etc/pb/pb.conf)
     185Uses Project-Builder.org configuration file (/etc/pb/pb.yml or /usr/local/etc/pb/pb.yml)
    186186
    187187=head1 AUTHORS
  • devel/rpmbootstrap/bin/rpmbootstrap

    r2234 r2239  
    5050rpmbootstrap works in 2 phases. The first one is used to download all
    5151the required packages to have a working package management system in the
    52 chroot working. This list of packages is stored in /etc/pb/pb.conf under
     52chroot working. This list of packages is stored in /etc/pb/pb.yml under
    5353the rbsmindep parameter (aka rpmbootstrap minimal dependencies). Once the
    5454packages have been downloaded from the mirror, they are extracted with
     
    160160=head1 CONFIGURATION FILE
    161161
    162 Uses Project-Builder.org configuration file (/etc/pb/pb.conf or /usr/local/etc/pb/pb.conf)
     162Uses Project-Builder.org configuration file (/etc/pb/pb.yml or /usr/local/etc/pb/pb.yml)
    163163
    164164=head1 AUTHORS
  • pbconf/devel/ProjectBuilder/pbfilter/rpm.pbf

    r1844 r2239  
    88
    99# PBDEP is replaced by the list of dependencies
    10 filter PBDEP =
     10filter PBDEP = perl-YAML
    1111filter PBBUILDDEP = BuildRequires: rpm-build
    1212
  • pbconf/devel/ProjectBuilder/pkg/prototype.example

    r876 r2239  
    33d none /etc/pb 0755 bin bin
    44f none /etc/pb/pb.conf 0644 bin bin
     5f none /etc/pb/pb.yml 0644 bin bin
    56f none /usr/bin/pbdistrocheck 0755 bin bin
    67d none /usr/pb 0755 bin bin
  • pbconf/devel/pb.pb

    r2236 r2239  
    3535# Global version/tag for the project
    3636#
    37 projver pb = 0.14.6
     37projver pb = 0.15.1
    3838projtag pb = 1
    3939
Note: See TracChangeset for help on using the changeset viewer.