Commit 2a69b952 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add mark_file_to_remove for mark tmp. files and remove it if failed

parent 94872861
...@@ -26,6 +26,9 @@ print_message() ...@@ -26,6 +26,9 @@ print_message()
fatal() fatal()
{ {
print_message Error "$@" print_message Error "$@"
if [ -n "$ETERSOFT_FATAL_REMOVE_FILES" ]; then
rm -vf $ETERSOFT_FATAL_REMOVE_FILES
fi
exit 1 exit 1
} }
...@@ -35,6 +38,16 @@ warning() ...@@ -35,6 +38,16 @@ warning()
print_message Warning "$@" print_message Warning "$@"
} }
mark_file_to_remove()
{
ETERSOFT_FATAL_REMOVE_FILES=$(estrlist union "$ETERSOFT_FATAL_REMOVE_FILES $@")
}
remove_file_from_remove()
{
ETERSOFT_FATAL_REMOVE_FILES=$(estrlist exclude "$*" "$ETERSOFT_FATAL_REMOVE_FILES")
}
set_eterbuilddir() set_eterbuilddir()
{ {
......
...@@ -18,6 +18,7 @@ eval_spec() ...@@ -18,6 +18,7 @@ eval_spec()
# Drop changelog and make spec copy # Drop changelog and make spec copy
# see http://bugs.etersoft.ru/show_bug.cgi?id=6588 # see http://bugs.etersoft.ru/show_bug.cgi?id=6588
mark_file_to_remove $SPECNAME.tmp $SPECNAME.changelog
separate_changelog $SPECNAME $SPECNAME.tmp $SPECNAME.changelog separate_changelog $SPECNAME $SPECNAME.tmp $SPECNAME.changelog
SPEC=$SPECNAME.tmp SPEC=$SPECNAME.tmp
...@@ -38,6 +39,7 @@ eval_spec() ...@@ -38,6 +39,7 @@ eval_spec()
$USEARCH $RPMBUILD -bE --target $SYSARCH $RPMBUILDARG $SPEC 2>/dev/null || cat $SPEC $USEARCH $RPMBUILD -bE --target $SYSARCH $RPMBUILDARG $SPEC 2>/dev/null || cat $SPEC
fi fi
rm -f $SPECNAME.tmp $SPECNAME.changelog rm -f $SPECNAME.tmp $SPECNAME.changelog
remove_file_from_remove $SPECNAME.tmp $SPECNAME.changelog
} }
get_release() get_release()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment