tar -xf - -C "$SOURCE_DIR" || die "git archive failed"
echo ">>> Building release tree"
-cp -a "${SOURCE_DIR}/"{bin,cnf,doc,man,pym,src} "${RELEASE_DIR}/" || die "directory copy failed"
-cp "${SOURCE_DIR}/"{DEVELOPING,NEWS,RELEASE-NOTES,TEST-NOTES} \
+cp -a "${SOURCE_DIR}/"{bin,cnf,doc,man,misc,pym} "${RELEASE_DIR}/" || die "directory copy failed"
+cp "${SOURCE_DIR}/"{DEVELOPING,LICENSE,Makefile,NEWS,README,RELEASE-NOTES,TEST-NOTES} \
"${RELEASE_DIR}/" || die "file copy failed"
+rm -rf "$SOURCE_DIR" || die "directory cleanup failed"
+
+echo ">>> Setting portage.VERSION"
+sed -e "s/^VERSION=.*/VERSION=\"${VERSION}\"/" \
+ -i "${RELEASE_DIR}/pym/portage/__init__.py" || \
+ die "Failed to patch portage.VERSION"
+
echo ">>> Creating Changelog"
git_log_opts=""
-[ -n "$CHANGELOG_REVISION" ] && git_log_opts+=" $CHANGELOG_REVISION^.."
+if [ -n "$CHANGELOG_REVISION" ] ; then
+ git_log_opts+=" $CHANGELOG_REVISION^..$TREE_ISH"
+else
+ git_log_opts+=" $TREE_ISH"
+fi
skip_next=false
-git log $git_log_opts | fmt -w 80 -p " " | while read ; do
+git log $git_log_opts | fmt -w 80 -p " " | while read -r ; do
if [[ $skip_next = true ]] ; then
skip_next=false
elif [[ $REPLY = " svn path="* ]] ; then