| #!/bin/bash |
| # - rootfs |
| # - benchmark |
| |
| ## makepkg is a script that automates the building of packages; it can download and validate source files, |
| ## check dependencies, configure build-time settings, compile the sources, install into a temporary root, |
| ## make customizations, generate meta-info, and package everything together. |
| ## See: https://wiki.archlinux.org/index.php/Makepkg |
| |
| . $LKP_SRC/lib/debug.sh |
| . $LKP_SRC/lib/misc-base.sh |
| . $LKP_SRC/lib/env.sh |
| |
| [ -n "$rootfs" ] || die "rootfs is empty" |
| |
| DISTRO=${rootfs%%-*} |
| |
| . $LKP_SRC/distro/${DISTRO} |
| . $LKP_SRC/lib/install.sh |
| |
| cd $LKP_SRC/pkg/$benchmark || die "pkg is empty" |
| |
| is_clearlinux && ln -sf $BENCHMARK_ROOT/makepkg/bin/fakeroot /usr/bin/fakeroot |
| |
| pack_to=$(basename $rootfs) |
| PKG_MNT=/osimage/pkg |
| mkdir -p "$PKG_MNT" |
| |
| [ -n "$LKP_SERVER" ] && { |
| mount $LKP_SERVER:$PKG_MNT $PKG_MNT || die "Failed to run mount" |
| } |
| |
| get_pkg_info() |
| { |
| var=$1 |
| pkg_dir=${2:-.} |
| ( |
| . $pkg_dir/PKGBUILD |
| eval echo '$'$var |
| ) |
| } |
| |
| distro_install_depends lkp-dev |
| |
| [[ $arch ]] || arch=`uname -m` |
| |
| build_depends_pkg -i $benchmark $TMP |
| |
| echo $LKP_SRC/sbin/makepkg --config $LKP_SRC/etc/makepkg.conf |
| sync_dest="$PKG_MNT/$pack_to" |
| date=$(date +"%Y-%m-%d") |
| pkgver=$(get_pkg_info pkgver) |
| pkgrel=$(get_pkg_info pkgrel) |
| cgz_name="${benchmark}-${arch}-${pkgver:-0}-${pkgrel:-0}_${date}.cgz" |
| |
| setup_proxy |
| |
| PACMAN=true BUILDDIR=$TMP PKGEXT=.cgz CGZDEST="$sync_dest/$cgz_name" \ |
| $LKP_SRC/sbin/makepkg --config $LKP_SRC/etc/makepkg.conf |
| |
| [ -e "$sync_dest/$cgz_name" ] && ln -sf "$cgz_name" "$sync_dest/${benchmark}-${arch}.cgz" |