2009-10-18 11:17:26 +02:00
|
|
|
#-
|
2011-01-26 13:37:37 +01:00
|
|
|
# Copyright (c) 2008-2011 Juan Romero Pardines.
|
2009-10-18 11:17:26 +02:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#-
|
|
|
|
|
|
|
|
xbps_write_metadata_pkg()
|
|
|
|
{
|
|
|
|
local subpkg spkgrev
|
|
|
|
|
|
|
|
for subpkg in ${subpackages}; do
|
|
|
|
if [ -n "${revision}" ]; then
|
2009-11-22 08:31:44 +01:00
|
|
|
spkgrev="${subpkg}-${version}_${revision}"
|
2009-10-18 11:17:26 +02:00
|
|
|
else
|
2009-11-22 08:31:44 +01:00
|
|
|
spkgrev="${subpkg}-${version}"
|
2009-10-18 11:17:26 +02:00
|
|
|
fi
|
|
|
|
check_installed_pkg ${spkgrev}
|
2011-07-08 09:48:09 +02:00
|
|
|
if [ $? -eq 0 -a -z "$DESTDIR_ONLY_INSTALL" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2009-10-18 11:17:26 +02:00
|
|
|
|
2009-11-22 08:31:44 +01:00
|
|
|
if [ ! -f $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template ]; then
|
2010-12-20 00:22:12 +01:00
|
|
|
msg_error "Cannot find subpkg '${subpkg}' build template!\n"
|
2009-10-18 11:17:26 +02:00
|
|
|
fi
|
2009-11-23 06:30:04 +01:00
|
|
|
setup_tmpl ${sourcepkg}
|
|
|
|
unset run_depends conf_files noarch triggers replaces \
|
2011-10-26 15:19:51 +02:00
|
|
|
revision system_accounts system_groups \
|
2010-01-14 16:24:40 +01:00
|
|
|
preserve keep_empty_dirs xml_entries sgml_entries \
|
2010-04-12 19:07:24 +02:00
|
|
|
xml_catalogs sgml_catalogs gconf_entries gconf_schemas \
|
2011-01-26 13:37:37 +01:00
|
|
|
gtk_iconcache_dirs font_dirs dkms_modules provides \
|
2011-10-05 14:29:06 +02:00
|
|
|
kernel_hooks_version conflicts pycompile_dirs \
|
2011-10-10 11:51:49 +02:00
|
|
|
pycompile_module systemd_services
|
2009-11-23 06:30:04 +01:00
|
|
|
. $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template
|
2009-11-22 08:31:44 +01:00
|
|
|
pkgname=${subpkg}
|
2009-10-18 11:17:26 +02:00
|
|
|
set_tmpl_common_vars
|
2010-01-10 17:09:23 +01:00
|
|
|
verify_rundeps ${DESTDIR}
|
2009-10-18 11:17:26 +02:00
|
|
|
xbps_write_metadata_pkg_real
|
|
|
|
done
|
|
|
|
|
2011-10-24 20:18:16 +02:00
|
|
|
if [ -n "$build_style" -a "$build_style" = "meta-template" -a -z "${run_depends}" ]; then
|
2009-10-18 11:17:26 +02:00
|
|
|
for spkg in ${subpackages}; do
|
|
|
|
if [ -n "${revision}" ]; then
|
2009-11-22 08:31:44 +01:00
|
|
|
spkgrev="${spkg}-${version}_$revision"
|
2009-10-18 11:17:26 +02:00
|
|
|
else
|
2009-11-22 08:31:44 +01:00
|
|
|
spkgrev="${spkg}-${version}"
|
2009-10-18 11:17:26 +02:00
|
|
|
fi
|
|
|
|
run_depends="${run_depends} ${spkgrev}"
|
|
|
|
done
|
|
|
|
fi
|
2009-11-23 06:30:04 +01:00
|
|
|
setup_tmpl ${sourcepkg}
|
2010-01-10 17:09:23 +01:00
|
|
|
# Verify pkg deps.
|
|
|
|
verify_rundeps ${DESTDIR}
|
2009-10-18 11:17:26 +02:00
|
|
|
xbps_write_metadata_pkg_real
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# This function writes the metadata files into package's destdir,
|
|
|
|
# these will be used for binary packages.
|
|
|
|
#
|
|
|
|
xbps_write_metadata_pkg_real()
|
|
|
|
{
|
2011-07-18 18:52:49 +02:00
|
|
|
local metadir=${DESTDIR}/var/db/xbps/metadata/$pkgname
|
2009-10-18 11:17:26 +02:00
|
|
|
local f i j found arch dirat lnkat newlnk lver TMPFLIST TMPFPLIST
|
|
|
|
local fpattern="s|${DESTDIR}||g;s|^\./$||g;/^$/d"
|
|
|
|
|
|
|
|
if [ ! -d "${DESTDIR}" ]; then
|
2010-12-20 00:22:12 +01:00
|
|
|
msg_error "$pkgname not installed into destdir.\n"
|
2009-10-18 11:17:26 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$noarch" ]; then
|
|
|
|
arch=noarch
|
|
|
|
else
|
2011-11-08 11:56:17 +01:00
|
|
|
arch=$XBPS_MACHINE
|
2009-10-18 11:17:26 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$revision" ]; then
|
|
|
|
lver="${version}_${revision}"
|
|
|
|
else
|
|
|
|
lver="${version}"
|
|
|
|
fi
|
|
|
|
|
2011-10-26 16:43:11 +02:00
|
|
|
#
|
|
|
|
# If package provides virtual packages, create dynamically the
|
|
|
|
# required virtualpkg.d files.
|
|
|
|
#
|
|
|
|
if [ -n "$provides" -a -n "$replaces" ]; then
|
|
|
|
_tmpf=$(mktemp) || msg_error "$pkgver: failed to create tempfile.\n"
|
|
|
|
cat > ${_tmpf} <<_EOF
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
|
|
<plist version="1.0">
|
|
|
|
<dict>
|
|
|
|
<key>virtual-pkgver</key>
|
|
|
|
<string>$provides</string>
|
|
|
|
<key>target-pkgpattern</key>
|
2011-10-29 17:29:48 +02:00
|
|
|
<string>$(echo $replaces|sed "s|<|\<|g;s|>|\>|g")</string>
|
2011-10-26 16:43:11 +02:00
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
_EOF
|
|
|
|
install -Dm644 ${_tmpf} \
|
|
|
|
${DESTDIR}/etc/xbps/virtualpkg.d/${pkgname}.plist
|
|
|
|
vmkdir etc/xbps/virtualpkg.d.wants && curcwd=$(pwd) && \
|
|
|
|
cd ${DESTDIR}/etc/xbps/virtualpkg.d.wants && \
|
|
|
|
ln -sf ../virtualpkg.d/${pkgname}.plist . && \
|
|
|
|
cd ${curcwd} && rm -f ${_tmpf} || \
|
|
|
|
msg_error "$pkgver: failed to create virtualpkg.d file in DESTDIR!\n"
|
|
|
|
fi
|
|
|
|
|
2009-10-18 11:17:26 +02:00
|
|
|
#
|
|
|
|
# Find out if this package contains info files and compress
|
|
|
|
# all them with gzip.
|
|
|
|
#
|
2011-06-25 18:36:10 +02:00
|
|
|
if [ -f ${DESTDIR}/usr/share/info/dir ]; then
|
2009-10-18 11:17:26 +02:00
|
|
|
# Always remove this file if curpkg is not texinfo.
|
|
|
|
if [ "$pkgname" != "texinfo" ]; then
|
2011-06-24 21:36:13 +02:00
|
|
|
[ -f ${DESTDIR}/usr/share/info/dir ] && \
|
|
|
|
rm -f ${DESTDIR}/usr/share/info/dir
|
2009-10-18 11:17:26 +02:00
|
|
|
fi
|
|
|
|
# Add info-files trigger.
|
|
|
|
triggers="info-files $triggers"
|
2011-07-18 16:25:18 +02:00
|
|
|
msg_normal "$pkgver: processing info(1) files...\n"
|
2009-10-18 11:17:26 +02:00
|
|
|
|
2010-12-14 16:34:05 +01:00
|
|
|
find ${DESTDIR}/usr/share/info -type f -follow | while read f
|
|
|
|
do
|
|
|
|
j=$(echo "$f"|sed -e "$fpattern")
|
2009-10-18 11:17:26 +02:00
|
|
|
[ "$j" = "" ] && continue
|
|
|
|
[ "$j" = "/usr/share/info/dir" ] && continue
|
|
|
|
# Ignore compressed files.
|
2010-12-14 16:34:05 +01:00
|
|
|
if $(echo "$j"|grep -q '.*.gz$'); then
|
2009-10-18 11:17:26 +02:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
# Ignore non info files.
|
2010-12-14 16:34:05 +01:00
|
|
|
if ! $(echo "$j"|grep -q '.*.info$') && \
|
|
|
|
! $(echo "$j"|grep -q '.*.info-[0-9]*$'); then
|
2009-10-18 11:17:26 +02:00
|
|
|
continue
|
|
|
|
fi
|
2010-12-14 16:34:05 +01:00
|
|
|
if [ -h ${DESTDIR}/"$j" ]; then
|
|
|
|
dirat=$(dirname "$j")
|
|
|
|
lnkat=$(readlink ${DESTDIR}/"$j")
|
|
|
|
newlnk=$(basename "$j")
|
|
|
|
rm -f ${DESTDIR}/"$j"
|
|
|
|
cd ${DESTDIR}/"$dirat"
|
|
|
|
ln -s "${lnkat}".gz "${newlnk}".gz
|
2009-10-18 11:17:26 +02:00
|
|
|
continue
|
|
|
|
fi
|
2010-05-14 00:07:47 +02:00
|
|
|
echo " Compressing info file: $j..."
|
2010-12-14 16:34:05 +01:00
|
|
|
gzip -q9 ${DESTDIR}/"$j"
|
2009-10-18 11:17:26 +02:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Find out if this package contains manual pages and
|
|
|
|
# compress all them with gzip.
|
|
|
|
#
|
|
|
|
if [ -d "${DESTDIR}/usr/share/man" ]; then
|
2011-07-18 16:25:18 +02:00
|
|
|
msg_normal "$pkgver: processing manual pages...\n"
|
2010-12-14 16:34:05 +01:00
|
|
|
find ${DESTDIR}/usr/share/man -type f -follow | while read f
|
|
|
|
do
|
|
|
|
j=$(echo "$f"|sed -e "$fpattern")
|
2009-10-18 11:17:26 +02:00
|
|
|
[ "$j" = "" ] && continue
|
2010-12-14 16:34:05 +01:00
|
|
|
if $(echo "$j"|grep -q '.*.gz$'); then
|
2009-10-18 11:17:26 +02:00
|
|
|
continue
|
|
|
|
fi
|
2010-12-14 16:34:05 +01:00
|
|
|
if [ -h ${DESTDIR}/"$j" ]; then
|
|
|
|
dirat=$(dirname "$j")
|
|
|
|
lnkat=$(readlink ${DESTDIR}/"$j")
|
|
|
|
newlnk=$(basename "$j")
|
|
|
|
rm -f ${DESTDIR}/"$j"
|
|
|
|
cd ${DESTDIR}/"$dirat"
|
|
|
|
ln -s "${lnkat}".gz "${newlnk}".gz
|
2009-10-18 11:17:26 +02:00
|
|
|
continue
|
|
|
|
fi
|
2010-05-14 00:07:47 +02:00
|
|
|
echo " Compressing manpage: $j..."
|
2010-12-14 16:34:05 +01:00
|
|
|
gzip -q9 ${DESTDIR}/"$j"
|
2009-10-18 11:17:26 +02:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2011-05-31 16:39:02 +02:00
|
|
|
# Write the files.plist file.
|
|
|
|
TMPFLIST=$(mktemp -t flist.XXXXXXXXXX) || exit 1
|
|
|
|
TMPFPLIST=$(mktemp -t fplist.XXXXXXXXXX) || exit 1
|
2009-10-18 11:17:26 +02:00
|
|
|
|
2011-07-18 16:25:18 +02:00
|
|
|
msg_normal "$pkgver: creating package metadata...\n"
|
2009-10-18 11:17:26 +02:00
|
|
|
|
2011-05-31 16:39:02 +02:00
|
|
|
cat > "$TMPFPLIST" <<_EOF
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
|
|
<plist version="1.0">
|
|
|
|
<dict>
|
|
|
|
_EOF
|
2009-10-18 11:17:26 +02:00
|
|
|
# Pass 1: add links.
|
|
|
|
echo "<key>links</key>" >> $TMPFPLIST
|
|
|
|
echo "<array>" >> $TMPFPLIST
|
2010-12-14 16:34:05 +01:00
|
|
|
find ${DESTDIR} -type l | while read f
|
|
|
|
do
|
|
|
|
j=$(echo "$f"|sed -e "$fpattern")
|
2009-10-18 11:17:26 +02:00
|
|
|
[ "$j" = "" ] && continue
|
|
|
|
echo "$j" >> $TMPFLIST
|
|
|
|
echo "<dict>" >> $TMPFPLIST
|
|
|
|
echo "<key>file</key>" >> $TMPFPLIST
|
|
|
|
echo "<string>$j</string>" >> $TMPFPLIST
|
2011-05-31 16:39:02 +02:00
|
|
|
echo "<key>target</key>" >> $TMPFPLIST
|
2011-06-04 20:37:55 +02:00
|
|
|
lnk=$(readlink -f "$f"|sed -e "s|${DESTDIR}||")
|
|
|
|
if [ -z "$lnk" -o "$lnk" = "" ]; then
|
2011-07-31 09:38:10 +02:00
|
|
|
lnk=$(readlink "$f"|sed -e "s|${DESTDIR}||")
|
2011-06-04 20:37:55 +02:00
|
|
|
fi
|
|
|
|
echo "<string>$lnk</string>" >> $TMPFPLIST
|
2009-10-18 11:17:26 +02:00
|
|
|
echo "</dict>" >> $TMPFPLIST
|
|
|
|
done
|
|
|
|
echo "</array>" >> $TMPFPLIST
|
|
|
|
|
|
|
|
# Pass 2: add regular files.
|
|
|
|
echo "<key>files</key>" >> $TMPFPLIST
|
|
|
|
echo "<array>" >> $TMPFPLIST
|
2010-12-14 16:34:05 +01:00
|
|
|
find ${DESTDIR} -type f | while read f
|
|
|
|
do
|
|
|
|
j=$(echo "$f"|sed -e "$fpattern")
|
2009-10-18 11:17:26 +02:00
|
|
|
[ "$j" = "" ] && continue
|
|
|
|
echo "$j" >> $TMPFLIST
|
|
|
|
# Skip configuration files.
|
|
|
|
for i in ${conf_files}; do
|
|
|
|
[ "$j" = "$i" ] && found=1 && break
|
|
|
|
done
|
|
|
|
[ -n "$found" ] && unset found && continue
|
|
|
|
echo "<dict>" >> $TMPFPLIST
|
|
|
|
echo "<key>file</key>" >> $TMPFPLIST
|
|
|
|
echo "<string>$j</string>" >> $TMPFPLIST
|
|
|
|
echo "<key>sha256</key>" >> $TMPFPLIST
|
2010-12-14 16:34:05 +01:00
|
|
|
echo "<string>$(${XBPS_DIGEST_CMD} "$f")</string>" \
|
2009-10-27 16:52:40 +01:00
|
|
|
>> $TMPFPLIST
|
2009-10-18 11:17:26 +02:00
|
|
|
echo "</dict>" >> $TMPFPLIST
|
|
|
|
done
|
|
|
|
echo "</array>" >> $TMPFPLIST
|
|
|
|
|
|
|
|
# Pass 3: add directories.
|
|
|
|
echo "<key>dirs</key>" >> $TMPFPLIST
|
|
|
|
echo "<array>" >> $TMPFPLIST
|
2010-12-14 16:34:05 +01:00
|
|
|
find ${DESTDIR} -type d|sort -ur | while read f
|
|
|
|
do
|
|
|
|
j=$(echo "$f"|sed -e "$fpattern")
|
2009-10-18 11:17:26 +02:00
|
|
|
[ "$j" = "" ] && continue
|
|
|
|
echo "$j" >> $TMPFLIST
|
|
|
|
echo "<dict>" >> $TMPFPLIST
|
|
|
|
echo "<key>file</key>" >> $TMPFPLIST
|
|
|
|
echo "<string>$j</string>" >> $TMPFPLIST
|
|
|
|
echo "</dict>" >> $TMPFPLIST
|
|
|
|
done
|
|
|
|
echo "</array>" >> $TMPFPLIST
|
|
|
|
|
|
|
|
# Add configuration files into its own array.
|
|
|
|
if [ -n "${conf_files}" ]; then
|
|
|
|
echo "<key>conf_files</key>" >> $TMPFPLIST
|
|
|
|
echo "<array>" >> $TMPFPLIST
|
|
|
|
for f in ${conf_files}; do
|
2010-12-14 16:34:05 +01:00
|
|
|
i=${DESTDIR}/"${f}"
|
|
|
|
[ ! -f "${i}" ] && continue
|
2009-10-18 11:17:26 +02:00
|
|
|
echo "<dict>" >> $TMPFPLIST
|
|
|
|
echo "<key>file</key>" >> $TMPFPLIST
|
|
|
|
echo "<string>$f</string>" >> $TMPFPLIST
|
|
|
|
echo "<key>sha256</key>" >> $TMPFPLIST
|
2010-12-14 16:34:05 +01:00
|
|
|
echo "<string>$(${XBPS_DIGEST_CMD} "${i}")</string>" \
|
2009-10-29 16:35:22 +01:00
|
|
|
>> $TMPFPLIST
|
2009-10-18 11:17:26 +02:00
|
|
|
echo "</dict>" >> $TMPFPLIST
|
|
|
|
done
|
|
|
|
echo "</array>" >> $TMPFPLIST
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "</dict>" >> $TMPFPLIST
|
|
|
|
echo "</plist>" >> $TMPFPLIST
|
|
|
|
sed -i -e /^$/d $TMPFLIST
|
|
|
|
|
|
|
|
# Write the props.plist file.
|
|
|
|
local TMPFPROPS=$(mktemp -t fprops.XXXXXXXXXX) || exit 1
|
|
|
|
|
2009-10-30 22:14:09 +01:00
|
|
|
local instsize=$(du -sk ${DESTDIR}|awk '{print $1}')
|
|
|
|
|
2009-10-18 11:17:26 +02:00
|
|
|
cat > $TMPFPROPS <<_EOF
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
|
|
<plist version="1.0">
|
|
|
|
<dict>
|
|
|
|
<key>pkgname</key>
|
|
|
|
<string>$pkgname</string>
|
|
|
|
<key>version</key>
|
|
|
|
<string>$lver</string>
|
2009-11-22 08:31:44 +01:00
|
|
|
<key>pkgver</key>
|
2011-07-18 16:25:18 +02:00
|
|
|
<string>$pkgver</string>
|
2009-10-18 11:17:26 +02:00
|
|
|
<key>architecture</key>
|
|
|
|
<string>$arch</string>
|
|
|
|
<key>installed_size</key>
|
2009-10-30 22:14:09 +01:00
|
|
|
<integer>$(($instsize * 1024))</integer>
|
2009-10-18 11:17:26 +02:00
|
|
|
<key>maintainer</key>
|
2010-01-27 03:21:53 +01:00
|
|
|
<string>$(echo $maintainer|sed -e 's|<|\<|g;s|>|\>|g')</string>
|
2009-10-18 11:17:26 +02:00
|
|
|
<key>short_desc</key>
|
|
|
|
<string>$short_desc</string>
|
|
|
|
<key>long_desc</key>
|
|
|
|
<string>$long_desc</string>
|
|
|
|
_EOF
|
2010-12-23 14:29:38 +01:00
|
|
|
#
|
|
|
|
# If package sets $dkms_modules, add dkms rundep.
|
|
|
|
#
|
|
|
|
if [ -n "$dkms_modules" ]; then
|
|
|
|
Add_dependency run dkms
|
|
|
|
fi
|
|
|
|
|
2009-12-19 04:58:25 +01:00
|
|
|
#
|
2010-12-28 11:23:33 +01:00
|
|
|
# If package sets $system_accounts or $system_groups, add shadow rundep.
|
2009-12-19 04:58:25 +01:00
|
|
|
#
|
2010-12-28 11:23:33 +01:00
|
|
|
if [ -n "$system_accounts" -o -n "$system_groups" ]; then
|
2009-12-19 04:58:25 +01:00
|
|
|
Add_dependency run shadow
|
|
|
|
fi
|
|
|
|
|
2009-12-02 03:20:26 +01:00
|
|
|
# pkg needs to preserve its files after removal/upgrade?
|
|
|
|
if [ -n "$preserve" ]; then
|
|
|
|
echo "<key>preserve</key>" >> $TMPFPROPS
|
|
|
|
echo "<true/>" >> $TMPFPROPS
|
|
|
|
fi
|
|
|
|
|
2009-10-18 11:17:26 +02:00
|
|
|
# Dependencies
|
|
|
|
if [ -n "$run_depends" ]; then
|
|
|
|
echo "<key>run_depends</key>" >> $TMPFPROPS
|
|
|
|
echo "<array>" >> $TMPFPROPS
|
|
|
|
for f in ${run_depends}; do
|
2009-11-07 05:01:00 +01:00
|
|
|
echo "<string>$(echo $f|sed "s|<|\<|g;s|>|\>|g")</string>" >> $TMPFPROPS
|
2009-10-18 11:17:26 +02:00
|
|
|
done
|
|
|
|
echo "</array>" >> $TMPFPROPS
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Configuration files
|
|
|
|
if [ -n "$conf_files" ]; then
|
|
|
|
echo "<key>conf_files</key>" >> $TMPFPROPS
|
|
|
|
echo "<array>" >> $TMPFPROPS
|
|
|
|
for f in ${conf_files}; do
|
|
|
|
echo "<string>$f</string>" >> $TMPFPROPS
|
|
|
|
done
|
|
|
|
echo "</array>" >> $TMPFPROPS
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Replace package(s).
|
|
|
|
if [ -n "$replaces" ]; then
|
|
|
|
echo "<key>replaces</key>" >> $TMPFPROPS
|
|
|
|
echo "<array>" >> $TMPFPROPS
|
|
|
|
for f in ${replaces}; do
|
2010-01-20 15:10:23 +01:00
|
|
|
echo "<string>$(echo $f|sed "s|<|\<|g;s|>|\>|g")</string>" >> $TMPFPROPS
|
2010-03-08 10:52:55 +01:00
|
|
|
done
|
|
|
|
echo "</array>" >> $TMPFPROPS
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Conflicting package(s).
|
|
|
|
if [ -n "$conflicts" ]; then
|
|
|
|
echo "<key>conflicts</key>" >> $TMPFPROPS
|
|
|
|
echo "<array>" >> $TMPFPROPS
|
|
|
|
for f in ${conflicts}; do
|
|
|
|
echo "<string>$(echo $f|sed "s|<|\<|g;s|>|\>|g")</string>" >> $TMPFPROPS
|
2009-10-18 11:17:26 +02:00
|
|
|
done
|
|
|
|
echo "</array>" >> $TMPFPROPS
|
|
|
|
fi
|
|
|
|
|
2011-01-26 13:37:37 +01:00
|
|
|
# Provides virtual package(s).
|
|
|
|
if [ -n "$provides" ]; then
|
|
|
|
echo "<key>provides</key>" >> $TMPFPROPS
|
|
|
|
echo "<array>" >> $TMPFPROPS
|
|
|
|
for f in ${provides}; do
|
|
|
|
echo "<string>$(echo $f|sed "s|<|\<|g;s|>|\>|g")</string>" >> $TMPFPROPS
|
|
|
|
done
|
|
|
|
echo "</array>" >> $TMPFPROPS
|
|
|
|
fi
|
|
|
|
|
2011-05-26 10:40:31 +02:00
|
|
|
# Build date.
|
|
|
|
echo "<key>build_date</key>" >> $TMPFPROPS
|
|
|
|
echo "<string>$(LANG=C date -u "+%A %d %B, %Y, %T UTC")</string>" >> $TMPFPROPS
|
|
|
|
|
|
|
|
# Homepage
|
|
|
|
if [ -n "$homepage" ]; then
|
|
|
|
echo "<key>homepage</key>" >> $TMPFPROPS
|
|
|
|
echo "<string>$homepage</string>" >> $TMPFPROPS
|
|
|
|
fi
|
|
|
|
|
|
|
|
# License
|
|
|
|
if [ -n "$license" ]; then
|
|
|
|
echo "<key>license</key>" >> $TMPFPROPS
|
|
|
|
echo "<string>$license</string>" >> $TMPFPROPS
|
|
|
|
fi
|
|
|
|
|
2009-10-18 11:17:26 +02:00
|
|
|
# Terminate the property list file.
|
|
|
|
echo "</dict>" >> $TMPFPROPS
|
|
|
|
echo "</plist>" >> $TMPFPROPS
|
|
|
|
|
|
|
|
if [ ! -d $metadir ]; then
|
|
|
|
mkdir -p $metadir >/dev/null 2>&1
|
|
|
|
if [ $? -ne 0 ]; then
|
2010-12-20 00:22:12 +01:00
|
|
|
msg_red "you don't have enough perms for this!\n"
|
2009-10-18 11:17:26 +02:00
|
|
|
rm -f $TMPFLIST $TMPFPROPS
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Write metadata files and cleanup.
|
|
|
|
if [ -s $TMPFLIST ]; then
|
|
|
|
mv -f $TMPFLIST $metadir/flist
|
|
|
|
else
|
|
|
|
rm -f $TMPFLIST
|
|
|
|
fi
|
|
|
|
mv -f $TMPFPLIST ${DESTDIR}/files.plist
|
|
|
|
mv -f $TMPFPROPS ${DESTDIR}/props.plist
|
|
|
|
|
2011-10-22 07:11:49 +02:00
|
|
|
$XBPS_PKGDB_CMD sanitize-plist ${DESTDIR}/files.plist || \
|
|
|
|
msg_error "$pkgname: failed to externalize files.plist!\n"
|
|
|
|
$XBPS_PKGDB_CMD sanitize-plist ${DESTDIR}/props.plist || \
|
|
|
|
msg_error "$pkgname: failed to externalize props.plist!\n"
|
|
|
|
|
|
|
|
chmod 644 ${DESTDIR}/files.plist ${DESTDIR}/props.plist
|
|
|
|
[ -f $metadir/flist ] && chmod 644 $metadir/flist
|
|
|
|
|
2009-10-18 11:17:26 +02:00
|
|
|
#
|
|
|
|
# Create the INSTALL/REMOVE scripts if package uses them
|
|
|
|
# or uses any available trigger.
|
|
|
|
#
|
2011-10-28 11:56:39 +02:00
|
|
|
local meta_install meta_remove
|
|
|
|
if [ -n "${sourcepkg}" -a "${sourcepkg}" != "${pkgname}" ]; then
|
|
|
|
meta_install=${XBPS_SRCPKGDIR}/${pkgname}/${pkgname}.INSTALL
|
|
|
|
meta_remove=${XBPS_SRCPKGDIR}/${pkgname}/${pkgname}.REMOVE
|
|
|
|
else
|
|
|
|
meta_install=${XBPS_SRCPKGDIR}/${pkgname}/INSTALL
|
|
|
|
meta_remove=${XBPS_SRCPKGDIR}/${pkgname}/REMOVE
|
|
|
|
fi
|
2011-10-29 12:33:32 +02:00
|
|
|
xbps_write_metadata_scripts_pkg install ${meta_install} || \
|
|
|
|
msg_error "$pkgname: failed to write INSTALL metadata file!\n"
|
|
|
|
|
|
|
|
xbps_write_metadata_scripts_pkg remove ${meta_remove} || \
|
|
|
|
msg_error "$pkgname: failed to write REMOVE metadata file!\n"
|
|
|
|
|
2011-07-18 16:25:18 +02:00
|
|
|
msg_normal "$pkgver: successfully created package metadata.\n"
|
2009-10-18 11:17:26 +02:00
|
|
|
}
|