bump product version to 4.1.6.2
[LibreOffice.git] / solenv / bin / makemani.pl
blob94c5f7f7f476bb40cdaf9c40345d0a2e62b72d25
1 #! /usr/bin/perl -w
2 eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
3 if 0; #$running_under_some_shell
5 # This file is part of the LibreOffice project.
7 # This Source Code Form is subject to the terms of the Mozilla Public
8 # License, v. 2.0. If a copy of the MPL was not distributed with this
9 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 # This file incorporates work covered by the following license notice:
13 # Licensed to the Apache Software Foundation (ASF) under one or more
14 # contributor license agreements. See the NOTICE file distributed
15 # with this work for additional information regarding copyright
16 # ownership. The ASF licenses this file to you under the Apache
17 # License, Version 2.0 (the "License"); you may not use this file
18 # except in compliance with the License. You may obtain a copy of
19 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 use strict;
23 use File::Find ();
24 use Cwd qw (cwd);
26 my @findlist;
28 # Set the variable $File::Find::dont_use_nlink if you're using AFS,
29 # since AFS cheats.
31 # for the convenience of &wanted calls, including -eval statements:
32 use vars qw/*name *dir *prune/;
33 *name = *File::Find::name;
34 *dir = *File::Find::dir;
35 *prune = *File::Find::prune;
37 sub wanted;
41 sub wanted {
42 /^.*\.xc(s|u)\z/s
43 && ( push @findlist, $name );
46 sub usage
48 print STDERR "\n$0 - append *.xcu file entries to .oxt manifest.xml\n\n";
49 print STDERR "usage: $0 <static_part> <start dir> <search dir> <destination dir>\n\n";
50 print STDERR " static part - file containig all other content for mainfest.xml\n";
51 print STDERR " start dir - directory to change to before starting search\n";
52 print STDERR " out dir - destination directory to write manifes.xml to\n\n";
53 exit 1;
56 if ( $#ARGV != 3 ) { usage(); };
58 my $manifest_head = $ARGV[0];
59 my $start_dir = $ARGV[1];
60 my $dynamic_dir = $ARGV[2];
61 my $out_dir = $ARGV[3];
63 # Traverse desired filesystems
64 my $work_dir = cwd();
65 chdir $start_dir or die "$0: ERROR - cannot change directory to \"$start_dir\"\n";
66 File::Find::find({wanted => \&wanted}, $dynamic_dir);
67 chdir $work_dir or die "$0: ERROR - oops... cannot change dir to where i came from!\n";
69 open (HEAD, "$manifest_head") or die "$0: ERROR - Cannot open $manifest_head\n";
70 my @headlines = <HEAD>;
71 close HEAD;
72 chomp @headlines;
73 chomp @findlist;
75 my @bodylines;
76 my @taillines = ("</manifest:manifest>");
78 foreach my $i (@findlist) {
79 if ($i =~ m/^.*\.xcu\z/s) {
80 push @bodylines, " <manifest:file-entry manifest:media-type=\"application/vnd.sun.star.configuration-data\"";
81 } else {
82 push @bodylines, " <manifest:file-entry manifest:media-type=\"application/vnd.sun.star.configuration-schema\"";
84 push @bodylines, " manifest:full-path=\"$i\"/>";
87 open (MANIOUT,">$out_dir/manifest.xml") or die "$0: ERROR - cannot open \"$out_dir/manifest.xml\" for writing.\n";
88 binmode MANIOUT;
90 foreach my $j (@headlines, @bodylines, @taillines) {
91 print MANIOUT "$j\n";
94 close MANIOUT;