source: ProjectBuilder/devel/pb-modules/bin/pbupdconf@ 2239

Last change on this file since 2239 was 2239, checked in by Bruno Cornec, 7 years ago

Start move to YAML conf files

  • Property svn:executable set to *
File size: 3.1 KB
Line 
1#!/usr/bin/perl -w
2#
3# Project Builder conf file convertor
4#
5# $Id$
6#
7# Copyright B. Cornec 2016-today
8# Provided under the GPL v2
9
10use strict 'vars';
11
12use Getopt::Long qw(:config auto_abbrev no_ignore_case);
13use Carp qw/confess cluck/;
14use Data::Dumper;
15use English;
16use ProjectBuilder::Version;
17use ProjectBuilder::Base;
18use ProjectBuilder::Display;
19use ProjectBuilder::Env;
20use ProjectBuilder::Conf;
21
22=pod
23
24=head1 NAME
25
26pbupdconf, updates project-builder.org conf files format to the latest version
27
28=head1 DESCRIPTION
29
30pbupdconf, updates project-builder.org conf files format to the latest version
31Starting with version 0.15, YAML is the default format for conf files
32Up to version 0.14 the file format was 'proprietary', meaning dedicated to pb.
33
34=head1 SYNOPSIS
35
36pbupdconf [-vhq] /path/to/conffile
37
38pbupdconf [--verbose][--help][--man][--quiet] /path/to/conffile
39
40=head1 OPTIONS
41
42=over 4
43
44=item B<-v|--verbose>
45
46Increase verbosity
47
48=item B<-q|--quiet>
49
50Do not print any output.
51
52=item B<-h|--help>
53
54Print a brief help message and exits.
55
56=item B<--man>
57
58Prints the manual page and exits.
59
60=back
61
62#=head1 ARGUMENTS
63
64#<action> can be:
65
66#=over 4
67
68#=item B<sbx2build>
69
70#=back
71
72=head1 WEB SITES
73
74The main Web site of the project is available at L<http://www.project-builder.org/>. Bug reports should be filled using the trac instance of the project at L<http://trac.project-builder.org/>.
75
76=head1 AUTHORS
77
78The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>.
79
80=head1 COPYRIGHT
81
82Project-Builder.org is distributed under the GPL v2.0 license
83described in the file C<COPYING> included with the distribution.
84
85=cut
86
87my ($projectbuilderver,$projectbuilderrev,$pbconfver) = pb_version_init();
88my $appname = "pbupdconf";
89
90# Initialize the syntax string
91
92pb_syntax_init("$appname (aka project-builder.org) Version $projectbuilderver-$projectbuilderrev\n");
93
94my %opts;
95
96GetOptions("help|?|h+" => \$opts{'h'},
97 "man" => \$opts{'man'},
98 "quiet|q" => \$opts{'q'},
99 "verbose|v+" => \$opts{'v'},
100 "version|V=s" => \$opts{'V'},
101 "stop-on-error!" => \$Global::pb_stop_on_error,
102) || pb_syntax(-1,0);
103
104if (defined $opts{'h'}) {
105 pb_syntax(0,$opts{'h'}-1);
106}
107if (defined $opts{'man'}) {
108 pb_syntax(0,2);
109}
110if (defined $opts{'v'}) {
111 $pbdebug = $opts{'v'};
112}
113
114if (defined $opts{'q'}) {
115 $pbdebug=-1;
116}
117pb_display_init("text","");
118
119# We need to force the version
120if (not defined $opts{'V'}) {
121 pb_log(0, "You need to specify the current version of your conf files (use 0 if you don't know)\n");
122 pb_syntax(-1,0);
123}
124
125use vars qw($VERSION $REVISION $PBCONFVER @ISA @EXPORT);
126use Exporter;
127($VERSION,$REVISION,$PBCONFVER) = pb_version_init();
128
129my ($filteredfiles, $supfiles, $defpkgdir, $extpkgdir) = pb_env_init(undef,0,"getconf",0);
130
131while (@ARGV) {
132 # Process each cnf file at its turn
133 pb_conf_read()
134
135my $h = pb_conf_get_hash();
136#print "%pbconffiles".Dumper(%pbconffiles)."\n";
137print "\$h".Dumper($h)."\n";
138
139 # Dump the Perl data structures back into YAML.
140 print Dump($string, $arrayref, $hashref);
141
142 # YAML::Dump is used the same way you'd use Data::Dumper::Dumper
143 use Data::Dumper;
144 print Dumper($string, $arrayref, $hashref);
145
Note: See TracBrowser for help on using the repository browser.