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 .
28 # Set the variable $File::Find::dont_use_nlink if you're using AFS,
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
;
43 && ( push @findlist, $name );
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";
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
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
>;
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\"";
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";
90 foreach my $j (@headlines, @bodylines, @taillines) {