Skip to content

Latest commit

 

History

History
157 lines (115 loc) · 6.69 KB

developer_copr_setup_centos6.md

File metadata and controls

157 lines (115 loc) · 6.69 KB

Developer Copr setup for CentOS6

Background

ManageIQ requires some upstream rpms for use on our CentOS appliances. Copr makes these rpms publicly available for the community build.

These steps will walk you through:

  • Create a Fedora / Copr account
  • Create a Copr project
  • add repositories for dependencies
  • specify the chroot
  • add any additional packages to the minimal chroot
  • specify the src.rpm to build
  • host existing source rpm (srpm) publicly
  • mock, test, and build the rpm
  • incorporate the Copr yum repo into our upstream community build.

Create a Fedora account (used as a Copr account)

Create a Copr project

  • The project groups similar rpms together.
  • Put rpms together based upon a common build environment and package requirements.
  • Also, group rpms based upon how the yum repository will be consumed.
  • Name the project correctly since you can't rename it.

Configure the project's settings:

Find the desired srpm or create it.

Configure mock to test builds locally

Copr is sometimes busy and response can be slow. Using mock, to do test builds locally, can help avoid wasting time waiting for Copr to report the build failed. So use mock locally to debug builds until you get it to build successfully.

  • Create a /etc/mock/YOUR_PROJECT.cfg, by copying your target platform's .cfg.

    • For example, I need epel-6-x86_64, so I do this: cp /etc/mock/epel-6-x86_64.cfg /etc/mock/YOUR_PROJECT.cfg
  • Update the repos you need, for example:

[base]
name=BaseOS
enabled=1
baseurl=http://mirror.centos.org/centos/6/os/$basearch/

[updates]
name=updates
enabled=1
baseurl=http://mirror.centos.org/centos/6/updates/$basearch/

[SCL]
name=SCL
enabled=1
baseurl=http://mirror.centos.org/centos/6/SCL/$basearch/
  • Add a local yum repository so I can mock locally, produce rpms needed for other packages and add them to this yum repo. See below for an explanation.
[local]
name=local
baseurl=file:///home/USERNAME/copr/manageiq
enabled=1
  • Change the following lines that correspond to the option you specified in Copr "specify additional packages to be always present in minimal buildroot":
From:
config_opts['root'] = 'epel-6-x86_64'

To:
config_opts['root'] = 'YOUR_PROJECT'
From:
config_opts['chroot_setup_cmd'] = 'groupinstall buildsys-build'

To:
config_opts['chroot_setup_cmd'] = '@build scl-utils-build ruby193-build'
  • Skip down to "mock locally" and try it.

  • If that fails with "ERROR: Could not find useradd in chroot, maybe the install failed?", perhaps your version of mock/yum isn't handling the package group @build properly so, the shadow-utils package is not installed so useradd is missing.

    • A workaround is to enumerate all of the packages in the build group, see rpm groupinfo build...
    From:
    config_opts['chroot_setup_cmd'] = 'groupinstall buildsys-build'
    

    To:

    config_opts['chroot_setup_cmd'] = 'install scl-utils-build ruby193-build bzip2 coreutils cpio diffutils findutils gawk gcc gcc-c++ grep gzip info make patch redhat-release redhat-release-server redhat-rpm-config rpm-build sed shadow-utils tar unzip util-linux-ng which'
    

mock locally:

build in Copr

Use the Copr repository

Once you follow these instructions and have your Copr repo created and populated with rpms, you need to add the repo as a repo line in the kickstart to enable installing of the packages in the Copr repo at appliance build time. If you need to be able to install/update/re-install from the Copr repo (which should always be the case), you also need to enable the repo for post appliance deployment