This guide shows you how to create RPMs with autospec, a tool that assists in automated creation and maintenance of RPM packaging on Clear Linux* OS.

See our autospec concept page for a detailed explaination of how autospec works on Clear Linux OS. For a general understanding of how RPMs work, we recommend visiting the rpm website or the RPM Packaging Guide .


This guide requires that you:

Install the Clear Linux OS tooling framework

  1. Install the os-clr-on-clr developer bundle on your host system.

    sudo swupd bundle-add os-clr-on-clr
  2. Download the script.

    curl -O
  3. Make executable.

    chmod +x
  4. Run the script as an unprivileged user.

  5. After the script completes, log out and log in again to complete the setup process.

    The user-setup script creates a folder called clearlinux, which contains the Makefile, packages, and projects subfolders.

    The projects folder contains the main tools, autospec and common, used for making packages in Clear Linux OS.

Create a RPM with autospec

Choose one of the following options to build RPMs and manage source code:

Option 1: Build a new RPM

Use this method to build a new RPM with no spec file. In this example, we build a new helloclear RPM.

  1. Navigate to the autospec workspace.

    cd ~/clearlinux
  2. Enter the command:

    make autospecnew URL=""


    For a local tarball, use this type of URL: file://<absolute-path-to-tarball>

  3. If build failures or dependency issues occur, continue below. Otherwise, skip directly to Next steps.

    1. Navigate to the specific package.

      cd ~/clearlinux/packages/[package-name]
    2. Respond to the build process output by editing control files to resolve issues, which may include dependencies or exclusions. See autospec readme

    3. Run this command:

      make autospec

    Repeat the last two steps above until all errors are resolved and you complete a successful build.


You’ve successfully created a RPM.

Skip to Next steps.

Option 2: Build source code with an existing spec file

Use this method if you only want to build the RPM using the spec file. This method assumes that a spec file already exists. In this example, we run a make build on the dmidecode package.

  1. Navigate to the dmidecode package in clearlinux:

    cd ~/clearlinux/packages/dmidecode/
  2. To download the tarball and build, run the command:

    make build


You’ve successfully created a RPM.

Skip to Next steps.

Option 3: Generate a new spec file with a pre-defined package

Use this method to modify an existing package. In this example, you will modify an existing Clear Linux OS package called dmidecode to create a custom RPM. You will make a simple change to this package, change the revision to a new number that is higher than the Clear Linux OS OS version, and rebuild the package.

  1. Navigate to clearlinux:

    cd ~/clearlinux
  2. Copy the dmidecode package.

    make clone_dmidecode
  3. Navigate into the dmidecode directory:

    cd packages/dmidecode
  4. With an editor, open the excludes file and add these lines:



    These files aren’t needed by dmidecode, so we can remove them without any issues.

  5. Save the file and exit.

  6. At ~/clearlinux/packages/dmidecode, build the modified dmidecode package:

    make autospec

    When the process completes, you will see new RPM packages in the results/ folder.

  7. To view the new RPM packages, enter:

    ls /clearlinux/packages/dmidecode/results/


You’ve successfully created a RPM.

Next steps

Now you can create a custom bundle with your new RPM and use it with Clear Linux OS:

  • Use the Mixer tool to add a new bundle to your derivative of Clear Linux OS.
  • Use the Mixin tool to customize your upstream Clear Linux OS installation with a new bundle.