Commit 69f96aa3 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto
Browse files

Begin work on the dist.sh script to create the distribution

parent 70c4753f
main actions/fix-check-links azr/mini-dag azr_acc_test_install_n_run_single_plugins azr_implicit_requried_plugin_2 azr_remove_amazon_builder b-azure_arm-cert-timeout backport/brk.feat/remove-website-code/horribly-finer-bison backport/clarify-builders-page/promptly-fun-cheetah backport/nywilken/update-plugins-link/steadily-ace-bear backport/update-docs-hcp-packer-ga/deeply-capital-malamute backport/update-docs-hcp-packer-ga/slowly-golden-narwhal backport/update-docs-hcp-packer-ga/solely-renewing-chipmunk brk.feat/mdx-v2 build-after-tests bump_hcp_sdk_go config_docs crt-onboarding-test d-powershell-generated-docs dependabot/github_actions/slackapi/slack-github-action-1.19.0 example-test extract_outscale f-inspect-regression fix_1000 fix_100000 hcp-packer-registry-pps improved-error-handling-hcp-packer linode-hcp-ready mode-check nywilken/update-external-plugins packer-plugin-dev-documentation-updates poc/packer-init pr/10199 release/1.7.x release/1.8.x revert-6594-mode-check stable-website testing_hcp_rewrite_two update-alert-banner update-community-codeowners update_sdk use_progress_bar validate_locals vscode-customization wilken/hcl2_upgrade-legacy-mode wilken/implicitly-required-plugins-legacy-mode wilken/packer-legacy-mode wilken/packer-par-client zs.draft-empty-page-check-script 1.5.0 v1.8.0 v1.7.10 v1.7.9 v1.7.8 v1.7.7 v1.7.6 v1.7.5 v1.7.4 v1.7.3 v1.7.2 v1.7.1 v1.7.0 v1.6.6 v1.6.5 v1.6.4 v1.6.3 v1.6.2 v1.6.1 v1.6.0 v1.5.6 v1.5.5 v1.5.4 v1.5.3 v1.5.2 v1.5.1 v1.5.0 v1.4.5 v1.4.4 v1.4.3 v1.4.2 v1.4.1 v1.4.0 v1.3.5 v1.3.4 v1.3.3 v1.3.2 v1.3.1 v1.3.0 v1.2.5 v1.2.4 v1.2.3 v1.2.2 v1.2.1 v1.2.0 v1.1.3 v1.1.2 v1.1.1 v1.1.0 v1.0.4 v1.0.3 v1.0.2 v1.0.1 v1.0.0 v1.0.0-rc3 v1.0.0-rc2 v1.0.0-rc1 v0.12.3 v0.12.2 v0.12.1 v0.12.0 v0.11.0 v0.10.2 v0.10.1 v0.10.0 v0.9.0 v0.9.0-rc2 v0.8.6 v0.8.5 v0.8.3 v0.8.2 v0.8.1 v0.8.0 v0.7.5 v0.7.2 v0.7.1 v0.7.0 v0.6.1 v0.6.0 nightly list
No related merge requests found
Showing with 60 additions and 3 deletions
+60 -3
dist.sh 0 → 100755
#!/bin/bash
set -e
# Get the directory where this script is. This will also resolve
# any symlinks in the directory/script, so it will be the fully
# resolved path.
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# Determine the version that we're building based on the contents
# of packer/version.go.
VERSION=$(grep "const Version " packer/version.go | sed -E 's/.*"(.+)"$/\1/')
PREVERSION=$(grep "const VersionPrerelease " packer/version.go | sed -E 's/.*"(.+)"$/\1/')
if [ ! -z $PREVERSION ]; then
PREVERSION="${PREVERSION}.$(date -u +%s)"
fi
echo "Version: ${VERSION} ${PREVERSION}"
# This function builds whatever directory we're in...
xc() {
goxc \
-arch="386 amd64 arm" \
-os="linux darwin windows freebsd openbsd" \
-d="${DIR}/pkg" \
-pv="${VERSION}" \
-pr="${PREVERSION}" \
go-install \
xc
}
# Build our root project
xc
# Build all the plugins
for PLUGIN in $(find ./plugin -mindepth 1 -maxdepth 1 -type d); do
PLUGIN_NAME=$(basename ${PLUGIN})
pushd ${PLUGIN}
xc
popd
find ./pkg -type f -name ${PLUGIN_NAME} -execdir mv ${PLUGIN_NAME} packer-${PLUGIN_NAME} ';'
done
package packer
import "fmt"
import (
"bytes"
"fmt"
)
// The version of packer.
const Version = "0.1.0.dev"
const Version = "0.1.0"
// Any pre-release marker for the version. If this is "" (empty string),
// then it means that it is a final release. Otherwise, this is the
// pre-release marker.
const VersionPrerelease = "dev"
type versionCommand byte
......@@ -15,7 +23,13 @@ command-line flags for this command.`
}
func (versionCommand) Run(env Environment, args []string) int {
env.Ui().Say(fmt.Sprintf("Packer v%v", Version))
var versionString bytes.Buffer
fmt.Fprintf(&versionString, "Packer v%s", Version)
if VersionPrerelease != "" {
fmt.Fprintf(&versionString, ".%s", VersionPrerelease)
}
env.Ui().Say(versionString.String())
return 0
}
......
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