+if [[ ${RUNTESTS} == "true" ]] ; then
+ pushd "${SOURCE_DIR}" >/dev/null
+ ./runtests.sh --python-versions=supported || die "tests failed"
+ popd >/dev/null
+fi
+
+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=""
+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 -r ; do
+ if [[ ${skip_next} == "true" ]] ; then
+ skip_next=false
+ elif [[ ${REPLY} == " svn path="* ]] ; then
+ skip_next=true
+ else
+ echo "${REPLY}"
+ fi
+done > "${RELEASE_DIR}/ChangeLog" || die "ChangeLog creation failed"
+