Bump for 3.6-28
[LibreOffice.git] / solenv / bin / gen_update_info.pl
blobae2aa6f251e0ce477d169ef1818fdba5a67a58a9
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
5 #*************************************************************************
7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9 # Copyright 2000, 2010 Oracle and/or its affiliates.
11 # OpenOffice.org - a multi-platform office productivity suite
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
33 #*********************************************************************
35 # main
38 my($product, $buildid, $id, $os, $arch, $lstfile, $languages, $productname, $productversion, $productedition);
40 while ($_ = $ARGV[0], /^-/) {
41 shift;
42 last if /^--$/;
43 if (/^--product/) {
44 $product= $ARGV[0];
45 shift;
47 if (/^--buildid/) {
48 $buildid = $ARGV[0];
49 shift;
51 if (/^--os/) {
52 $os = $ARGV[0];
53 shift;
55 if (/^--arch/) {
56 $arch = $ARGV[0];
57 shift;
59 if (/^--lstfile/) {
60 $lstfile = $ARGV[0];
61 shift;
63 if (/^--languages/) {
64 $languages = $ARGV[0];
65 shift;
69 $sourcefile = $ARGV[0];
71 if( $^O =~ /cygwin/i ) {
72 # We might get paths with backslashes, fix that.
73 $lstfile =~ s/\\/\//g;
74 $sourcefile =~ s/\\/\//g;
77 # read openoffice.lst
78 # reading Globals section
79 unless(open(LSTFILE, "sed -n \"/^Globals\$/,/^}\$/ p\" $lstfile |")) {
80 print STDERR "Can't open $lstfile file: $!\n";
81 return;
84 while (<LSTFILE>) {
85 if( /\bPRODUCTNAME / ) {
86 chomp;
87 s/.*PRODUCTNAME //;
88 $productname = $_;
90 if( /\bPACKAGEVERSION / ) {
91 chomp;
92 s/.*PACKAGEVERSION //;
93 $productversion = $_;
95 if( /\bPRODUCTEDITION / ) {
96 chomp;
97 s/.*PRODUCTEDITION //;
98 $productedition = $_;
102 close(LSTFILE);
104 ### may be hierarchical ...
105 if(open(LSTFILE, "sed -n \"/^$product:/,/^}\$/ p\" $lstfile |")) {
106 while (<LSTFILE>) {
107 if ( /^$product\s?:\s?(\w+)$/ ) {
108 $product = $1;
110 if( /\bPRODUCTEDITION / ) {
111 chomp;
112 s/.*PRODUCTEDITION //;
113 $productedition = $_;
117 close(LSTFILE);
119 # Reading product specific settings
121 unless(open(LSTFILE, "sed -n \"/^$product\$/,/^}\$/ p\" $lstfile |")) {
122 print STDERR "Can't open $lstfile file: $!\n";
123 return;
126 while (<LSTFILE>) {
127 if( /\bPRODUCTNAME / ) {
128 chomp;
129 s/.*PRODUCTNAME //;
130 $productname = $_;
132 if( /\bPACKAGEVERSION / ) {
133 chomp;
134 s/.*PACKAGEVERSION //;
135 $productversion = $_;
137 if( /\bPRODUCTEDITION / ) {
138 chomp;
139 s/.*PRODUCTEDITION //;
140 $productedition = $_;
144 close(LSTFILE);
146 # simulate the behavior of make_installer.pl when writing versionrc
147 unless( "$os" eq "Windows" ) {
148 $languages =~ s/_.*//;
151 $id = $productversion;
152 $id =~ s/\..*//;
153 $id = $productname . "_" . $id . "_" . $languages;
155 # open input file
156 unless (open(SOURCE, $sourcefile)) {
157 print STDERR "Can't open $sourcefile file: $!\n";
158 return;
161 while (<SOURCE>) {
162 s/:id></:id>$id</;
163 s/buildid></buildid>$buildid</;
164 s/os></os>$os</;
165 s/arch></arch>$arch</;
166 if ( $productedition ) {
167 s/edition></edition>$productedition</;
168 } else {
169 next if ( /edition></ );
171 s/version></version>$productversion</;
172 s/name></name>$productname</;
173 print;
176 close(SOURCE);