Commit 000dca76 authored by anonym's avatar anonym
Browse files

Build system: move around logic to reduce ENV state.

There is no reason for partially calculating the image name in the
Rakefile. Let's just to it all in the same place.
parent 78ad9e63
......@@ -46,7 +46,6 @@ EXPORTED_VARIABLES = [
'GIT_COMMIT',
'GIT_REF',
'BASE_BRANCH_GIT_COMMIT',
'BUILD_BASENAME_SUFFIX',
].freeze
ENV['EXPORTED_VARIABLES'] = EXPORTED_VARIABLES.join(' ')
......@@ -417,7 +416,6 @@ task setup_environment: ['validate_git_state'] do
end
task merge_base_branch: ['parse_build_options', 'setup_environment'] do
ENV['BUILD_BASENAME_SUFFIX'] ||= ''
next if $skip_mergebasebranch
branch = git_helper('git_current_branch')
base_branch = git_helper('base_branch')
......@@ -440,10 +438,6 @@ task merge_base_branch: ['parse_build_options', 'setup_environment'] do
END_OF_MESSAGE
end
run_command('git', 'submodule', 'update', '--init')
clean_git_base_branch = base_branch.gsub('/', '_')
git_base_branch_short_id = `git rev-parse --verify --short #{ENV['BASE_BRANCH_GIT_COMMIT']}`.chomp
ENV['BUILD_BASENAME_SUFFIX'] = \
"+#{clean_git_base_branch}@#{git_base_branch_short_id}"
# If we actually merged anything we'll re-run rake in the new Git
# state in order to avoid subtle build errors due to mixed state.
......
......@@ -28,7 +28,9 @@ GIT_BRANCH="$(git_current_branch)"
if [ -n "${GIT_BRANCH}" ]; then
CLEAN_GIT_BRANCH=$(echo "$GIT_BRANCH" | sed 's,/,_,g')
GIT_SHORT_ID="$(git_current_commit --short)"
BUILD_BASENAME="tails-amd64-${CLEAN_GIT_BRANCH}-${AMNESIA_VERSION}-${AMNESIA_NOW}-${GIT_SHORT_ID}${BUILD_BASENAME_SUFFIX}"
CLEAN_GIT_BASE_BRANCH=$(base_branch | sed 's,/,_,g')
GIT_BASE_BRANCH_SHORT_ID="$(git rev-parse --verify --short $(git_base_branch_head))"
BUILD_BASENAME="tails-amd64-${CLEAN_GIT_BRANCH}-${AMNESIA_VERSION}-${AMNESIA_NOW}-${GIT_SHORT_ID}+${CLEAN_GIT_BASE_BRANCH}@${GIT_BASE_BRANCH_SHORT_ID}"
else
if git_on_a_tag; then
CLEAN_GIT_TAG=$(git_current_tag | tr '/-' '_~')
......
......@@ -26,7 +26,6 @@ as_root_do() {
${GIT_COMMIT:+GIT_COMMIT="${GIT_COMMIT}"} \
${GIT_REF:+GIT_REF="${GIT_REF}"} \
${BASE_BRANCH_GIT_COMMIT:+BASE_BRANCH_GIT_COMMIT="${BASE_BRANCH_GIT_COMMIT}"} \
${BUILD_BASENAME_SUFFIX:+BUILD_BASENAME_SUFFIX="${BUILD_BASENAME_SUFFIX}"} \
"${@}"
}
......
Supports Markdown
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