Merge pull request #820 from brthor/package_tool_cmd_options

Versioning Changes
This commit is contained in:
Bryan Thornbury 2016-01-13 13:15:26 -08:00
commit cc0767c7f4
26 changed files with 269 additions and 118 deletions

View file

@ -2,14 +2,14 @@
"maintainer_name":"Microsoft",
"maintainer_email": "dotnetcore@microsoft.com",
"package_name": "dotnet-dev",
"package_name": "dotnet",
"short_description": ".NET Core & command line tools",
"long_description": ".NET Core is a cross-platform implementation of .NET Framework, a modern, modular platform\n for building diverse kinds of applications, from command-line applications to microservices and \n modern websites.\n This package contains the tools you will need to start writing applications for .NET Core. It includes \n compilers, package managers and other utilities that developers need.",
"homepage": "https://dotnet.github.io/core",
"release":{
"package_version":"0.201",
"package_version":"0.0.0.0",
"package_revision":"1",
"urgency" : "low",
"changelog_message" : "Bootstrap loop package"
@ -33,6 +33,10 @@
"libcurl3" : {}
},
"package_conflicts" : [
"dotnet-nightly"
],
"symlinks": {
"bin/dotnet" : "usr/bin/dotnet",
"bin/dotnet-build" : "usr/bin/dotnet-build",
@ -40,7 +44,7 @@
"bin/dotnet-compile-csc" : "usr/bin/dotnet-compile-csc",
"bin/dotnet-compile-fsc" : "usr/bin/dotnet-compile-fsc",
"bin/dotnet-compile-native" : "/usr/bin/dotnet-compile-native",
"bin/dotnet-init":"usr/bin/dotnet-new",
"bin/dotnet-new": "usr/bin/dotnet-new",
"bin/dotnet-publish" : "usr/bin/dotnet-publish",
"bin/dotnet-repl" : "usr/bin/dotnet-repl",
"bin/dotnet-repl-csi" : "usr/bin/dotnet-repl-csi",

View file

@ -0,0 +1,56 @@
{
"maintainer_name":"Microsoft",
"maintainer_email": "dotnetcore@microsoft.com",
"package_name": "dotnet-nightly",
"short_description": "Unstable Developer Build of .NET Core & command line tools",
"long_description": "Unstable Developer Build of .NET Core is a cross-platform implementation of .NET Framework, a modern, modular platform\n for building diverse kinds of applications, from command-line applications to microservices and \n modern websites.\n This package contains the tools you will need to start writing applications for .NET Core. It includes \n compilers, package managers and other utilities that developers need.",
"homepage": "https://dotnet.github.io/core",
"release":{
"package_version":"0.0.0.0",
"package_revision":"1",
"urgency" : "low",
"changelog_message" : "Bootstrap loop package"
},
"control": {
"priority":"standard",
"section":"devel",
"architecture":"any"
},
"copyright": "2015 Microsoft",
"license": {
"type": "MIT",
"full_text": "Copyright (c) 2015 Microsoft\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
},
"debian_dependencies":{
"libssl-dev" : {},
"clang-3.5" : {},
"libcurl3" : {}
},
"package_conflicts" : [
"dotnet"
],
"symlinks": {
"bin/dotnet" : "usr/bin/dotnet",
"bin/dotnet-build" : "usr/bin/dotnet-build",
"bin/dotnet-compile" : "usr/bin/dotnet-compile",
"bin/dotnet-compile-csc" : "usr/bin/dotnet-compile-csc",
"bin/dotnet-compile-fsc" : "usr/bin/dotnet-compile-fsc",
"bin/dotnet-compile-native" : "/usr/bin/dotnet-compile-native",
"bin/dotnet-new": "usr/bin/dotnet-new",
"bin/dotnet-publish" : "usr/bin/dotnet-publish",
"bin/dotnet-repl" : "usr/bin/dotnet-repl",
"bin/dotnet-repl-csi" : "usr/bin/dotnet-repl-csi",
"bin/dotnet-restore" : "usr/bin/dotnet-restore",
"bin/dotnet-dnx" : "usr/bin/dotnet-dnx",
"bin/dotnet-test" : "usr/bin/dotnet-test",
"bin/dotnet-resgen" : "usr/bin/dotnet-resgen"
}
}

View file

@ -1,13 +1,32 @@
# Debian Packagify
# Debian Package Tool
This is a tool which simplifies the creation process of a debian package.
Use of this tool requires creating a json configuration, and appropriate
directory structure with your desired files to be included.
A tool which consumes a directory structure to produce a debian package.
## Usage
package_tool [path to input directory] [path to output directory]
```
Usage: package_tool [-i <INPUT_DIR>] [-o <OUTPUT_DIRECTORY>]
[-n <PACKAGE_NAME>] [-v <PACKAGE_VERSION>] [-h]
REQUIRED:
-i <INPUT_DIR>: Input directory conforming to package_tool conventions and debian_config.json
-o <OUTPUT_DIR>: Output directory for debian package and other artifacts
OPTIONAL:
-n <PACKAGE_NAME>: name of created package, will override value in debian_config.json
-v <PACKAGE_VERSION>: version of created package, will override value in debian_config.json
-h: Show this message
NOTES:
See Below for more information on package_tool conventions and debian_config.json format
```
## Input Directory Spec
```
package/
$/ (Contents in this directory will be placed absolutely according to their relative path)
usr/lib/somelib.so (ex. This file gets placed at /usr/lib/somelib.so at install)
@ -17,12 +36,15 @@ A tool which consumes a directory structure to produce a debian package.
debian_config.json (See example below)
docs.json (For manpage generation)
(ex. dotnet-commands-test.sh)
```
Note: The default install root is `/usr/share/{package_name}` where package_name is replaced with the name of the created package
## full example debian_config.json
Note: remove all comments before using this
Note: Use the commentless version here (https://github.com/dotnet/cli/blob/master/packaging/debian/package_tool/example_config.json)
```json
{
"maintainer_name":"Microsoft", // [required]
"maintainer_email": "optimus@service.microsoft.com", // [required]
@ -61,4 +83,5 @@ Note: remove all comments before using this
"symlinks": { // (optional no defaults)
"path_relative_to_package_root/test_exe.sh" : "usr/bin/test_exe.sh"
}
}
}
```

View file

@ -3,12 +3,6 @@
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
# Takes Parameters:
# $1 = Input Directory
# $2 = Output Directory
# $3 = Package Version
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@ -16,22 +10,12 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
## Load Functions ##
source $SCRIPT_DIR/scripts/debian_build_lib.sh
INPUT_DIR="$1"
OUTPUT_DIR="$2"
INPUT_PACKAGE_VERSION="$3"
# Special Input Directories + Paths
ABSOLUTE_PLACEMENT_DIR="${INPUT_DIR}/\$"
PACKAGE_ROOT_PLACEMENT_DIR="${INPUT_DIR}/package_root"
# Inputs
INPUT_SAMPLES_DIR="$INPUT_DIR/samples"
INPUT_DOCS_DIR="$INPUT_DIR/docs"
DOCS_JSON_PATH="$INPUT_DIR/docs.json"
CONFIG="$INPUT_DIR/debian_config.json"
## Debian Package Creation Functions ##
execute(){
if ! parse_args_and_set_env_vars "$@"; then
exit 1
fi
# Exit if required validation fails
if ! validate_inputs; then
exit 1
@ -49,40 +33,103 @@ execute(){
copy_files_to_output
}
parse_args_and_set_env_vars(){
OPTIND=1 # Reset in case getopts has been used previously in the shell.
while getopts ":n:v:i:o:h" opt; do
case $opt in
n)
export PACKAGE_NAME="$OPTARG"
;;
v)
export PACKAGE_VERSION="$OPTARG"
;;
i)
export INPUT_DIR="$OPTARG"
;;
o)
export OUTPUT_DIR="$OPTARG"
;;
h)
print_help
return 1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
return 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
return 1
;;
esac
done
# Special Input Directories + Paths
ABSOLUTE_PLACEMENT_DIR="${INPUT_DIR}/\$"
PACKAGE_ROOT_PLACEMENT_DIR="${INPUT_DIR}/package_root"
CONFIG="$INPUT_DIR/debian_config.json"
return 0
}
print_help(){
echo "Usage: package_tool [-i <INPUT_DIR>] [-o <OUTPUT_DIRECTORY>]
[-n <PACKAGE_NAME>] [-v <PACKAGE_VERSION>] [-h]
REQUIRED:
-i <INPUT_DIR>: Input directory conforming to package_tool conventions and debian_config.json
-o <OUTPUT_DIR>: Output directory for debian package and other artifacts
OPTIONAL:
-n <PACKAGE_NAME>: name of created package, will override value in debian_config.json
-v <PACKAGE_VERSION>: version of created package, will override value in debian_config.json
-h: Show this message
NOTES:
See Readme for more information on package_tool conventions and debian_config.json format
https://github.com/dotnet/cli/tree/master/packaging/debian/package_tool
"
}
validate_inputs(){
local ret=0
if [[ ! -d $ABSOLUTE_PLACEMENT_DIR ]]; then
echo "ERROR: $ directory does not exist"
echo $ABSOLUTE_PLACEMENT_DIR
if [[ -z "$INPUT_DIR" ]]; then
echo "ERROR: -i <INPUT_DIRECTORY> Not Specified"
ret=1
fi
if [[ ! -d $PACKAGE_ROOT_PLACEMENT_DIR ]]; then
if [[ -z "$OUTPUT_DIR" ]]; then
echo "ERROR: -o <OUTPUT_DIRECTORY> Not Specified."
ret=1
fi
if [[ ! -d "$PACKAGE_ROOT_PLACEMENT_DIR" ]]; then
echo "ERROR: package_root directory does not exist"
echo $PACKAGE_ROOT_PLACEMENT_DIR
ret=1
fi
if [[ ! -f $CONFIG ]]; then
if [[ ! -f "$CONFIG" ]]; then
echo "ERROR: debian_config.json file does not exist"
echo $CONFIG
ret=1
fi
return $ret
}
parse_config_and_set_env_vars(){
extract_base_cmd="python $SCRIPT_DIR/scripts/extract_json_value.py"
PACKAGE_NAME=$($extract_base_cmd $CONFIG "package_name")
# Override JSON Defined Version w/ Cmd Line ARG
if [ -z $INPUT_PACKAGE_VERSION ]; then
PACKAGE_VERSION=$($extract_base_cmd $CONFIG "release.package_version")
else
PACKAGE_VERSION=$INPUT_PACKAGE_VERSION
fi
# Arguments Take Precedence over Config
[ -z "$PACKAGE_VERSION" ] && PACKAGE_VERSION="$($extract_base_cmd $CONFIG "release.package_version")"
[ -z "$PACKAGE_NAME" ] && PACKAGE_NAME="$($extract_base_cmd $CONFIG "package_name")"
# Inputs
INPUT_SAMPLES_DIR="$INPUT_DIR/samples"
INPUT_DOCS_DIR="$INPUT_DIR/docs"
DOCS_JSON_PATH="$INPUT_DIR/docs.json"
PACKAGE_SOURCE_DIR="${OUTPUT_DIR}/${PACKAGE_NAME}-${PACKAGE_VERSION}"
INSTALL_ROOT="/usr/share/${PACKAGE_NAME}"
@ -134,21 +181,23 @@ package_package_root_placement(){
}
package_absolute_placement(){
abs_in_package_dir="\$"
add_dir_to_install ${ABSOLUTE_PLACEMENT_DIR} $abs_in_package_dir
# Get List of all files in directory tree, relative to ABSOLUTE_PLACEMENT_DIR
abs_files=( $(_get_files_in_dir_tree $ABSOLUTE_PLACEMENT_DIR) )
# For each file add a a system placement
for abs_file in ${abs_files[@]}
do
parent_dir=$(dirname $abs_file)
filename=$(basename $abs_file)
add_system_file_placement "$abs_in_package_dir/$abs_file" "/$parent_dir"
done
if [[ -d "$ABSOLUTE_PLACEMENT_DIR" ]]; then
abs_in_package_dir="\$"
add_dir_to_install ${ABSOLUTE_PLACEMENT_DIR} $abs_in_package_dir
# Get List of all files in directory tree, relative to ABSOLUTE_PLACEMENT_DIR
abs_files=( $(_get_files_in_dir_tree $ABSOLUTE_PLACEMENT_DIR) )
# For each file add a a system placement
for abs_file in ${abs_files[@]}
do
parent_dir=$(dirname $abs_file)
filename=$(basename $abs_file)
add_system_file_placement "$abs_in_package_dir/$abs_file" "/$parent_dir"
done
fi
}
package_samples(){
@ -209,4 +258,4 @@ generate_sample_manifest(){
fi
}
execute
execute "$@"

View file

@ -86,6 +86,9 @@ def generate_control(config_data, template_dir):
dependency_data = config_data.get("debian_dependencies", None)
dependency_str = get_dependendent_packages_string(dependency_data)
conflict_data = config_data.get("package_conflicts", [])
conflict_str = ', '.join(conflict_data)
# Default to empty dict, so we don't explode on nested optional values
control_data = config_data.get("control", dict())
@ -99,6 +102,7 @@ def generate_control(config_data, template_dir):
ARCH=control_data.get("architecture", "all"),
DEPENDENT_PACKAGES=dependency_str,
CONFLICT_PACKAGES=conflict_str,
PACKAGE_NAME=config_data["package_name"],
MAINTAINER_NAME=config_data["maintainer_name"],

View file

@ -14,7 +14,6 @@
# Summary: Writes the contents of the "install_placement" array to the debian/install
# This array is populated by calls to the "add_system_file_placement" function
# Usage: write_debian_install_file
write_debian_install_file(){
# Remove any existing install file, we need to overwrite it
rm -f ${PACKAGE_SOURCE_DIR}/debian/install

View file

@ -14,5 +14,6 @@ Homepage: {HOMEPAGE}
Package: {PACKAGE_NAME}
Architecture: {ARCH}
Depends: ${{shlibs:Depends}}, ${{misc:Depends}}{DEPENDENT_PACKAGES}
Conflicts: {CONFLICT_PACKAGES}
Description: {SHORT_DESCRIPTION}
{LONG_DESCRIPTION}

View file

@ -18,13 +18,13 @@ run_unit_tests(){
run_integration_tests(){
input_dir=$DIR/test/test_assets/test_package_layout
output_dir=$DIR/p_out
output_dir=$DIR/bin
# Create output dir
mkdir -p $output_dir
# Build the actual package
$DIR/package_tool $input_dir $output_dir
$DIR/package_tool -i $input_dir -o $output_dir
# Integration Test Entrypoint placed by package_tool
bats $output_dir/test_package.bats

View file

@ -10,7 +10,7 @@ param(
$toolsDir = $toolsDir.TrimEnd('\')
$versionArg = ""
if ($versionSuffix -ne "") {
$versionArg = "--version-suffix $VersionSuffix"
$versionArg = "--version-suffix $versionSuffix"
}
. "$PSScriptRoot\..\..\scripts\common\_common.ps1"

View file

@ -14,8 +14,8 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
REPOROOT="$( cd -P "$DIR/../../" && pwd )"
if [ -z "$DOTNET_BUILD_VERSION" ]; then
echo "Provide a version number (DOTNET_BUILD_VERSION) $DOTNET_BUILD_VERSION" && exit 1
if [ -z "$DOTNET_CLI_VERSION" ]; then
echo "Provide a version number (DOTNET_CLI_VERSION) $DOTNET_CLI_VERSION" && exit 1
fi
if [ "$(uname)" == "Darwin" ]; then
@ -36,21 +36,21 @@ fi
PACKAGE_DIR=$REPOROOT/artifacts/packages/pkg
[ -d "$PACKAGE_DIR" ] || mkdir -p $PACKAGE_DIR
PACKAGE_NAME=$PACKAGE_DIR/dotnet-cli-x64.${DOTNET_BUILD_VERSION}.pkg
PACKAGE_NAME=$PACKAGE_DIR/dotnet-cli-x64.${DOTNET_CLI_VERSION}.pkg
#chmod -R 755 $STAGE2_DIR
pkgbuild --root $STAGE2_DIR \
--version $DOTNET_BUILD_VERSION \
--version $DOTNET_CLI_VERSION \
--scripts $DIR/scripts \
--identifier com.microsoft.dotnet.cli.pkg.dotnet-osx-x64 \
--install-location /usr/local/share/dotnet \
$DIR/dotnet-osx-x64.$DOTNET_BUILD_VERSION.pkg
$DIR/dotnet-osx-x64.$DOTNET_CLI_VERSION.pkg
cat $DIR/Distribution-Template | sed "/{VERSION}/s//$DOTNET_BUILD_VERSION/g" > $DIR/Dist
cat $DIR/Distribution-Template | sed "/{VERSION}/s//$DOTNET_CLI_VERSION/g" > $DIR/Dist
productbuild --version $DOTNET_BUILD_VERSION --identifier com.microsoft.dotnet.cli --package-path $DIR --resources $DIR/resources --distribution $DIR/Dist $PACKAGE_NAME
productbuild --version $DOTNET_CLI_VERSION --identifier com.microsoft.dotnet.cli --package-path $DIR --resources $DIR/resources --distribution $DIR/Dist $PACKAGE_NAME
#Clean temp files
rm $DIR/dotnet-osx-x64.$DOTNET_BUILD_VERSION.pkg
rm $DIR/dotnet-osx-x64.$DOTNET_CLI_VERSION.pkg
rm $DIR/Dist
$REPOROOT/scripts/publish/publish.sh $PACKAGE_NAME

View file

View file

@ -63,7 +63,7 @@ function RunCandle
Write-Host Running candle..
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows"
.\candle.exe -dDotnetSrc="$inputDir" -dMicrosoftEula="$RepoRoot\packaging\osx\resources\en.lproj\eula.rtf" -dBuildVersion="$env:DOTNET_BUILD_VERSION" -arch x64 `
.\candle.exe -dDotnetSrc="$inputDir" -dMicrosoftEula="$RepoRoot\packaging\osx\resources\en.lproj\eula.rtf" -dBuildVersion="$env:DOTNET_CLI_VERSION" -arch x64 `
-ext WixDependencyExtension.dll `
"$AuthWsxRoot\dotnet.wxs" `
"$AuthWsxRoot\provider.wxs" `
@ -115,7 +115,7 @@ if(!(Test-Path $PackageDir))
mkdir $PackageDir | Out-Null
}
$DotnetMSIOutput = Join-Path $PackageDir "dotnet-win-x64.$env:DOTNET_BUILD_VERSION.msi"
$DotnetMSIOutput = Join-Path $PackageDir "dotnet-win-x64.$env:DOTNET_CLI_VERSION.msi"
Write-Host "Creating dotnet MSI at $DotnetMSIOutput"

View file

@ -15,7 +15,7 @@ $ErrorActionPreference="Stop"
. "$RepoRoot\scripts\build\generate-version.ps1"
header "Building dotnet tools version $($env:DOTNET_BUILD_VERSION) - $Configuration"
header "Building dotnet tools version $($env:DOTNET_CLI_VERSION) - $Configuration"
header "Checking Pre-Reqs"
_ "$RepoRoot\scripts\test\check-prereqs.ps1"

View file

@ -19,7 +19,7 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
source "$REPOROOT/scripts/build/generate-version.sh"
header "Building dotnet tools version $DOTNET_BUILD_VERSION - $CONFIGURATION"
header "Building dotnet tools version $DOTNET_CLI_VERSION - $CONFIGURATION"
header "Checking Pre-Reqs"
$REPOROOT/scripts/test/check-prereqs.sh

View file

@ -3,17 +3,14 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
#. "$PSScriptRoot\..\common\_common.ps1"
$env:ReleaseSuffix = "dev"
$env:MajorVersion = 1
$env:MinorVersion = 0
$env:PatchVersion = 0
# Get the timestamp of the most recent commit
$timestamp = git log -1 --format=%ct
$commitTime = [timespan]::FromSeconds($timestamp)
$env:CommitCountVersion = (git rev-list --count HEAD).PadLeft(6, "0")
$majorVersion = 1
$minorVersion = 0
$buildnumber = 0
$revnumber = $commitTime.TotalSeconds
# Zero Padded Suffix for use with Nuget
$env:VersionSuffix = "$env:ReleaseSuffix-$env:CommitCountVersion"
$VersionSuffix = "dev-$revnumber"
$env:DOTNET_BUILD_VERSION = "$majorVersion.$minorVersion.$buildnumber.$revnumber"
$env:DOTNET_CLI_VERSION = "$env:MajorVersion.$env:MinorVersion.$env:PatchVersion.$env:CommitCountVersion"

View file

@ -4,9 +4,11 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
# UTC Timestamp of the last commit is used as the build number. This is for easy synchronization of build number between Windows, OSX and Linux builds.
LAST_COMMIT_TIMESTAMP=$(git log -1 --format=%ct)
export DOTNET_BUILD_VERSION=1.0.0-dev-$LAST_COMMIT_TIMESTAMP
echo "Version: $DOTNET_BUILD_VERSION"
export RELEASE_SUFFIX=dev
export MAJOR_VERSION=1
export MINOR_VERSION=0
export PATCH_VERSION=0
unset LAST_COMMIT_TIMESTAMP
export COMMIT_COUNT_VERSION=$(printf "%06d" $(git rev-list --count HEAD))
export DOTNET_CLI_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION.$COMMIT_COUNT_VERSION

View file

@ -18,6 +18,6 @@ $PackageDir = "$RepoRoot\artifacts\packages\dnvm"
# Set reasonable defaults for unset variables
setEnvIfDefault "DOTNET_INSTALL_DIR" "$(Convert-Path "$PSScriptRoot\..")\.dotnet_stage0\win7-x64"
setEnvIfDefault "DOTNET_BUILD_VERSION" "0.1.0.0"
setEnvIfDefault "DOTNET_CLI_VERSION" "0.1.0.0"
setPathAndHomeIfDefault "$Stage2Dir"
setVarIfDefault "Configuration" "Debug"

View file

@ -25,7 +25,7 @@ export STAGE2_DIR=$OUTPUT_ROOT/stage2
export HOST_DIR=$OUTPUT_ROOT/corehost
[ -z "$DOTNET_INSTALL_DIR" ] && export DOTNET_INSTALL_DIR=$REPOROOT/.dotnet_stage0/$RID
[ -z "$DOTNET_BUILD_VERSION" ] && export DOTNET_BUILD_VERSION=0.1.0.0
[ -z "$DOTNET_CLI_VERSION" ] && export DOTNET_CLI_VERSION=0.1.0.0
[ -z "$DOTNET_HOME" ] && export DOTNET_HOME=$STAGE2_DIR && export PATH=$STAGE2_DIR/bin:$PATH
[ -z "$CONFIGURATION" ] && export CONFIGURATION=Debug
[ -z "$NOCACHE" ] && export NOCACHE=""

View file

@ -34,7 +34,7 @@ info "Using code from: $DOCKER_HOST_SHARE_DIR"
docker run -t --rm --sig-proxy=true \
--name $DOTNET_BUILD_CONTAINER_NAME \
-v $DOCKER_HOST_SHARE_DIR:/opt/code \
-e DOTNET_BUILD_VERSION \
-e DOTNET_CLI_VERSION \
-e SASTOKEN \
-e STORAGE_ACCOUNT \
-e STORAGE_CONTAINER \

View file

@ -18,12 +18,12 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
if [ "$UNAME" != "Linux" ]; then
error "Debian Package build only supported on Linux"
if [ "$OSNAME" != "ubuntu" ]; then
error "Debian Package build only supported on Ubuntu"
exit 1
fi
PACKAGING_ROOT=$REPOROOT/packaging/debian
PACKAGING_ROOT="$REPOROOT/packaging/debian"
OUTPUT_DIR="$REPOROOT/artifacts"
PACKAGE_LAYOUT_DIR="$OUTPUT_DIR/deb_intermediate"
@ -32,12 +32,28 @@ TEST_STAGE_DIR="$PACKAGE_OUTPUT_DIR/test"
REPO_BINARIES_DIR="$REPOROOT/artifacts/ubuntu.14.04-x64/stage2"
MANPAGE_DIR="$REPOROOT/Documentation/manpages"
NIGHTLY_PACKAGE_NAME="dotnet-nightly"
RELEASE_PACKAGE_NAME="dotnet"
execute_build(){
determine_package_name
create_empty_debian_layout
copy_files_to_debian_layout
create_debian_package
}
determine_package_name(){
if [[ "$RELEASE_SUFFIX" == "dev" ]]; then
DOTNET_DEB_PACKAGE_NAME=$NIGHTLY_PACKAGE_NAME
elif [[ "beta rc1 rc2 rtm" =~ (^| )"$RELEASE_SUFFIX"($| ) ]]; then
DOTNET_DEB_PACKAGE_NAME=$RELEASE_PACKAGE_NAME
elif [[ "$RELEASE_SUFFIX" == "" ]]; then
DOTNET_DEB_PACKAGE_NAME=$RELEASE_PACKAGE_NAME
else
DOTNET_DEB_PACKAGE_NAME=$NIGHTLY_PACKAGE_NAME
fi
}
execute_test(){
test_debian_package
}
@ -45,8 +61,8 @@ execute_test(){
create_empty_debian_layout(){
header "Creating empty debian package layout"
rm -rf $PACKAGE_LAYOUT_DIR
mkdir -p $PACKAGE_LAYOUT_DIR
rm -rf "$PACKAGE_LAYOUT_DIR"
mkdir -p "$PACKAGE_LAYOUT_DIR"
mkdir "$PACKAGE_LAYOUT_DIR/\$"
mkdir "$PACKAGE_LAYOUT_DIR/package_root"
@ -61,7 +77,7 @@ copy_files_to_debian_layout(){
cp -a "$REPO_BINARIES_DIR/." "$PACKAGE_LAYOUT_DIR/package_root"
# Copy config file
cp "$PACKAGING_ROOT/debian_config.json" "$PACKAGE_LAYOUT_DIR"
cp "$PACKAGING_ROOT/$DOTNET_DEB_PACKAGE_NAME-debian_config.json" "$PACKAGE_LAYOUT_DIR/debian_config.json"
# Copy Manpages
cp -a "$MANPAGE_DIR/." "$PACKAGE_LAYOUT_DIR/docs"
@ -70,9 +86,9 @@ copy_files_to_debian_layout(){
create_debian_package(){
header "Packing .deb"
mkdir -p $PACKAGE_OUTPUT_DIR
$PACKAGING_ROOT/package_tool/package_tool $PACKAGE_LAYOUT_DIR $PACKAGE_OUTPUT_DIR $DOTNET_BUILD_VERSION
mkdir -p "$PACKAGE_OUTPUT_DIR"
"$PACKAGING_ROOT/package_tool/package_tool" -i "$PACKAGE_LAYOUT_DIR" -o "$PACKAGE_OUTPUT_DIR" -v $DOTNET_CLI_VERSION -n $DOTNET_DEB_PACKAGE_NAME
}
test_debian_package(){
@ -85,7 +101,7 @@ test_debian_package(){
# E2E Testing of package surface area
# Disabled: https://github.com/dotnet/cli/issues/381
#run_e2e_test
# run_e2e_test
}
run_e2e_test(){

View file

@ -22,7 +22,7 @@ fi
PACKAGE_DIR=$REPOROOT/artifacts/packages/dnvm
[ -d "$PACKAGE_DIR" ] || mkdir -p $PACKAGE_DIR
PACKAGE_SHORT_NAME=dotnet-${OSNAME}-x64.${DOTNET_BUILD_VERSION}
PACKAGE_SHORT_NAME=dotnet-${OSNAME}-x64.${DOTNET_CLI_VERSION}
PACKAGE_NAME=$PACKAGE_DIR/${PACKAGE_SHORT_NAME}.tar.gz
cd $STAGE2_DIR

View file

@ -9,8 +9,8 @@ if(!(Test-Path $PackageDir)) {
mkdir $PackageDir | Out-Null
}
if(![string]::IsNullOrEmpty($env:DOTNET_BUILD_VERSION)) {
$PackageVersion = $env:DOTNET_BUILD_VERSION
if(![string]::IsNullOrEmpty($env:DOTNET_CLI_VERSION)) {
$PackageVersion = $env:DOTNET_CLI_VERSION
} else {
$Timestamp = [DateTime]::Now.ToString("yyyyMMddHHmmss")
$PackageVersion = "0.0.1-dev-t$Timestamp"

View file

@ -13,4 +13,4 @@ header "Generating dotnet MSI"
_ "$RepoRoot\packaging\windows\generatemsi.ps1" @("$Stage2Dir")
header "Generating NuGet packages"
_ "$RepoRoot\packaging\nuget\package.ps1" @("$Stage2Dir\bin", "$VersionSuffix")
_ "$RepoRoot\packaging\nuget\package.ps1" @("$Stage2Dir\bin", "$env:VersionSuffix")

View file

@ -15,9 +15,9 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
source "$REPOROOT/scripts/build/generate-version.sh"
if [ -z "$DOTNET_BUILD_VERSION" ]; then
if [ -z "$DOTNET_CLI_VERSION" ]; then
TIMESTAMP=$(date "+%Y%m%d%H%M%S")
DOTNET_BUILD_VERSION=0.0.1-dev-t$TIMESTAMP
DOTNET_CLI_VERSION=0.0.1-dev-t$TIMESTAMP
fi
header "Generating tarball"

View file

@ -9,7 +9,7 @@ param(
function CheckRequiredVariables
{
if([string]::IsNullOrEmpty($env:DOTNET_BUILD_VERSION))
if([string]::IsNullOrEmpty($env:DOTNET_CLI_VERSION))
{
return $false
}
@ -71,7 +71,7 @@ function UploadBinaries($zipFile)
{
$result = -1
$fileName = [System.IO.Path]::GetFileName($zipFile)
$zipBlob = "$env:CHANNEL/Binaries/$env:DOTNET_BUILD_VERSION/$fileName"
$zipBlob = "$env:CHANNEL/Binaries/$env:DOTNET_CLI_VERSION/$fileName"
if(-Not (UploadFile $zipBlob $zipFile))
{
@ -88,7 +88,7 @@ function UploadBinaries($zipFile)
# update the index file too
$indexContent = "Binaries/$env:DOTNET_BUILD_VERSION/$fileName"
$indexContent = "Binaries/$env:DOTNET_CLI_VERSION/$fileName"
$indexFile = "$env:TEMP\latest.win.index"
$indexContent | Out-File -FilePath $indexFile
@ -115,7 +115,7 @@ function UploadBinaries($zipFile)
function UploadInstallers($msiFile)
{
$fileName = [System.IO.Path]::GetFileName($msiFile)
$msiBlob = "$env:CHANNEL/Installers/$env:DOTNET_BUILD_VERSION/$fileName"
$msiBlob = "$env:CHANNEL/Installers/$env:DOTNET_CLI_VERSION/$fileName"
if(-Not (UploadFile $msiBlob $msiFile))
{

View file

@ -54,8 +54,8 @@ execute(){
validate_env_variables(){
local ret=0
if [[ -z "$DOTNET_BUILD_VERSION" ]]; then
warning "DOTNET_BUILD_VERSION environment variable not set"
if [[ -z "$DOTNET_CLI_VERSION" ]]; then
warning "DOTNET_CLI_VERSION environment variable not set"
ret=1
fi
@ -128,7 +128,7 @@ update_file_in_blob_storage(){
upload_binaries_to_blob_storage(){
local tarfile=$1
local filename=$(basename $tarfile)
local blob="$CHANNEL/Binaries/$DOTNET_BUILD_VERSION/$filename"
local blob="$CHANNEL/Binaries/$DOTNET_CLI_VERSION/$filename"
if ! upload_file_to_blob_storage_azure_cli $blob $tarfile; then
return 1
@ -143,7 +143,7 @@ upload_binaries_to_blob_storage(){
fi
# update the index file
local indexContent="Binaries/$DOTNET_BUILD_VERSION/$filename"
local indexContent="Binaries/$DOTNET_CLI_VERSION/$filename"
local indexfile="latest.$OSNAME.index"
local index_URL="https://$STORAGE_ACCOUNT.blob.core.windows.net/$STORAGE_CONTAINER/$CHANNEL/dnvm/$indexfile$SASTOKEN"
update_file_in_blob_storage $index_URL $indexfile $indexContent
@ -161,7 +161,7 @@ upload_binaries_to_blob_storage(){
upload_installers_to_blob_storage(){
local installfile=$1
local filename=$(basename $installfile)
local blob="$CHANNEL/Installers/$DOTNET_BUILD_VERSION/$filename"
local blob="$CHANNEL/Installers/$DOTNET_CLI_VERSION/$filename"
if ! upload_file_to_blob_storage_azure_cli $blob $installfile; then
return 1