Skip to content

Latest commit

 

History

History
99 lines (71 loc) · 3.07 KB

File metadata and controls

99 lines (71 loc) · 3.07 KB

RPM Packaging

Building RPM packages

On a machine with Docker, execute the following command from the root directory of this repository:

Enterprise Linux:

docker build --target build-env -f ./scripts/release/rpm/centos7.dockerfile -t azure/azure-cli:centos7-builder .

Fedora:

docker build --target build-env -f ./scripts/release/rpm/fedora.dockerfile -t azure/azure-cli:fedora29-builder .

Azure Linux:

docker build --target build-env -f ./scripts/release/rpm/azurelinux.dockerfile -t azure/azure-cli:azurelinux-builder .

After several minutes, this will have created a Docker image named azure/azure-cli:centos7-builder containing an unsigned .rpm built from the current contents of your azure-cli directory. To extract the build product from the image you can run the following command:

Enterprise Linux:

docker run azure/azure-cli:centos7-builder cat /root/rpmbuild/RPMS/x86_64/azure-cli-dev-1.el7.x86_64.rpm > ./bin/azure-cli-dev-1.el7.x86_64.rpm

Fedora:

docker run azure/azure-cli:fedora29-builder cat /root/rpmbuild/RPMS/x86_64/azure-cli-dev-1.fc29.x86_64.rpm > ./bin/azure-cli-dev-1.fc29.x86_64.rpm

Azure Linux:

docker run azure/azure-cli:azurelinux-builder cat /usr/src/azl/RPMS/x86_64/azure-cli-dev-1.azl3.x86_64.rpm > ./bin/azure-cli-dev-1.azl3.x86_64.rpm

This launches a container running from the image built and tagged by the previous command, prints the contents of the built package to standard out, and pipes it to a file on your host machine.

Additional Build Flags

--build-arg cli_version={your version string}

This will allow you to name your build. If not specified, the value "dev" is assumed.

--build-arg tag={centos/fedora version}

RPMs must be built using a Red Hat distro or derivative. By default, this build uses CentOS7, but one could easily tweak it to include slightly different packages for distribution.

Verification

Run the RPM package

On a machine with Docker, execute the following command from the root directory of this repository:

docker build -f ./scripts/release/rpm/centos7.dockerfile -t azure/azure-cli:centos7 .

If you had previously followed this instructions above for building an RPM package, this should finish very quickly. Otherwise, it'll take a few minutes to create an image with a copy of the azure-cli installed.

Note: The image that is created by this command does not contain the source code of the azure-cli.

Verification

Install the RPM:

sudo rpm -i RPMS/*/azure-cli-2.0.16-1.noarch.rpm
az --version

Check the file permissions of the package:

rpmlint RPMS/*/azure-cli-2.0.16-1.x86_64.rpm

Check the file permissions of the package:

rpm -qlvp RPMS/*/azure-cli-2.0.16-1.x86_64.rpm

To remove:

sudo rpm -e azure-cli

Links