diff --git a/mpbb-cleanup b/mpbb-cleanup index e1ad5a5..b8e09b2 100644 --- a/mpbb-cleanup +++ b/mpbb-cleanup @@ -6,7 +6,7 @@ cleanup-help() { echo "Clean up build remnants and leftovers caused by the build of port --port." - echo "Note that you should not have to run this explicitly, as it is automatically run after install-dependencies on error and in any case after install-port." + echo "Note that you should not have to run this explicitly, as it is automatically run after install-dependencies and install-port on error and in any case after gather-archives." } cleanup() { diff --git a/mpbb-gather-archives b/mpbb-gather-archives index 8739efb..1d5ca19 100644 --- a/mpbb-gather-archives +++ b/mpbb-gather-archives @@ -14,6 +14,7 @@ gather-archives() { tclsh=${option_prefix}/bin/port-tclsh mkdir -p "${option_staging_dir}" || return $? + status=0 for archive_path in $("${option_prefix}/bin/port" -q location active); do archive_port=$(basename "$(dirname "${archive_path}")") archive_basename=$(basename "${archive_path}") @@ -21,9 +22,12 @@ gather-archives() { if ! ${curl} -fIsL "${option_archive_site}/${archive_port}/${archive_basename}" > /dev/null; then if "${tclsh}" "${option_workdir}/tools/port_binary_distributable.tcl" -v "${archive_port}"; then echo "Staging archive for upload: ${archive_basename}" - mkdir -p "${option_staging_dir}/${archive_port}" || return $? - cp -p "${archive_path}" "${option_staging_dir}/${archive_port}/${archive_basename}" || return $? + mkdir -p "${option_staging_dir}/${archive_port}" || { status=$?; break; } + cp -p "${archive_path}" "${option_staging_dir}/${archive_port}/${archive_basename}" || { status=$?; break; } fi fi done + + cleanup + return $status } diff --git a/mpbb-install-port b/mpbb-install-port index 4562a0f..cfc925f 100644 --- a/mpbb-install-port +++ b/mpbb-install-port @@ -15,9 +15,9 @@ install-port() { return 1 fi - status=0 - "${option_prefix}/bin/port" -d install "${option_port}" || status=$? - - cleanup - return $status + if ! "${option_prefix}/bin/port" -d install "${option_port}"; then + echo "Build failed, cleaning up..." + cleanup + return 1 + fi }