# remove installed file even from the file list
# Params: file_list file_to_remove
remove_file()
{
rm -f "$DESTDIR/$2"
perl -pi -e "s|^$2$||""$1"
}
# move one file from one list of files to a second one
# Params: target_file_list source_file_list file_to_move
mv_file_between_flists()
{ if grep "^$3\$" $2 >/dev/null 2>&1 ; then
# \$3 can be regular expression
grep "^$3\$" $2 >>$1
perl -pi -e "s|^$3$||" $2
fi
}
# add the directories from the source list of files to the target list of
# file which are used in the target list of files but are missing there
# Params: target_file_list source_file_list
add_used_directories()
{
sort -u -r $2 | sed -n "s|^%dir \(.*\)\$|s%^\\\\(\1\\\\).*%\\\\1%p|p" >$2.pattern
sed -n -f $2.pattern $1 | sort -u | sed "s|^|%dir |" >>$1
rm $2.pattern
sort -u $1 >$1.unique
mv $1.unique $1
}
# remove a duplicity between two filelist
# Params: filelist_with_original filelist_with_duplicity duplicit_path
remove_duplicity_from_flists()
{ if grep "$3""$1" >/dev/null 2>&1 && \
grep "$3""$2" >/dev/null 2>&1 ; then
perl -pi -e "s|^$3$||" $2
fi
}
# merges one file list into another one
# Params: source_filelist dest_filelist replace_dest
merge_flists()
{ if test -f "$1" ; then
cat "$1" >>"$2"
sort -u "$2" >"$2".sorted
mv "$2".sorted "$2"
fi
}
if ! test -f $DESTDIR/gid_Module_Root; then
echo "Error: Failed to generate package file lists";
echo " Have you defined DESTDIR?"
exit
fi
rm -rf "$FILELISTSDIR"
mkdir -p "$FILELISTSDIR"
cd $DESTDIR
if test "z$OOO_VENDOR" != "zDebian" ; then
echo "Generating package file lists for $OOO_VENDOR..."
rm -f common_list.txt for module in gid_Module_Root gid_Module_Root_Brand \
gid_Module_Root_Files_[0-9] \
gid_Module_Root_Hack \
gid_Module_Oo_Linguistic \
gid_Module_Root_Extension_Dictionary_* \
gid_Module_Root_Ure_Hidden ; do
merge_flists $module $FILELISTSDIR/common_list.txt
done
# it is not a real extension; it used to be in the main package...
merge_flists gid_Module_Optional_Extensions_Script_Provider_For_JS $FILELISTSDIR/common_list.txt
if test "$SPLIT_APP_MODULES" = "TRUE" -a "$OOO_VENDOR" = "SUSE" ; then
# move the prebuilt icons into a hacky temporary package
# we want to repack them into a noarch package as soon as possible
# without the build dependency on the huge devel package
merge_flists gid_Module_Root_Files_Images $FILELISTSDIR/icon_themes_prebuilt.txt else
merge_flists gid_Module_Root_Files_Images $FILELISTSDIR/common_list.txt
fi
# lang packs for lang in `echo $WITH_LANG_LIST | sed -e s/-/_/g`; do
lang_lists= if test "$OOO_VENDOR" = "Mandriva" -o \( "$OOO_VENDOR" = "SUSE" -a "$SPLIT_APP_MODULES" = "TRUE" \) ; then
test -f gid_Module_Langpack_Basis_$lang && lang_lists="$lang_lists gid_Module_Langpack_Basis_$lang" || :
test -f gid_Module_Langpack_Brand_$lang && lang_lists="$lang_lists gid_Module_Langpack_Brand_$lang" || :
test -f gid_Module_Langpack_Resource_$lang && lang_lists="$lang_lists gid_Module_Langpack_Resource_$lang" || :
test -f gid_Module_Langpack_Impress_$lang && lang_lists="$lang_lists gid_Module_Langpack_Impress_$lang" || :
test -f gid_Module_Langpack_Draw_$lang && lang_lists="$lang_lists gid_Module_Langpack_Draw_$lang" || :
test -f gid_Module_Langpack_Math_$lang && lang_lists="$lang_lists gid_Module_Langpack_Math_$lang" || :
test -f gid_Module_Langpack_Calc_$lang && lang_lists="$lang_lists gid_Module_Langpack_Calc_$lang" || :
test -f gid_Module_Langpack_Base_$lang && lang_lists="$lang_lists gid_Module_Langpack_Base_$lang" || :
test -f gid_Module_Langpack_Writer_$lang && lang_lists="$lang_lists gid_Module_Langpack_Writer_$lang" || :
# Place helps on dedicated packages.
test -f gid_Module_Helppack_Help_$lang && sort -u gid_Module_Helppack_Help_$lang > $FILELISTSDIR/help_${lang}_list.txt || : else
test -f gid_Module_Langpack_Basis_$lang && lang_lists="$lang_lists gid_Module_Langpack_Basis_$lang" || :
test -f gid_Module_Langpack_Brand_$lang && lang_lists="$lang_lists gid_Module_Langpack_Brand_$lang" || :
test -f gid_Module_Langpack_Resource_$lang && lang_lists="$lang_lists gid_Module_Langpack_Resource_$lang" || :
test -f gid_Module_Langpack_Impress_$lang && lang_lists="$lang_lists gid_Module_Langpack_Impress_$lang" || :
test -f gid_Module_Langpack_Draw_$lang && lang_lists="$lang_lists gid_Module_Langpack_Draw_$lang" || :
test -f gid_Module_Langpack_Math_$lang && lang_lists="$lang_lists gid_Module_Langpack_Math_$lang" || :
test -f gid_Module_Langpack_Calc_$lang && lang_lists="$lang_lists gid_Module_Langpack_Calc_$lang" || :
test -f gid_Module_Langpack_Base_$lang && lang_lists="$lang_lists gid_Module_Langpack_Base_$lang" || :
test -f gid_Module_Langpack_Writer_$lang && lang_lists="$lang_lists gid_Module_Langpack_Writer_$lang" || :
test -f gid_Module_Helppack_Help_$lang && lang_lists="$lang_lists gid_Module_Helppack_Help_$lang" || :
fi if test -n "$lang_lists" ; then
# all files are installed below $INSTALLDIR/basis; we want to own also $INSTALLDIR
echo "%dir $INSTALLDIR" >$FILELISTSDIR/lang_${lang}_list.txt
cat $lang_lists | sort -u >>$FILELISTSDIR/lang_${lang}_list.txt
fi
# some help files are in _Langpack_{Writer,Impress,...}_<lang>
# move them from -l10n to -help if test "$OOO_VENDOR" = "Mandriva" -o \( "$OOO_VENDOR" = "SUSE" -a "$SPLIT_APP_MODULES" = "TRUE" \) ; then for lang in `echo $WITH_LANG_LIST | sed -e s/-/_/g`; do
test -f $FILELISTSDIR/help_${lang}_list.txt || continue;
mv_file_between_flists $FILELISTSDIR/help_${lang}_list.txt $FILELISTSDIR/lang_${lang}_list.txt $INSTALLDIR/help/.*
add_used_directories $FILELISTSDIR/help_${lang}_list.txt $FILELISTSDIR/lang_${lang}_list.txt
done
fi
done
if test -f $FILELISTSDIR/lang_en_US_list.txt -a "$OOO_VENDOR" = "SUSE" -a "$SPLIT_APP_MODULES" != "TRUE" ; then
cat $FILELISTSDIR/lang_en_US_list.txt >>$FILELISTSDIR/common_list.txt
rm $FILELISTSDIR/lang_en_US_list.txt
fi
if test -f gid_Module_Root_SDK ; then
cp gid_Module_Root_SDK $FILELISTSDIR/sdk_list.txt
fi
# mailmerge if test "$SPLIT_OPT_FEATURES" = "TRUE" ; then if test "z$OOO_VENDOR" = "zMandriva" ; then
flist=pyuno_list.txt else
flist=mailmerge_list.txt
fi
mv_file_between_flists $flist common_list.txt $INSTALLDIR/program/mailmerge.py
add_used_directories $flist common_list.txt
fi
if test "z$OOO_VENDOR" = "zSUSE" ; then
# officebean subpackage
test -f $DESTDIR/gid_Module_Optional_Extensions_Script_Provider_For_BS && cp $DESTDIR/gid_Module_Optional_Extensions_Script_Provider_For_BS officebean_list.txt || :
mv_file_between_flists officebean_list.txt common_list.txt $INSTALLDIR/program/classes/officebean.jar
mv_file_between_flists officebean_list.txt common_list.txt $INSTALLDIR/program/libofficebean.so
add_used_directories officebean_list.txt common_list.txt
fi
if test -f sdk_list.txt ; then
# in thiscase we move all entries including directories
mv_file_between_flists sdk_doc_list.txt sdk_list.txt "%dir $DOCDIR/sdk/docs.*"
mv_file_between_flists sdk_doc_list.txt sdk_list.txt "$DOCDIR/sdk/docs.*"
mv_file_between_flists sdk_doc_list.txt sdk_list.txt "$DOCDIR/sdk/examples"
mv_file_between_flists sdk_doc_list.txt sdk_list.txt "$DOCDIR/sdk/index.html"
mv_file_between_flists sdk_doc_list.txt sdk_list.txt "%dir $INSTALLDIR/sdk/examples.*"
mv_file_between_flists sdk_doc_list.txt sdk_list.txt "$INSTALLDIR/sdk/docs"
mv_file_between_flists sdk_doc_list.txt sdk_list.txt "$INSTALLDIR/sdk/examples.*"
mv_file_between_flists sdk_doc_list.txt sdk_list.txt "$INSTALLDIR/sdk/index.html"
add_used_directories sdk_doc_list.txt sdk_list.txt
fi
# Mandriva packaging if test "$OOO_VENDOR" = "Mandriva"; then
# Not used
remove_file common_list.txt $INSTALLDIR/share/gallery/htmltheme.orig
remove_file common_list.txt $INSTALLDIR/share/dict/ooo/dictionary.lst
# And these are in -draw package
mv_file_between_flists draw_list.txt common_list.txt $INSTALLDIR/share/registry/modules/org/openoffice/TypeDetection/Filter/fcfg_drawgraphics_filters.xcu
mv_file_between_flists draw_list.txt common_list.txt $INSTALLDIR/share/registry/modules/org/openoffice/TypeDetection/Filter/fcfg_drawgraphics_types.xcu
# And these are in -impress package
mv_file_between_flists impress_list.txt common_list.txt $INSTALLDIR/share/registry/modules/org/openoffice/TypeDetection/Filter/fcfg_impressgraphics_filters.xcu
mv_file_between_flists impress_list.txt common_list.txt $INSTALLDIR/share/registry/modules/org/openoffice/TypeDetection/Types/fcfg_impressgraphics_types.xcu
# Split out the gallery
mv_file_between_flists gallery_list.txt common_list.txt "$INSTALLDIR/share/gallery.*"
test -r galleries.txt && cat galleries.txt >> gallery_list.txt
# Split out dtd-officedocument1.0
mv_file_between_flists dtd_list.txt common_list.txt "$INSTALLDIR/share/dtd/officedocument.*"
# Move arch-dependent/dup files from common to core for f in \ ".*\.so" \ ".*\.so\..*" \ "program/.*\.rdb" \
program/configimport.bin \
program/javaldx \
program/msfontextract \
program/oosplash.bin \
program/pagein \
program/pagein-calc \
program/pagein-common \
program/pagein-draw \
program/pagein-impress \
program/pagein-writer \
program/pkgchk.bin \
program/pluginapp.bin \
program/setofficelang.bin \
program/soffice.bin \
program/uno.bin \
program/unopkg.bin \
program/uri-encode do
mv_file_between_flists core_list.txt common_list.txt "$INSTALLDIR/$f"
done
# themes are included in other packages
# don't use remove_file as we don't want them removed from the buildroot.
mv_file_between_flists /dev/null common_list.txt $INSTALLDIR/share/config/images_crystal.zip
mv_file_between_flists /dev/null common_list.txt $INSTALLDIR/share/config/images_hicontrast.zip
mv_file_between_flists /dev/null common_list.txt $INSTALLDIR/share/config/images.zip
fi
# remove known duplicities to do not have files packaged in two packages
# the Bulgarian fixes can be removed after the issue #54110 is fixed
remove_duplicity_from_flists common_list.txt lang_bg_list.txt $INSTALLDIR/presets/config/arrowhd.soe
remove_duplicity_from_flists common_list.txt lang_bg_list.txt $INSTALLDIR/presets/config/classic.sog
remove_duplicity_from_flists common_list.txt lang_bg_list.txt $INSTALLDIR/presets/config/hatching.soh
remove_duplicity_from_flists common_list.txt lang_bg_list.txt $INSTALLDIR/presets/config/modern.sog
remove_duplicity_from_flists common_list.txt lang_bg_list.txt $INSTALLDIR/presets/config/palette.soc
remove_duplicity_from_flists common_list.txt lang_bg_list.txt $INSTALLDIR/presets/config/styles.sod
# the British fixes can be removed after the issue #54113 is fixed
remove_duplicity_from_flists common_list.txt lang_en-GB_list.txt $INSTALLDIR/presets/config/standard.sog
for l in `echo $WITH_LANG_LIST`; do for p in Impress Draw Math Calc Base Writer; do
create_package_directory gid_Module_Langpack_${p}_`echo $l | sed -e s/-/_/g` pkg/libreoffice-l10n-$l
done
create_package_directory gid_Module_Langpack_Basis_`echo $l | sed -e s/-/_/g` pkg/libreoffice-l10n-$l
create_package_directory gid_Module_Langpack_Brand_`echo $l | sed -e s/-/_/g` pkg/libreoffice-l10n-$l
create_package_directory gid_Module_Langpack_Resource_`echo $l | sed -e s/-/_/g` pkg/libreoffice-l10n-$l
create_package_directory gid_Module_Helppack_Help_`echo $l | sed -e s/-/_/g` pkg/libreoffice-help-$l
# some help files are in _Langpack_{Writer,Impress,...}_<lang>
# move them from -l10n to -help if [ "$l" = "en-US" ]; then d=en; else d=$l; fi
mv pkg/libreoffice-l10n-$l/$INSTALLDIR/help/$d/* \ pkg/libreoffice-help-$l/$INSTALLDIR/help/$d && \ rmdir pkg/libreoffice-l10n-$l/$INSTALLDIR/help/$d done
# Move all libraries, binaries, *.rdb from -common to -core for d in $INSTALLDIR/program $INSTALLDIR/program; do \ if [ ! -d $DESTDIR/pkg/libreoffice-core/$d ]; then \ mkdir -p $DESTDIR/pkg/libreoffice-core/$d; \ fi && ( cd pkg/libreoffice-common/$d find -maxdepth 1 \ -regex '\./\(.*\.so.*\|.*\.bin\|pagein\|msfontextract\|.*\.rdb\|javaldx\|uri-encode\)' \ -exec mv {} $DESTDIR/pkg/libreoffice-core/$d \; ); \ done
# install additional ooo-build scripts & misc stuff mkdir -p pkg/libreoffice-common/usr/share/man/man1 if test "$COMPAT_OOWRAPPERS" = "YES" ; then mv usr/share/man/man1/openoffice$BINSUFFIX.1 \ pkg/libreoffice-common/usr/share/man/man1 fi mv usr/share/man/man1/libreoffice$BINSUFFIX.1 \ pkg/libreoffice-common/usr/share/man/man1 mkdir -p pkg/libreoffice-common/etc/bash_completion.d if test "$COMPAT_OOWRAPPERS" = "YES" ; then mv etc/bash_completion.d/ooffice$BINSUFFIX.sh \ pkg/libreoffice-common/etc/bash_completion.d fi mv etc/bash_completion.d/libreoffice$BINSUFFIX.sh \ pkg/libreoffice-common/etc/bash_completion.d mv .$INSTALLDIR/program/java-set-classpath \ pkg/libreoffice-common/$INSTALLDIR/program if echo $WITH_LANG_LIST | grep -q en-US; then for i in forms/resume.ott officorr/project-proposal.ott; do \ mkdir -p pkg/libreoffice-common/$INSTALLDIR/share/template/en-US/`dirname $i`; \ mv .$INSTALLDIR/share/template/en-US/$i \ pkg/libreoffice-common/$INSTALLDIR/share/template/en-US/$i; \ done; \ fi # Warn for any remaining files find . -path './pkg' -prune -o -not -name 'gid_Module_*' -not -type d -exec echo "File not packaged: {}" \; fi
# mark the config files RPM_CONFIG_FILE_TAGS= if test "$OOO_VENDOR" = "SUSE" -o "$OOO_VENDOR" = "RedHat"; then RPM_CONFIG_FILE_TAGS="%config" elif test "$OOO_VENDOR" = "PLD" ; then RPM_CONFIG_FILE_TAGS="%config(noreplace) %verify(not md5 size mtime)" fi