From Fedora Project Wiki

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Building Power PC isos

Pungi is the tool used to build isos. It works against a binary rpm repository and along with a matching source repository. It will build an iso that contains a list of packages specified in a kickstart file. It will call lorax to do some of the work for it.

Running inside of mock

Mock will let you initialize a clean root for a given release. For example, to set up a Fedora 20 mock environment, you would do the following:

[build@sharpie ~]$ sudo mock -r fedora-20-ppc64 --clean
[build@sharpie ~]$ sudo mock -r fedora-20-ppc64 --init
[build@sharpie ~]$ sudo mock -r fedora-20-ppc64 --install @buildsys-build vim-enhanced pungi startup-notification basesystem automake llvm-libs glibc.ppc yum yum-utils vi wget less fpaste pungi MAKEDEV fedora-kickstarts fedora-packager hfsplus-tools
[build@sharpie ~]$ sudo mock -r fedora-20-ppc64 --shell

The first thing we need to do is to create the loopback device which the mock environment didn't create for us. Next, we will create three directories:

  • The directory where pungi will do its work: /srv/pungi/
  • The directory where missing source rpms will be downloaded: /home/f20-koji-packages/SRPMS/
  • The directory where any optional packages will reside: /home/f20-private-packages/packages/

<mock-chroot>[root@sharpie ~]# MAKEDEV loop
<mock-chroot>[root@sharpie ~]# mkdir -p /srv/pungi/ /home/f20-koji-packages/SRPMS/ /home/f20-private-packages/packages/

Dealing with missing source RPMs

Pungi needs a matching source rpm for every binary rpm in order to do its job. The Fedora repositories have a binary RPM directory and a source RPM directory. For example with Fedora 20 for the ppc64 release, there is an RPM directory and a SRPM directory. This would be great if the secondary architecture released at the same time (and with the same packages) with the primary architecture. However, the secondary architectures release afterwards and will therefore use a slightly different set of packages as they fix their bugs. This results in a very clearly broken situation.

So, you need to find out what the missing source packages are, download them from koji, and create a private repository to point pungi against.

<mock-chroot>[root@sharpie ~]# cat << '__EOF__' > ~/downloadSourceRpms; chmod u+x ~/downloadSourceRpms
#!/bin/bash

TMPFILE=`mktemp`

# To download the Fedora 20 missing SRPMS
BIN_REPO="http://dl.fedoraproject.org/pub/fedora-secondary/releases/20/Everything/ppc64/os/"
SRC_REPO="http://dl.fedoraproject.org/pub/fedora/linux/releases/20/Everything/source/SRPMS/"
LOCAL_REPO="/home/f20-koji-packages/SRPMS/"

## To download the Rawhide missing SRPMS
#BIN_REPO="http://dl.fedoraproject.org/pub/fedora-secondary/development/rawhide/ppc64/os/"
#SRC_REPO="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/source/SRPMS/"
#LOCAL_REPO="/home/rawhide-koji-packages/SRPMS/"

KOJI="ppc-koji"

#
# Build a list of source rpms which are responsible for the binary packages in BIN_REPO
#
repoquery --tempcache --repofrompath=temp-bin-repo,${BIN_REPO} --disablerepo=\* --enablerepo=temp-bin-repo --all --queryformat '%{SOURCERPM}' | sort | uniq > "${TMPFILE}"

#
# Read the list of source rpms
#
cat "${TMPFILE}" | while read SRPM
do
        NAME=${SRPM%.rpm}

        #
        # See if the source rpm exists in SRC_REPO
        #
        echo -n "Searching for ${NAME} "
        FOUND=`repoquery --tempcache --repofrompath=temp-src-repo,${SRC_REPO} --disablerepo=\* --enablerepo=temp-src-repo --archlist=src "${NAME}" | wc -l`
        echo "${FOUND}"

        if [ "${FOUND}" -eq 1 ]
        then
                #
                # Delete it from the list
                #
                sed -i -e "/${SRPM}/d" "${TMPFILE}"
        fi
done

mkdir -p "${LOCAL_REPO}"
cd "${LOCAL_REPO}"

#
# Read the list of missing source rpms
#
cat "${TMPFILE}" | while read SRPM
do
        NAME=${SRPM%.src.rpm}

        if [ ! -e "${LOCAL_REPO}/${SRPM}" ]
        then
                #
                # Download the missing source rpm from koji
                #
                "${KOJI}" download-build --arch=src "${NAME}"
        fi
done

#
# Create a local source repo
#
createrepo "${LOCAL_REPO}"

#
# Clean up
#
/bin/rm "${TMPFILE}"
__EOF__
<mock-chroot>[root@sharpie ~]# ./downloadSourceRpms

Using your own packages or other koji build packages on the iso

Pungi uses a kickstart file to point to the repositories and to call out the RPMs to install. You can use the --cost parameter to prefer your packages over the default repository. This example will create the private repository directory and download its group file.

Once you have a group file, you can then put privately build packages into /home/f20-private-packages/packages/ or put later koji built updates there. This step is optional. You would only do this if you need a fix. Remember to put the matching source rpms along with the binary rpms. So, for example, we will download a newer version of the Fedora 20 kernel from koji.

After you have put all of the packages you want into your private repo, you would then create a repository from that set of packages.

<mock-chroot>[root@sharpie ~]# (cd /home/f20-private-packages/; URL="http://dl.fedoraproject.org/pub/fedora-secondary/releases/20/Everything/ppc64/os/repodata/"; FILENAME=`wget --quiet -O - ${URL} | grep comps-f20.xml.gz | sed -rn -e 's,^.*<a href=\"([^"]*)\">.*$,\1,p'`; wget --quiet -O comps-f20.xml.gz ${URL}${FILENAME}; gzip -d comps-f20.xml.gz)
<mock-chroot>[root@sharpie ~]# (cd /home/f20-private-packages/packages/; ppc-koji download-build --arch=src --arch=noarch --arch=ppc64 --arch=ppc64p7 kernel-3.14.3-200.fc20)
<mock-chroot>[root@sharpie ~]# (/bin/rm -rf /home/f20-private-packages/repodata/; createrepo --outputdir /home/f20-private-packages/ --groupfile /home/f20-private-packages/comps-f20.xml /home/f20-private-packages/)

Creating the kickstart file

Since we need to add an additional source RPM repository and potentially add a private package repository, we will create a local copy of the kickstart file and used sed to modify it slightly.

<mock-chroot>[root@sharpie ~]# cat /usr/share/spin-kickstarts/fedora-install-fedora.ks | sed -r -e 's/^(repo --name=fedora .*)$/\1 --cost=2/' -e '/^repo --name=fedora-source /arepo --name=fedora-koji-source --baseurl=file:///home/f20-koji-packages/SRPMS/\nrepo --name=localrepo --baseurl=file:///home/f20-private-packages/ --cost=1' > /usr/share/spin-kickstarts/fedora-install-fedora.local.ks

Running pungi

The last step is to run pungi!

<mock-chroot>[root@sharpie ~]# (/bin/rm -rf /srv/pungi/test/; setenforce 0; pungi --nosource --nodebuginfo --destdir=/srv/pungi/test -c /usr/share/spin-kickstarts/fedora-install-fedora.local.ks -G -C -B -I --ver 20 --flavor Fedora 2>&1 | tee errors.pungi)

The output should be under the /srv/pungi/test/20/Fedora/ppc64/iso/ directory.