|
| 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 |
0 commit comments