2015-04-07 14:57:45 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
SRC=$1
|
|
|
|
DEST=$2
|
|
|
|
URL=https://static.opensuse.org/appstream/tumbleweed
|
2015-11-17 18:07:22 +01:00
|
|
|
# Do not produce the html files - the biggest tasks are done
|
|
|
|
# Users interested in them can always produce them locally out of the appdata.xml.gz file
|
|
|
|
HTMLOUT=no
|
2016-09-20 14:57:35 +02:00
|
|
|
HASHED_NAMES=no
|
2015-04-07 14:57:45 +02:00
|
|
|
|
2016-02-06 14:13:39 +01:00
|
|
|
TMPDIR=$(mktemp -d)
|
2016-01-29 17:09:05 +01:00
|
|
|
|
2015-04-07 14:57:45 +02:00
|
|
|
/usr/bin/appstream-builder \
|
|
|
|
--enable-hidpi \
|
2016-01-29 17:09:05 +01:00
|
|
|
--temp-dir=${TMPDIR}/apb \
|
|
|
|
--cache-dir=${TMPDIR}/apb/cache \
|
2015-04-07 14:57:45 +02:00
|
|
|
--origin=appdata \
|
|
|
|
--basename=appdata \
|
|
|
|
--packages-dir=${SRC} \
|
|
|
|
--output-dir=${DEST}
|
|
|
|
|
2017-09-14 13:45:14 +02:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
# The appstream-builder failed, exit with an error code, so prod builder knows about it
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-01-29 17:09:05 +01:00
|
|
|
# clean up TMPDIR again
|
|
|
|
rm -rf ${TMPDIR}
|
|
|
|
|
2015-04-07 14:57:45 +02:00
|
|
|
# Change screenshot URLs to our own infrastructure; disabled, as infra not ready
|
|
|
|
# appstream-util mirror-screenshots \
|
|
|
|
# ${DEST}/appdata.xml.gz \
|
|
|
|
# ${URL} \
|
|
|
|
# /usr/share/app-screenshots \
|
|
|
|
# /tmp/apb-screenshots
|
|
|
|
|
2015-11-17 18:07:22 +01:00
|
|
|
if [ "$HTMLOUT" = "yes" ]; then
|
|
|
|
/usr/bin/appstream-util \
|
|
|
|
status-html \
|
|
|
|
${DEST}/appdata.xml.gz \
|
|
|
|
${DEST}/appdata.html
|
2015-04-07 14:57:45 +02:00
|
|
|
|
2015-11-17 18:07:22 +01:00
|
|
|
# compress the HTML file (boo#942985)
|
|
|
|
xz -9 ${DEST}/appdata.html
|
2015-09-01 08:55:54 +02:00
|
|
|
|
2015-11-17 18:07:22 +01:00
|
|
|
/usr/bin/appstream-util \
|
|
|
|
status-html \
|
|
|
|
${DEST}/appdata-failed.xml.gz \
|
|
|
|
${DEST}/appdata-failed.html
|
2015-04-07 14:57:45 +02:00
|
|
|
|
2015-11-17 18:07:22 +01:00
|
|
|
# compress the HTML file (boo#942985)
|
|
|
|
xz -9 ${DEST}/appdata-failed.html
|
|
|
|
fi
|
2016-05-23 13:59:33 +02:00
|
|
|
|
2016-06-14 16:06:55 +02:00
|
|
|
|
2016-09-20 14:57:35 +02:00
|
|
|
if [ "$HASHED_NAMES" = "yes" ]; then
|
|
|
|
# rename the appdata-icons.tar.gz tarball to something like
|
|
|
|
# appdata-icons-${hash}.tar.gz, allowing mirrorbrain to send users
|
|
|
|
# off to a mirror to catch the file, improving performance
|
|
|
|
read md5 fn_catchall <<<$(md5sum ${DEST}/appdata-icons.tar.gz)
|
|
|
|
mv ${DEST}/appdata-icons.tar.gz ${DEST}/appdata-icons-${md5}.tar.gz
|
2016-09-08 10:30:53 +02:00
|
|
|
|
2016-09-20 14:57:35 +02:00
|
|
|
# also rename the appdata.xml.gz file in the same style
|
|
|
|
read md5 fn_catchall <<<$(md5sum ${DEST}/appdata.xml.gz)
|
|
|
|
mv ${DEST}/appdata.xml.gz ${DEST}/appdata-${md5}.xml.gz
|
|
|
|
|
|
|
|
# And the same for the -screenshots tarball (containing auto-generated screenshots for fonts)
|
|
|
|
read md5 fn_catchall <<<$(md5sum ${DEST}/appdata-screenshots.tar)
|
|
|
|
mv ${DEST}/appdata-screenshots.tar ${DEST}/appdata-screenshots-${md5}.tar
|
|
|
|
fi
|