restructure the output layout
also reorganize the scripts folder
This commit is contained in:
parent
df3a5fba7a
commit
4cc15b1246
61 changed files with 926 additions and 3213 deletions
79
scripts/package/package-debian.sh
Executable file
79
scripts/package/package-debian.sh
Executable file
|
@ -0,0 +1,79 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Debian Packaging Script
|
||||
# Currently Intended to build on ubuntu14.04
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
source "$DIR/../_common.sh"
|
||||
|
||||
if [ "$UNAME" != "Linux" ]; then
|
||||
error "Debian Package build only supported on Linux"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REPO_ROOT=$(readlink -f $DIR/../..)
|
||||
|
||||
OUTPUT_DIR="$REPO_ROOT/artifacts"
|
||||
PACKAGE_LAYOUT_DIR="$OUTPUT_DIR/deb_intermediate"
|
||||
PACKAGE_OUTPUT_DIR="$OUTPUT_DIR/packages/debian"
|
||||
REPO_BINARIES_DIR="$REPO_ROOT/artifacts/ubuntu.14.04-x64/stage2"
|
||||
|
||||
execute(){
|
||||
create_empty_debian_layout
|
||||
copy_files_to_debian_layout
|
||||
create_debian_package
|
||||
test_debian_package
|
||||
}
|
||||
|
||||
create_empty_debian_layout(){
|
||||
header "Creating empty debian package layout"
|
||||
|
||||
rm -rf $PACKAGE_LAYOUT_DIR
|
||||
mkdir -p $PACKAGE_LAYOUT_DIR
|
||||
|
||||
mkdir "$PACKAGE_LAYOUT_DIR/\$"
|
||||
mkdir "$PACKAGE_LAYOUT_DIR/package_root"
|
||||
mkdir "$PACKAGE_LAYOUT_DIR/samples"
|
||||
mkdir "$PACKAGE_LAYOUT_DIR/docs"
|
||||
}
|
||||
|
||||
copy_files_to_debian_layout(){
|
||||
header "Copying files to debian layout"
|
||||
|
||||
# Copy Built Binaries
|
||||
cp -a "$REPO_BINARIES_DIR/." "$PACKAGE_LAYOUT_DIR/package_root"
|
||||
|
||||
# Copy config file
|
||||
cp "$REPO_ROOT/debian_config.json" "$PACKAGE_LAYOUT_DIR"
|
||||
}
|
||||
|
||||
create_debian_package(){
|
||||
header "Packing .deb"
|
||||
|
||||
mkdir -p $PACKAGE_OUTPUT_DIR
|
||||
|
||||
$REPO_ROOT/package_tool/package_tool $PACKAGE_LAYOUT_DIR $PACKAGE_OUTPUT_DIR $DOTNET_BUILD_VERSION
|
||||
}
|
||||
|
||||
test_debian_package(){
|
||||
header "Testing debian package"
|
||||
|
||||
git clone https://github.com/sstephenson/bats.git /tmp/bats
|
||||
pushd /tmp/bats
|
||||
./install.sh /usr/local
|
||||
popd
|
||||
|
||||
bats $PACKAGE_OUTPUT_DIR/test_package.bats
|
||||
}
|
||||
|
||||
execute
|
||||
|
||||
DEBIAN_FILE=$(find $PACKAGE_OUTPUT_DIR -iname "*.deb")
|
||||
$DIR/../publish/publish.sh $DEBIAN_FILE
|
43
scripts/package/package-dnvm.sh
Executable file
43
scripts/package/package-dnvm.sh
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
source "$DIR/../_common.sh"
|
||||
|
||||
REPOROOT="$( cd -P "$DIR/../.." && pwd )"
|
||||
|
||||
if [ -z "$DOTNET_BUILD_VERSION" ]; then
|
||||
TIMESTAMP=$(date "+%Y%m%d%H%M%S")
|
||||
DOTNET_BUILD_VERSION=0.0.1-alpha-t$TIMESTAMP
|
||||
fi
|
||||
|
||||
STAGE2_DIR=$REPOROOT/artifacts/$RID/stage2
|
||||
|
||||
if [ ! -d "$STAGE2_DIR" ]; then
|
||||
error "missing stage2 output in $STAGE2_DIR" 1>&2
|
||||
exit
|
||||
fi
|
||||
|
||||
PACKAGE_DIR=$REPOROOT/artifacts/packages/dnvm
|
||||
[ -d "$PACKAGE_DIR" ] || mkdir -p $PACKAGE_DIR
|
||||
|
||||
PACKAGE_SHORT_NAME=dotnet-${OSNAME}-x64.${DOTNET_BUILD_VERSION}
|
||||
PACKAGE_NAME=$PACKAGE_DIR/${PACKAGE_SHORT_NAME}.tar.gz
|
||||
|
||||
cd $STAGE2_DIR
|
||||
|
||||
header "Packaging $PACKAGE_SHORT_NAME"
|
||||
|
||||
# Tar up the stage2 artifacts
|
||||
# We need both "*" and ".version" to ensure we pick up that file
|
||||
tar -czf $PACKAGE_NAME * .version
|
||||
|
||||
info "Packaged stage2 to $PACKAGE_NAME"
|
||||
|
||||
$DIR/../publish/publish.sh $PACKAGE_NAME
|
39
scripts/package/package.ps1
Normal file
39
scripts/package/package.ps1
Normal file
|
@ -0,0 +1,39 @@
|
|||
. "$PSScriptRoot\..\_common.ps1"
|
||||
|
||||
if(!(Test-Path $PackageDir)) {
|
||||
mkdir $PackageDir | Out-Null
|
||||
}
|
||||
|
||||
if(![string]::IsNullOrEmpty($env:DOTNET_BUILD_VERSION)) {
|
||||
$PackageVersion = $env:DOTNET_BUILD_VERSION
|
||||
} else {
|
||||
$Timestamp = [DateTime]::Now.ToString("yyyyMMddHHmmss")
|
||||
$PackageVersion = "0.0.1-alpha-t$Timestamp"
|
||||
}
|
||||
|
||||
# Stamp the output with the commit metadata and version number
|
||||
$Commit = git rev-parse HEAD
|
||||
|
||||
$VersionContent = @"
|
||||
$Commit
|
||||
$PackageVersion
|
||||
"@
|
||||
|
||||
$VersionContent | Out-File -Encoding UTF8 "$Stage2Dir\.version"
|
||||
|
||||
$PackageName = Join-Path $PackageDir "dotnet-win-x64.$PackageVersion.zip"
|
||||
|
||||
if (Test-Path $PackageName)
|
||||
{
|
||||
del $PackageName
|
||||
}
|
||||
|
||||
Add-Type -Assembly System.IO.Compression.FileSystem
|
||||
[System.IO.Compression.ZipFile]::CreateFromDirectory($Stage2Dir, $PackageName, "Optimal", $false)
|
||||
|
||||
Write-Host "Packaged stage2 to $PackageName"
|
||||
|
||||
$PublishScript = Join-Path $PSScriptRoot "..\publish\publish.ps1"
|
||||
& $PublishScript -file $PackageName
|
||||
|
||||
exit $LastExitCode
|
36
scripts/package/package.sh
Executable file
36
scripts/package/package.sh
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
REPOROOT="$( cd -P "$DIR/../.." && pwd )"
|
||||
|
||||
source "$DIR/../_common.sh"
|
||||
|
||||
echo "Starting packaging"
|
||||
|
||||
if [ -z "$DOTNET_BUILD_VERSION" ]; then
|
||||
TIMESTAMP=$(date "+%Y%m%d%H%M%S")
|
||||
export DOTNET_BUILD_VERSION=0.0.1-alpha-t$TIMESTAMP
|
||||
echo "Version: $DOTNET_BUILD_VERSION"
|
||||
fi
|
||||
|
||||
COMMIT=$(git rev-parse HEAD)
|
||||
echo $COMMIT > $STAGE2_DIR/.version
|
||||
echo $DOTNET_BUILD_VERSION >> $STAGE2_DIR/.version
|
||||
|
||||
# Create Dnvm Package
|
||||
$DIR/package-dnvm.sh
|
||||
|
||||
if [[ "$UNAME" == "Linux" ]]; then
|
||||
# Create Debian package
|
||||
$DIR/package-debian.sh
|
||||
elif [[ "$UNAME" == "Darwin" ]]; then
|
||||
# Create OSX PKG
|
||||
$DIR/../../packaging/osx/package-osx.sh
|
||||
fi
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue