makedist-announcement: improve support for snapshot targets and add command line interface options

This commit is contained in:
Silvan Calarco 2012-07-27 15:14:54 +02:00
parent 9cbb9ec897
commit 5795417cd6
2 changed files with 72 additions and 27 deletions

View File

@ -10,21 +10,43 @@ distribution="openmamba"
TEXTDOMAIN="makedist"; export TEXTDOMAIN TEXTDOMAIN="makedist"; export TEXTDOMAIN
function usage() { function usage() {
echo "Usage: makedist-announcement distversion [mediumname] echo "\
Usage: makedist-announcement distversion [mediumname] [--rebuild-announcement] [--rebuild-catalog]\
Example: [--send-email] [--send-test-email] [-h|--help]\
\
makedist-announcement milestone2 livecd Example:\
\
makedist-announcement milestone2 livecd\
" "
exit 1 exit 1
} }
[ "$1" ] || usage while [ "$1" ]; do
case $1 in
--rebuild-announcement) SCRIPT_ENV_ADD="$SCRIPT_ENV_ADD REBUILDANNOUNCEMENT=1" ;;
--rebuild-catalog) SCRIPT_ENV_ADD="$SCRIPT_ENV_ADD REBUILDCATALOG=1" ;;
--send-email) SCRIPT_ENV_ADD="$SCRIPT_ENV_ADD SENDEMAIL=1" ;;
--send-test-email) SCRIPT_ENV_ADD="$SCRIPT_ENV_ADD SENDTESTEMAIL=1" ;;
-h|--help) usage; exit 0 ;;
-*) echo "Error: uknown option $1; aborting."
exit 1
;;
*) if [ ! "$distversion" ]; then
distversion=$1
elif [ ! "$mediumname" ]; then
mediumname=$1
else
echo "Error: exceeding option $1; aborting."
exit 1
fi
;;
esac
shift
done
distversion=$1 [ "$distversion" ] || usage
mediumname=$2
if [ "$distversion" != "devel" ]; then if [ "$distversion" != "devel" ]; then
RELEASE=1 RELEASE=1
@ -44,11 +66,12 @@ if [ "$mediumname" ]; then
it) export LC_ALL=it_IT.UTF8 ;; it) export LC_ALL=it_IT.UTF8 ;;
*) echo "Error: unsupported language $outputlang; aborting."; exit 1 ;; *) echo "Error: unsupported language $outputlang; aborting."; exit 1 ;;
esac esac
export $SCRIPT_ENV_ADD
/usr/share/makedist/makedist-announcement.sh $distversion $mediumname $outputlang || exit 1 /usr/share/makedist/makedist-announcement.sh $distversion $mediumname $outputlang || exit 1
done done
fi fi
if [ ! "$SENDEMAIL" -a ! "$SENDTESTEMAIL" ]; then #if [ ! "$SENDEMAIL" -a ! "$SENDTESTEMAIL" ]; then
echo $"Generating $distversion announcements index" echo $"Generating $distversion announcements index"
for outputlang in $outputlangs; do for outputlang in $outputlangs; do
indexfile=/var/ftp/pub/$distribution/media/$distversion/release-announcement-index.$outputlang.html.inc indexfile=/var/ftp/pub/$distribution/media/$distversion/release-announcement-index.$outputlang.html.inc
@ -62,4 +85,4 @@ if [ ! "$SENDEMAIL" -a ! "$SENDTESTEMAIL" ]; then
done done
done done
done done
fi #fi

View File

@ -231,8 +231,8 @@ fi
mediumplatform=${MEDIA_PLATFORM[i]} mediumplatform=${MEDIA_PLATFORM[i]}
mediumsubplatform=${MEDIA_SUBPLATFORM[i]} mediumsubplatform=${MEDIA_SUBPLATFORM[i]}
mediumdir=/var/ftp/pub/$distribution/media/$distversion/${MEDIA_NAME[i]} mediumdir=/var/ftp/pub/$distribution/media/$distversion/$mediumname
[ "$distversion" = "devel" ] && fallbackmediumdir=/var/ftp/pub/$distribution/media/milestone2/${MEDIA_NAME[i]} [ "$distversion" = "devel" ] && fallbackmediumdir=/var/ftp/pub/$distribution/media/milestone2/$mediumname
if [ $mediumsubplatform ]; then if [ $mediumsubplatform ]; then
. /var/makedist/targets/$MAKEDIST_TARGET/platforms/$mediumsubplatform/settings.inc . /var/makedist/targets/$MAKEDIST_TARGET/platforms/$mediumsubplatform/settings.inc
@ -266,7 +266,8 @@ CONFIGFILE=/etc/makedist/config
[ -e $mediumdir/info ] || mkdir $mediumdir/info [ -e $mediumdir/info ] || mkdir $mediumdir/info
catalogfile=$mediumdir/info/sources.catalog catalogfile=$mediumdir/info/sources.catalog
if [ ! -e $catalogfile -o "$REBUILDCATALOG" = "1" ]; then if [ ! -e $catalogfile -o "$REBUILDCATALOG" = "1" -o \
/var/makedist/.$sub_medium_name-$mediumlang.$mediumarch.$sub_medium_suffix.distinfo -nt $catalogfile ]; then
echo $"Generating catalog file $catalogfile" echo $"Generating catalog file $catalogfile"
for s in $SOURCES; do for s in $SOURCES; do
get_pkg_buildinfo /var/ftp/pub/openmamba/distromatic/$pkginforep/ $mediumarch $s get_pkg_buildinfo /var/ftp/pub/openmamba/distromatic/$pkginforep/ $mediumarch $s
@ -291,12 +292,20 @@ fi
outputfile=$mediumdir/info/release-announcement-$version.$outputlang.html outputfile=$mediumdir/info/release-announcement-$version.$outputlang.html
if [ ! -e $outputfile -o "$REBUILDACCOUNCEMENT" = "1" ]; then if [ ! -e $outputfile -o "$REBUILDANNOUNCEMENT" = "1" ]; then
echo $"Generating announcement for"" $distribution $distversion ${MEDIA_NAME[i]}"" ($outputlang)" echo $"Generating announcement for"" $distribution $distversion ${MEDIA_NAME[i]}"" ($outputlang)"
if [ "$distversion" != "devel" ]; then
echo "<h2>"$"$distribution $distversion ${MEDIA_NAME[i]} $version release announcement""</h2>" > $outputfile echo "<h2>"$"$distribution $distversion ${MEDIA_NAME[i]} $version release announcement""</h2>" > $outputfile
echo "<div align=right><i><a href="http://$siteaddress">$sitedomain</a> - $announcementdate</i></div>" >> $outputfile echo "<div align=right><i><a href="http://$siteaddress">$sitedomain</a> - $announcementdate</i></div>" >> $outputfile
echo "<br><p>"$"The $distribution maintainer is happy to announce the immediate availability of the <b>$distversion $version</b> release of the $distribution <b>${MEDIA_NAME[i]}</b> distribution." >> $outputfile echo "<br><p>"$"The $distribution maintainer is happy to announce the immediate availability of the <b>$distversion $version</b> release of the $distribution <b>${MEDIA_NAME[i]}</b> distribution." >> $outputfile
else
echo "<h2>"$"$distribution $distversion ${MEDIA_NAME[i]} $version nightly snapshot announcement""</h2>" > $outputfile
echo "<div align=right><i><a href="http://$siteaddress">$sitedomain</a> - $announcementdate</i></div>" >> $outputfile
echo "<br><p>"$"The $distribution automatic build system announces the immediate availability of the <b>$version</b> snapshot release of the $distribution <b>${MEDIA_NAME[i]}</b> distribution." >> $outputfile
fi
[ -e $mediumdir/info/release-notes.$outputlang.html.inc ] && { [ -e $mediumdir/info/release-notes.$outputlang.html.inc ] && {
echo "<h3>"$"Release notes""</h3>" >> $outputfile echo "<h3>"$"Release notes""</h3>" >> $outputfile
cat $mediumdir/info/release-notes.$outputlang.html.inc >> $outputfile cat $mediumdir/info/release-notes.$outputlang.html.inc >> $outputfile
@ -316,9 +325,9 @@ if [ ! -e $outputfile -o "$REBUILDACCOUNCEMENT" = "1" ]; then
echo "<h3>"$"Downloads""</h3><table>\ echo "<h3>"$"Downloads""</h3><table>\
<tr><th width=100>"$"Language""</th><th width=50>"$"Arch""</th><th>"$"Download link""</th><th width=50>"$"Size""</th><th width=70>"$"Date""</th><th>MD5</th></tr>" >> $outputfile <tr><th width=100>"$"Language""</th><th width=50>"$"Arch""</th><th>"$"Download link""</th><th width=50>"$"Size""</th><th width=70>"$"Date""</th><th>MD5</th></tr>" >> $outputfile
for l in ${MEDIA_LANGUAGES[i]}; do for l in ${MEDIA_LANGUAGES[i]}; do
mediummd5=`cat $mediumdir/$l/$distribution-${MEDIA_NAME[i]}-$l-$mediadistversion-$version.${mediumarch}.${medium_suffix}.MD5.txt | awk '{ print $1; }'` mediummd5=`cat $mediumdir/$l/$distribution-$mediumname-$l-$mediadistversion-$version.${mediumarch}.${medium_suffix}.MD5.txt | awk '{ print $1; }'`
mediumdate=`stat -c %z $mediumdir/$l/$distribution-${MEDIA_NAME[i]}-$l-$mediadistversion-$version.${mediumarch}.${medium_suffix} | sed "s| .*||"` mediumdate=`stat -c %z $mediumdir/$l/$distribution-$mediumname-$l-$mediadistversion-$version.${mediumarch}.${medium_suffix} | sed "s| .*||"`
mediumsize=`stat -c %s $mediumdir/$l/$distribution-${MEDIA_NAME[i]}-$l-$mediadistversion-$version.${mediumarch}.${medium_suffix}` mediumsize=`stat -c %s $mediumdir/$l/$distribution-$mediumname-$l-$mediadistversion-$version.${mediumarch}.${medium_suffix}`
mediumsizeMB=`expr $mediumsize / 1048576` mediumsizeMB=`expr $mediumsize / 1048576`
echo -n "<tr><td>" >> $outputfile echo -n "<tr><td>" >> $outputfile
@ -329,8 +338,8 @@ if [ ! -e $outputfile -o "$REBUILDACCOUNCEMENT" = "1" ]; then
*) echo -n $"unknown" >> $outputfile ;; *) echo -n $"unknown" >> $outputfile ;;
esac esac
echo "</td><td>${mediumarch}</td><td>\ echo "</td><td>${mediumarch}</td><td>\
<a href='http://$siteaddress/download.html?file=/pub/$distribution/media/$distversion/${MEDIA_NAME[i]}/$l/$distribution-${MEDIA_NAME[i]}-$l-$mediadistversion-$version.${mediumarch}.${medium_suffix}'>\ <a href='http://$siteaddress/download.html?file=/pub/$distribution/media/$distversion/$mediumname/$l/$distribution-$mediumname-$l-$mediadistversion-$version.${mediumarch}.${medium_suffix}'>\
$distribution-${MEDIA_NAME[i]}-$l-$mediadistversion-$version.${mediumarch}.${medium_suffix}</a></td> $distribution-$mediumname-$l-$mediadistversion-$version.${mediumarch}.${medium_suffix}</a></td>
<td>$mediumsizeMB MB</td><td>$mediumdate</td><td>$mediummd5</td>" >> $outputfile <td>$mediumsizeMB MB</td><td>$mediumdate</td><td>$mediummd5</td>" >> $outputfile
done done
echo -n "</tr></table>" >> $outputfile echo -n "</tr></table>" >> $outputfile
@ -429,14 +438,23 @@ $distribution-${MEDIA_NAME[i]}-$l-$mediadistversion-$version.${mediumarch}.${med
echo "<h3>"$"Links""</h3><ul>" >> $outputfile echo "<h3>"$"Links""</h3><ul>" >> $outputfile
echo "<li><a href='http://$siteaddress/distribution/media/${MEDIA_NAME[i]}.html?lang=$outputlang'>\ echo "<li><a href='http://$siteaddress/distribution/media/${MEDIA_NAME[i]}.html?lang=$outputlang'>\
"$"${MEDIA_NAME[i]} page at $siteaddress""</a>\ "$"${MEDIA_NAME[i]} page at $siteaddress""</a>" >> $outputfile
<li><a href='http://$siteaddress/distribution/$distversion.html?lang=$outputlang'>"$"$distversion channels and packages""</a>\ if [ "$distversion" = "devel" ]; then
sitedistversion="development"
else
sitedistversion="$distversion"
fi
echo "<li><a href='http://$siteaddress/distribution/$sitedistversion.html?lang=$outputlang'>"$"$sitedistversion channels and packages""</a>" >> $outputfile
echo "\
<li><a href='http://$forumaddress'>"$"$distribution forum""</a>\ <li><a href='http://$forumaddress'>"$"$distribution forum""</a>\
<li><a href='http://$bugsaddress'>"$"$distribution bug tracking system""</a>\ <li><a href='http://$bugsaddress'>"$"$distribution bug tracking system""</a>\
<li><a href='http://$wikiaddress'>"$"$distribution wiki""</a></ul>\ <li><a href='http://$wikiaddress'>"$"$distribution wiki""</a></ul>\
" >> $outputfile " >> $outputfile
echo "</div><hr><p><i>"$"Announcement automatically generated by"" makedist-announcement $VERSION "$"and signed off by"" $signer</i>" >> $outputfile echo -n "</div><hr><p><i>"$"Announcement automatically generated by"" makedist-announcement $VERSION " >> $outputfile
if [ "$distversion" != "devel" ]; then
echo $"and signed off by"" $signer</i>" >> $outputfile
fi
#gpg --clearsign $outputfile > $outputfile.sig #gpg --clearsign $outputfile > $outputfile.sig
rm -f $mediumdir/info/release-announcement.$outputlang.html rm -f $mediumdir/info/release-announcement.$outputlang.html
@ -464,8 +482,12 @@ if [ "$SENDEMAIL" -o "$SENDTESTEMAIL" ]; then
fi fi
for a in $SENDADDRESSES; do for a in $SENDADDRESSES; do
echo -n $"Send english ($outputlang) language email to $a [y/N]?" if [[ "`/usr/bin/tty`" != "not a tty" ]]; then
echo -n $"Send english ($outputlang) language email to $a for ""'$distribution $distversion ${MEDIA_NAME[i]} $version' [y/N]?"
read ans read ans
else
ans=y
fi
if [ "$ans" = "y" -o "$ans" = "Y" ]; then if [ "$ans" = "y" -o "$ans" = "Y" ]; then
cat $outputfile | mail \ cat $outputfile | mail \
-a "From: openmamba <noreply@openmamba.org>" \ -a "From: openmamba <noreply@openmamba.org>" \