#!/usr/bin/perl -w # # Project Builder conf file convertor # # $Id$ # # Copyright B. Cornec 2016-today # Provided under the GPL v2 use strict 'vars'; use Getopt::Long qw(:config auto_abbrev no_ignore_case); use Carp qw/confess cluck/; use Data::Dumper; use English; use ProjectBuilder::Version; use ProjectBuilder::Base; use ProjectBuilder::Display; use ProjectBuilder::Env; use ProjectBuilder::Conf; =pod =head1 NAME pbupdconf, updates project-builder.org conf files format to the latest version =head1 DESCRIPTION pbupdconf, updates project-builder.org conf files format to the latest version Starting with version 0.15, YAML is the default format for conf files Up to version 0.14 the file format was 'proprietary', meaning dedicated to pb. =head1 SYNOPSIS pbupdconf [-vhq] /path/to/conffile pbupdconf [--verbose][--help][--man][--quiet] /path/to/conffile =head1 OPTIONS =over 4 =item B<-v|--verbose> Increase verbosity =item B<-q|--quiet> Do not print any output. =item B<-h|--help> Print a brief help message and exits. =item B<--man> Prints the manual page and exits. =back #=head1 ARGUMENTS # can be: #=over 4 #=item B #=back =head1 WEB SITES The main Web site of the project is available at L. Bug reports should be filled using the trac instance of the project at L. =head1 AUTHORS The Project-Builder.org team L lead by Bruno Cornec L. =head1 COPYRIGHT Project-Builder.org is distributed under the GPL v2.0 license described in the file C included with the distribution. =cut my ($projectbuilderver,$projectbuilderrev,$pbconfver) = pb_version_init(); my $appname = "pbupdconf"; # Initialize the syntax string pb_syntax_init("$appname (aka project-builder.org) Version $projectbuilderver-$projectbuilderrev\n"); my %opts; GetOptions("help|?|h+" => \$opts{'h'}, "man" => \$opts{'man'}, "quiet|q" => \$opts{'q'}, "verbose|v+" => \$opts{'v'}, "version|V=s" => \$opts{'V'}, "stop-on-error!" => \$Global::pb_stop_on_error, ) || pb_syntax(-1,0); if (defined $opts{'h'}) { pb_syntax(0,$opts{'h'}-1); } if (defined $opts{'man'}) { pb_syntax(0,2); } if (defined $opts{'v'}) { $pbdebug = $opts{'v'}; } if (defined $opts{'q'}) { $pbdebug=-1; } pb_display_init("text",""); # We need to force the version if (not defined $opts{'V'}) { pb_log(0, "You need to specify the current version of your conf files (use 0 if you don't know)\n"); pb_syntax(-1,0); } use vars qw($VERSION $REVISION $PBCONFVER @ISA @EXPORT); use Exporter; ($VERSION,$REVISION,$PBCONFVER) = pb_version_init(); my ($filteredfiles, $supfiles, $defpkgdir, $extpkgdir) = pb_env_init(undef,0,"getconf",0); while (@ARGV) { # Process each cnf file at its turn pb_conf_read() my $h = pb_conf_get_hash(); #print "%pbconffiles".Dumper(%pbconffiles)."\n"; print "\$h".Dumper($h)."\n"; # Dump the Perl data structures back into YAML. print Dump($string, $arrayref, $hashref); # YAML::Dump is used the same way you'd use Data::Dumper::Dumper use Data::Dumper; print Dumper($string, $arrayref, $hashref);