Skip to content

Commit e084890

Browse files
committed
Merge branch 'rc2.0.48' into master_branch
2 parents c814f93 + 6b68630 commit e084890

File tree

30 files changed

+1127
-827
lines changed

30 files changed

+1127
-827
lines changed

azure-cli2017.pyproj

Lines changed: 209 additions & 0 deletions
Large diffs are not rendered by default.

build_scripts/debian/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Debian Packaging
2+
================
3+
4+
Updating the Debian package
5+
---------------------------
6+
7+
On a build machine (e.g. new Ubuntu 14.04 VM), run the build script.
8+
9+
For example:
10+
```
11+
git clone https://github.com/azure/azure-cli
12+
cd azure-cli
13+
export CLI_VERSION=2.0.9 \
14+
&& export BUILD_ARTIFACT_DIR=$(mktemp -d)\
15+
&& build_scripts/debian/build.sh $(pwd)
16+
```
17+
18+
Note: The paths above have to be full paths, not relative otherwise the build will fail.
19+
20+
Now you have built the package, upload the package to the apt repository.
21+
22+
23+
Verification
24+
------------
25+
26+
```
27+
sudo dpkg -i azure-cli_${CLI_VERSION}-1_all.deb
28+
az
29+
az --version
30+
```

build_scripts/debian/build.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/bin/env bash
2+
#---------------------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
#---------------------------------------------------------------------------------------------
6+
7+
set -ex
8+
9+
: "${CLI_VERSION:?CLI_VERSION environment variable not set.}"
10+
: "${BUILD_ARTIFACT_DIR:?BUILD_ARTIFACT_DIR environment variable not set.}"
11+
12+
if [ -z "$1" ]
13+
then
14+
echo "Argument should be path to local repo."
15+
exit 1
16+
fi
17+
18+
local_repo=$1
19+
20+
sudo apt-get update
21+
22+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
23+
debian_directory_creator=$script_dir/dir_creator.sh
24+
25+
# Install dependencies for the build
26+
sudo apt-get install -y libssl-dev libffi-dev python3-dev debhelper
27+
# Download, Extract, Patch, Build CLI
28+
tmp_pkg_dir=$(mktemp -d)
29+
working_dir=$(mktemp -d)
30+
cd $working_dir
31+
source_dir=$local_repo
32+
deb_file=$local_repo/../azure-cli_${CLI_VERSION}-${CLI_VERSION_REVISION:=1}_all.deb
33+
az_completion_file=$source_dir/az.completion
34+
# clean up old build output
35+
if [ -d "$source_dir/debian" ]
36+
then
37+
rm -rf $source_dir/debian
38+
fi
39+
[ -d $local_repo/privates ] && cp $local_repo/privates/*.whl $tmp_pkg_dir
40+
41+
# Build Python from source and include
42+
python_dir=$(mktemp -d)
43+
python_archive=$(mktemp)
44+
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz -qO $python_archive
45+
tar -xvzf $python_archive -C $python_dir
46+
echo "Python dir is $python_dir"
47+
# clean any previous make files
48+
make clean || echo "Nothing to clean"
49+
$python_dir/*/configure --srcdir $python_dir/* --prefix $source_dir/python_env
50+
make
51+
# required to run the 'make install'
52+
sudo apt-get install -y zlib1g-dev
53+
make install
54+
55+
# note: This installation step could happen in debian/rules but was unable to escape $ char.
56+
# It does not affect the built .deb file though.
57+
$source_dir/python_env/bin/pip3 install wheel
58+
for d in $source_dir/src/azure-cli $source_dir/src/azure-cli-core $source_dir/src/azure-cli-nspkg \
59+
$source_dir/src/azure-cli-command_modules-nspkg $source_dir/src/command_modules/azure-cli-*/;
60+
do cd $d;
61+
$source_dir/python_env/bin/python3 setup.py bdist_wheel -d $tmp_pkg_dir;
62+
cd -;
63+
done;
64+
all_modules=`find $tmp_pkg_dir -name "*.whl"`
65+
$source_dir/python_env/bin/pip3 install $all_modules
66+
$source_dir/python_env/bin/pip3 install --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg
67+
# Add the debian files
68+
mkdir $source_dir/debian
69+
# Create temp dir for the debian/ directory used for CLI build.
70+
cli_debian_dir_tmp=$(mktemp -d)
71+
72+
$debian_directory_creator $cli_debian_dir_tmp $az_completion_file $source_dir
73+
cp -r $cli_debian_dir_tmp/* $source_dir/debian
74+
cd $source_dir
75+
dpkg-buildpackage -us -uc
76+
echo "The archive is available at $working_dir/azure-cli_${CLI_VERSION}-${CLI_VERSION_REVISION:=1}_all.deb"
77+
cp $deb_file ${BUILD_ARTIFACT_DIR}
78+
echo "The archive has also been copied to ${BUILD_ARTIFACT_DIR}"
79+
echo "Done."
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#!/usr/bin/env bash
2+
#---------------------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
#---------------------------------------------------------------------------------------------
6+
7+
set -ex
8+
9+
# Create the debian/ directory for building the azure-cli Debian package
10+
11+
# This script takes an argument of the empty directory where the files will be placed.
12+
13+
if [ -z "$1" ]
14+
then
15+
echo "No argument supplied for debian directory."
16+
exit 1
17+
fi
18+
19+
if [ -z "$2" ]
20+
then
21+
echo "No argument supplied for completion script."
22+
exit 1
23+
fi
24+
25+
if [ -z "$3" ]
26+
then
27+
echo "No argument supplied for source directory."
28+
exit 1
29+
fi
30+
31+
TAB=$'\t'
32+
33+
debian_dir=$1
34+
completion_script=$2
35+
source_dir=$3
36+
mkdir $debian_dir/source
37+
38+
echo '1.0' > $debian_dir/source/format
39+
echo '9' > $debian_dir/compat
40+
41+
cat > $debian_dir/changelog <<- EOM
42+
azure-cli (${CLI_VERSION}-${CLI_VERSION_REVISION:=1}) unstable; urgency=low
43+
44+
* Debian package release.
45+
46+
-- Azure Python CLI Team <azpycli@microsoft.com> $(date -R)
47+
48+
EOM
49+
50+
cat > $debian_dir/control <<- EOM
51+
Source: azure-cli
52+
Section: python
53+
Priority: extra
54+
Maintainer: Azure Python CLI Team <azpycli@microsoft.com>
55+
Build-Depends: debhelper (>= 9), libssl-dev, libffi-dev, python3-dev
56+
Standards-Version: 3.9.5
57+
Homepage: https://github.com/azure/azure-cli
58+
59+
Package: azure-cli
60+
Architecture: all
61+
Depends: \${shlibs:Depends}, \${misc:Depends}
62+
Description: Azure CLI
63+
A great cloud needs great tools; we're excited to introduce Azure CLI,
64+
our next generation multi-platform command line experience for Azure.
65+
66+
EOM
67+
68+
cat > $debian_dir/copyright <<- EOM
69+
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
70+
Upstream-Name: azure-cli
71+
Upstream-Contact: Azure Python CLI Team <azpycli@microsoft.com>
72+
Source: https://github.com/azure/azure-cli
73+
74+
Files: *
75+
Copyright: Copyright (c) Microsoft Corporation
76+
License: MIT
77+
Azure CLI
78+
79+
Copyright (c) Microsoft Corporation
80+
81+
All rights reserved.
82+
83+
MIT License
84+
85+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
86+
87+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
88+
89+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
90+
91+
EOM
92+
93+
# TODO: Instead of "_ssl.cpython-36m-x86_64-linux-gnu.so" only, find all .so files with "find debian/azure-cli/opt/az -type f -name '*.so'"
94+
95+
cat > $debian_dir/rules << EOM
96+
#!/usr/bin/make -f
97+
98+
# Uncomment this to turn on verbose mode.
99+
export DH_VERBOSE=1
100+
export DH_OPTIONS=-v
101+
102+
%:
103+
${TAB}dh \$@ --sourcedirectory $source_dir
104+
105+
override_dh_install:
106+
${TAB}mkdir -p debian/azure-cli/opt/az
107+
${TAB}cp -a python_env/* debian/azure-cli/opt/az
108+
${TAB}mkdir -p debian/azure-cli/usr/bin/
109+
${TAB}echo "\043!/usr/bin/env bash\n/opt/az/bin/python3 -Im azure.cli \"\044\100\"" > debian/azure-cli/usr/bin/az
110+
${TAB}chmod 0755 debian/azure-cli/usr/bin/az
111+
${TAB}mkdir -p debian/azure-cli/etc/bash_completion.d/
112+
${TAB}cat ${completion_script} > debian/azure-cli/etc/bash_completion.d/azure-cli
113+
${TAB}dpkg-shlibdeps -v --warnings=7 -Tdebian/azure-cli.substvars -dDepends -edebian/azure-cli/opt/az/bin/python3 debian/azure-cli/opt/az/lib/python3.6/lib-dynload/_ssl.cpython-36m-x86_64-linux-gnu.so
114+
115+
116+
override_dh_strip:
117+
${TAB}dh_strip --exclude=_cffi_backend
118+
119+
EOM
120+
121+
cat $debian_dir/rules
122+
123+
# debian/rules should be executable
124+
chmod 0755 $debian_dir/rules

build_scripts/docker/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Docker Packaging
2+
================
3+
4+
The Docker image is available at https://hub.docker.com/r/microsoft/azure-cli/tags/.
5+
6+
Updating the Docker image
7+
-------------------------
8+
1. Run `docker build` with the Dockerfile.
9+
When tagging this Docker image, choose an appropriate version number.
10+
e.g.: ``sudo docker build --no-cache --build-arg BUILD_DATE="`date -u +"%Y-%m-%dT%H:%M:%SZ"`" --build-arg CLI_VERSION=${CLI_VERSION} -f Dockerfile -t microsoft/azure-cli:${CLI_VERSION} .``
11+
2. Push the image to the registry,
12+
e.g.: `sudo docker push microsoft/azure-cli:${CLI_VERSION}`
13+
3. Create a PR to commit the Dockerfile changes back to the repository.
14+
15+
16+
Verification
17+
------------
18+
19+
Run the image.
20+
21+
```
22+
$ docker run -it microsoft/azure-cli:${CLI_VERSION}
23+
$ az
24+
$ az --version
25+
```
26+
27+
Save the image
28+
```
29+
docker save -o docker-microsoft-azure-cli-VERSION.tar microsoft/azure-cli:${CLI_VERSION}
30+
```
31+
32+
Load the saved image
33+
```
34+
docker load -i docker-microsoft-azure-cli-VERSION.tar
35+
```

build_scripts/homebrew/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Homebrew Packaging
2+
==================
3+
4+
5+
Updating the formula
6+
--------------------
7+
1. Change the `url` in the formula to point to the new release and change the `sha256` value also.
8+
2. Update the resources list in the formula (see below).
9+
3. Run the formula verification commands (see below).
10+
4. Submit a PR to https://github.com/Homebrew/homebrew-core.
11+
12+
13+
Updating the resources list
14+
---------------------------
15+
```
16+
# Create a new virtual environment first
17+
pip install azure-cli homebrew-pypi-poet; poet -r azure-cli
18+
```
19+
20+
Verification
21+
------------
22+
23+
```
24+
brew install --build-from-source azure-cli.rb
25+
brew test azure-cli.rb
26+
brew audit --strict --online azure-cli.rb
27+
```
28+
29+
More Information
30+
----------------
31+
https://github.com/Homebrew/homebrew-core/blob/master/CONTRIBUTING.md
32+
33+
https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md
34+
35+
https://github.com/Homebrew/brew/blob/master/docs/Acceptable-Formulae.md

0 commit comments

Comments
 (0)