fuel-main/report-changelog.sh
Dmitry Burmistrov 4ca7585974 Add support lzma data compression for global changelog script
Change-Id: I0fe05e265f1ad62bb91ffd276abf436e097e1ccf
Closes-Bug: #1397942
2014-12-01 14:12:23 +03:00

29 lines
1.2 KiB
Bash
Executable File

#!/bin/bash -e
CENTOS_CHANGELOG=${LOCAL_MIRROR}/centos-packages.changelog
UBUNTU_CHANGELOG=${LOCAL_MIRROR}/ubuntu-packages.changelog
[ -f ${CENTOS_CHANGELOG} ] && rm ${CENTOS_CHANGELOG}
for packagename in `find ${LOCAL_MIRROR} -name \*.rpm | sort -u`; do
echo ${packagename##*/} >> ${CENTOS_CHANGELOG}
rpm -qp --changelog ${packagename} 2>/dev/null | sed -e '/^$/,$d' >> ${CENTOS_CHANGELOG}
echo '' >> ${CENTOS_CHANGELOG}
done
[ -f ${UBUNTU_CHANGELOG} ] && rm ${UBUNTU_CHANGELOG}
for packagename in `find ${LOCAL_MIRROR} -name \*.deb | sort -u`; do
pkgname=${packagename##*/}
DATAFILE=`ar t $packagename | grep ^data`
case ${DATAFILE##*.} in
bz2) ZFLAG='--bzip2' ;;
gz) ZFLAG='-z' ;;
xz) ZFLAG='-J' ;;
lzma) ZFLAG='--lzma' ;;
*) echo "Unknown data tarball format for package $packagename"; continue ;;
esac
CHANGELOGFILE=`ar p $packagename $DATAFILE | tar $ZFLAG -tvf - | grep '/usr/share/doc/' | grep "/changelog\.Debian\.gz" || :`
CHANGELOGFILE=${CHANGELOGFILE##* }
if [[ ${CHANGELOGFILE:0:2} == './' ]]; then
ar p $packagename $DATAFILE | tar $ZFLAG -xO $CHANGELOGFILE | gzip -cd | sed -n '1,/--/ p' >> ${UBUNTU_CHANGELOG}
echo '' >> ${UBUNTU_CHANGELOG}
fi
done