Include a patch file

This example shows how to build a package with a patch file. To build the package, you need to run the script with python-M2Crypto.spec as an argument, where python-M2Crypto.spec is the RPM specification file.

You can find the patch file at the following location:<BRANCH>/tools/examples/build_spec/user_package_example/0001-openssl-3.0.0-support.patch

To generate the output in the spec-file folder, run the following command:

./photon/tools/scripts/ ./photon/tools/examples/build_spec/user_package_example/python-M2Crypto.spec

The following are the contents of the python-M2Crypto.spec file:

Name:           python3-M2Crypto
Version:        0.36.0
Release:        1%{?dist}
Summary:        Crypto and SSL toolkit for Python
Group:          Development/Languages/Python
License:        MIT
Vendor:         VMware, Inc.
Distribution:   Photon

BuildRequires:  openssl
BuildRequires:  openssl-devel
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-typing
BuildRequires:  swig
BuildRequires:  python3-xml
Requires:       python3-typing
Requires:       python3
Requires:       openssl
Patch0:         0001-openssl-3.0.0-support.patch

M2Crypto is a crypto and SSL toolkit for Python featuring the following:

RSA, DSA, DH, HMACs, message digests, symmetric ciphers (including
AES). SSL functionality to implement clients and servers. HTTPS
extensions to Python's httplib, urllib, and xmlrpclib. Unforgeable
HMAC'ing AuthCookies for web session management. FTP/TLS client and
server. S/MIME. ZServerSSL: A HTTPS server for Zope. ZSmime: An S/MIME
messenger for Zope.

# Using autosetup is not feasible
%setup -q -n M2Crypto-%{version}
%patch0 -p1

CFLAGS="%{optflags}" python3 build --openssl=/usr/include --bundledlls

rm -rf %{buildroot}
python3 install --prefix=%{_prefix} --root=%{buildroot}


Build Logs

The following logs indicate the steps that the script performs internally:

0. Build Script Version: 1.1
1. Create sandbox
        Use local build template image OK
2. Prepare build environment
        Create source folder OK
        Copy sources from ./photon/tools/examples/build_spec/user_package_example OK
        Download M2Crypto-0.36.0.tar.gz OK
        install createrepo OK
        createrepo  OK
        Create local repo in sandbox OK
        makecache OK
        Install build requirements OK
3. Build Binary and Source Package
        Run rpmbuild OK
        Delete SOURCES OK
4. Destroy sandbox
        Stop container OK
        Remove container OK
Build completed. RPMS are in './photon/tools/examples/build_spec/user_package_example/stage' folder
Last modified November 8, 2023: Update (3799256)