alpine/chappa-cherrypick.sh

359 lines
12 KiB
Bash

# abort on any error:
set -e
# Used by --update and --apply:
chappa_patchdir=chappa-patches
echo_others() {
# Note: This function is updated by the function update_OTHERS_section, it's
# very sensitive to change, the part below must stay as it is or
# you will loose this script in the update process if you say "y":
cat<<OTHERS
alt_addresses_domain Add support for the syntax *@mydomain.com to the alt-addresses configuration option.
stevepicobug Fix a bug that makes pico miss the alignment of text in the editor.
jasonbsdbug Fix a bug that makes Alpine crash in Freebsd, when it is built with thread support.
steveencodingbug Fix a bug that makes Alpine corrupt an array used to save known encodings (like 7BIT, 8BIT, etc.)
stevemacosbug Fix a bug that makes Alpine be very slow on a Mac.
pawelthreadchar Change the default last reply in a thread from '|' to '\'.
pawelclocksize Change the default index format to include size in Kilobytes and date in 24 hours format.
stevepostponedcharset Fix a bug that makes Alpine change the charset of a message from the default to UTF-8 when you postpone a message.
stevecountbug Fix a bug that makes Alpine give the incorrect information about the number of messages in a folder.
stevecolorbug Fix a bug that makes Alpine fail to color an index line when a flag has changed in a message.
steveeditingbug Fix a bug that makes editing long configuration lines confusing.
OTHERS
}
echo_patch_help() {
cat <<END
fancy Enhanced fancy thread interface. <A HREF="h_config_enhanced_thread">(more...)</A>
maildir Maildir Patch. <A HREF="h_config_maildir">(more...)</A>
fillpara Pine justifies paragraphs with more than one level of indentation. <A HREF="h_compose_justify">(more...)</A>
rules Rules patch, to make Pine flexible. <A HREF="h_config_new_rules">(more...)</A>
compose Send mail from the command line.
WrtAcc Write accents like &aacute;, &eacute;, &ntilde; etc.
circtab Tab check folders on cycles. <A HREF="h_config_circular_tab">(more...)</A>
count Get the number of new messages when opening a folder.
insertpat Reinsert the pattern you searched for last.
reply New Reply command menu.<A HREF="h_config_alt_reply_menu">(more...)</A>
fromheader Change your From header without any effort!
composeurl Choose a role when composing a message from a mailto: link.
colortext Paint special text in the body of the message in any custom color. <A HREF="h_config_special_text_to_color">(more...)</A>
searchheader Select messages by the content of an arbitrary header.
DelText Delete until the the end of a file, or message (press ^W^X).
quota Get the QUOTA information from an IMAP server (if such server supports e QUOTA command).
help Get the internal name of a help topic to use it with a x-pine-help URL scheme.
ignoresize Decide if you want to ignore errors in size changes of a message when saving a message from an IMAP server.
status Fix the update of the status line information in pico
unverified Fix a bug that makes Alpine not to give a warning if the Newsgroup header is present
utf8bug Fix a bug that makes Alpine filter incorrectly in the UTF-8 filter.
END
echo_others
}
#==================================================================================
# The following functions are only used for --update:
#
#
# This function decided which patches are downloaded, and packaged:
# Every patch which shall be, is echoed, every patch which shall be not is not.
# If it encounters a new patch, it is printed on stderror
#
print_which_shall_be_packaged() {
grep '"info/' index.html | sed 's/.LI.\(.*\)<.*NAME="\([^"]*\)".*/\2 \1/'|
while read name text
do
case "$name" in
cygwin|all|windows) : 'always ignored';;
WrtAcc|fancy|maildir|colortext|insertpat)
: 'really wanted'
echo "$name";;
utf8bug|ignoresize|searchheader)
: 'also wanted'
echo "$name";;
unverified)
: 'also wanted'
echo "$name";;
rules) : 'conflicts with others and would need extra work';;
help|status|reply|DelText|outgoing|count)
: 'not important enough';;
quota|composeurl|fromheader|circtab)
: 'rather not';;
fillpara)
: 'rather dangerous';;
*) echo NEW: $name >&2;exit;;
esac
done
echo_others
}
get_patch_path() {
echo staff.washington.edu/chappa/alpine/patches/alpine-0.9999/$1.patch.gz
}
list_packaged_patches_urls() {
print_which_shall_be_packaged | while read name rest; do
get_patch_path $name
done
}
update_OTHERS_section() {
wget --timestamping http://staff.washington.edu/chappa/alpine/patches/others.html
grep alpine-0.9999 others.html |
sed 's/.*alpine-0.9999\///;s/.patch.gz//;s/".*A>,//;s/ Posted.*//;s/which fixes/Fix/;s/which changes/Change/;s/which adds/Add/' \
>others
sed '/^cat..OTHERS$/,/^OTHERS$/{/^cat..OTHERS$/b ins;/^OTHERS/p;d};p;d;:ins;r others' ../$0 >change
diff ../$0 change || {
echo -n "DANGEROUS may loose script work: Apply these changes to $0 (y/*)?"
read answer
if [ "$answer" = y ]; then
cat change >../$0
rm change
echo "OTHERS_section updated, restarting from scratch!"
cd ..
exec bash $0 --update
else
echo "OTHERS_section updated, please check and do it."
exit
fi
}
rm change
}
check_patch_list() {
for name in `ls $chappa_patchdir`
do
helpentry=`echo_patch_help | sed -n "s/^$name //p"`
printf "%-22s %s\n" $name "'$helpentry'"
if [ -z "$helpentry" ]; then
missing="$missing $name"
fi
done
if [ "$missing" ]; then
echo "=======> help entries for $missing are missing, existing - please fix!"
exit 4
else
echo "---> No help entries are missing" >&2
fi
}
update_packaged_patches() {
mkdir -p test;cd test
do_update=true
#do_update=false
if $do_update;then
update_OTHERS_section
rm -f index.html
wget http://staff.washington.edu/chappa/alpine/
wget -m $(list_packaged_patches_urls)
fi
#print_which_shall_be_packaged | sed 's/.*/^& /' >shall-be-packaged.patterns
#grep '"info/' index.html | sed 's/.LI.\(.*\)<.*NAME="\([^"]*\)".*/\2 \1/'|
# grep -f shall-be-packaged.patterns | sed 's/[^ ]* //' >patch-summaries.txt
rm -rf $chappa_patchdir
mkdir $chappa_patchdir
print_which_shall_be_packaged | while read name rest; do
zcat `get_patch_path $name` >$chappa_patchdir/$name
touch -r `get_patch_path $name` $chappa_patchdir/$name
done
check_patch_list
print_which_shall_be_packaged | while read name rest; do
if echo_patch_help | sed -n "s/^$name //p"| grep HREF; then
:
else
wget --timestamping -x http://staff.washington.edu/chappa/alpine/info/$name.html || :
if [ -s staff.washington.edu/chappa/alpine/info/$name.html ]; then
sed '0,/is available for version/d;/\/'$name'.patch/d;/<.[tT][dD]><.[tT][rR]><.[tT][aA][bB][lL][eE]>/,$d' \
staff.washington.edu/chappa/alpine/info/$name.html |
iconv -f latin1 -t UTF-8 >$chappa_patchdir/$name.hlp
fi
fi
zcat `get_patch_path $name` >$chappa_patchdir/$name
done
find $chappa_patchdir -name '*.hlp' -size 0|xargs --no-run-if-empty rm
cd -
tar xvfj $chappa_patchdir.tar.bz2
diff -r $chappa_patchdir test/$chappa_patchdir | less
echo -n 'Changes OK, update $chappa_patchdir.tar.bz2 (y/*)? '
read answer
if [ "$answer" = y ]; then
cd test
tar cfj ../$chappa_patchdir.tar.bz2 $chappa_patchdir
cd -
tar tfvj $chappa_patchdir.tar.bz2 | sort +5
else
echo "$chappa_patchdir.tar.bz2 NO updated!"
fi
}
if [ "$1" = "--update" ]; then
update_packaged_patches
exit
fi
if [ "$1" = "--cleanup" ]; then
rm -rf test
exit
fi
# Everything above is only for update and cleanup
if [ "$1" != "--apply" ]; then
echo "cherrypick.sh can either update $chappa_patchdir.tar.bz2, cleanup or apply the patches"
echo "usage: cherrypick [ --update | --cleanup | --apply ]"
exit 5
fi
if [ "$0" -nt "$2" ]; then
echo "Attention:
$0 is newer than
$2
If the update of ${0##*/} needs to change $chappa_patchdir.tar.bz2, you should run:
sh ${0##*/} --update
otherwise run:
touch -r chappa-cherrypick.sh chappa-patches.tar.bz2
"
exit 4
fi
# Everything below is only for apply, it applies all patches in $2
# and generates a patch to pine.hlp which describes the applied patches.
print_hlp_pages() {
ls $chappa_patchdir | while read name; do
if [ -f $chappa_patchdir/$name.hlp ]; then
title=`echo_patch_help | sed -n "s/^$name //p"`
cat <<END
====== h_chappa_patch_$name ======
<html>
<head>
<TITLE>$title</TITLE>
</head>
<body>
<H1>$title</H1>
<P>
END
# Unlike pure html, alpine's hlp viewer needs
# backslashes escaped:
sed 's/\\/\\\\/g;s/\\\\"/\\\\\&quot;/g' $chappa_patchdir/$name.hlp
echo '</body></html>'
fi
done
}
echo_patch_list() {
ls $chappa_patchdir | while read name; do
case "$name" in *.hlp) continue;; esac
helpentry=`echo_patch_help | sed -n "s/^$name //p"`
echo "<LI> $helpentry"
if [ -f $chappa_patchdir/$name.hlp ]; then
echo " <A HREF=\"h_chappa_patch_$name\">(more...)</A>"
fi
done
}
generate_patch_help() {
(
print_hlp_pages
cat <<END
====== h_opensuse_issues ======
<html>
<head>
<TITLE>Information on checking for known issues and reporting new issues</TITLE>
</head>
<body>
<H1>Information on checking for known issues and reporting new issues</H1>
<P>If you have any issues while using this release of Alpine, please search
the Novell bugzilla using the advanced search form at
<A HREF="http://bugzilla.novell.com/query.cgi">
http://bugzilla.novell.com/query.cgi</A> and enter "alpine"
into the search field for "Summary".
In order to see all issues which have been reported so far,
unselect all preselections in the Status list of the Impact Section,
by holding the Control key while clicking on NEW, ASSIGNED, NEEDINFO
an REOPENED before clicking on "Search".
<P>If your issue is not found in the Novell Bugzilla, please sign in
to the Novell Bugzilla and report the issue.
You can also visit the
<A HREF="http://www.washington.edu/alpine/">Alpine Information Center</A>,
and the
<A HREF="https://mailman1.u.washington.edu/mailman/private/alpine-alpha/">
Alpine-alpha mailing list archive</A>. On the
<A HREF="https://mailman1.u.washington.edu/mailman/listinfo/alpine-alpha">
Alpine-alpha mailing list</A>, you can also report and discuss issues.<P>
Be sure to include the full openSUSE version
of alpine (found at the top of this release notes page) in all reports
which you make.</body></html>
====== h_opensuse_patches ======
<html>
<head>
<TITLE>Information on patches added to this release</TITLE>
</head>
<body>
<H1>Information on patches added to this release</H1>
<P>
This version of Alpine has been modified by including patches from
<A HREF="http://staff.washington.edu/chappa/alpine/">
http://staff.washington.edu/chappa/alpine/</A>. These patches include
new features and bug fixes. More complete information on each patch
included in this version can be found in the web.
<P>If you have any problems with this release of Pine, please
follow the suggestions <A HREF="h_opensuse_issues">here</A>
<P>The list of patches included in this release are:<UL>
END
echo_patch_list
echo "</UL></body></html>"
)
}
generate_help_patch() {
cat <<END
--- alpine-0.9999/pith/pine.hlp
+++ alpine-0.9999/pith/pine.hlp
@@ -163,6 +163,9 @@
is available as is a world wide web based version designed to run under the
Apache web server.
+<P>Note: <A HREF="h_opensuse_patches">This version of Alpine has been built for openSUSE with
+patches of Eduardo Chappa for latest bugfixes and enhanced functionality</A>.
+Press the ENTER key while the link above is hightlighted for more information.
<H2>New in Alpine <!--#echo var="ALPINE_VERSION"--></H2>
Version <!--#echo var="ALPINE_VERSION"-->
@@ -652,6 +652,7 @@
<P>
Some topics of current interest include:
<UL>
+<P><LI> Information on <A HREF="h_opensuse_patches">patches for this release</A>
<P><LI> <A HREF="h_maildrop">Mail Drops</A>
<P><LI> Information on <A HREF="h_info_on_locking">Folder Locking</A>
<P><LI> Information on <A HREF="h_info_on_mbox">Missing mail and the mbox driver</A>
END
lines=$(generate_patch_help |wc -l)
start=1171
echo "@@ -$start,6 +`expr $start + 1`,`expr $lines + 6` @@"
cat <<END
&lt;End of Configuration Notes&gt;
</BODY>
</HTML>
END
generate_patch_help | sed 's/^/+/'
cat <<END
====== h_news_legal ======
<html>
<head>
END
}
tar xvfj $2
if generate_help_patch | patch -p1; then
echo "generated patch applied"
else
echo "generated patch failed to apply"
exit 5
fi
rm $chappa_patchdir/*.hlp
for patch in $chappa_patchdir/*;do
echo
echo "Applying $patch"
if patch -p1 -i$patch; then
echo "$patch applied"
else
echo "$patch failed to apply"
exit 5
fi
done
exit