Hello community, here is the log from the commit of package build for openSUSE:Factory checked in at 2016-03-14 09:56:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/build (Old) and /work/SRC/openSUSE:Factory/.build.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "build" Changes: -------- --- /work/SRC/openSUSE:Factory/build/build.changes 2015-11-17 14:19:17.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.build.new/build.changes 2016-03-14 09:56:28.000000000 +0100 @@ -1,0 +2,24 @@ +Fri Mar 4 07:29:26 UTC 2016 - [email protected] + +- add switch to enable VM console input +- add --vm-user option to run kvm as non-root +- Implement experimental obscpio unpacking +- Use fallocate -p for a fast zero-fill, correctly truncate. +- PowerVM backend +- Make --ignoreignore only ignore ignores from the project config +- aggregate patches fields +- Fail simpleimage build when integration scripts fail +- mkdrpms: do not create debuginfo/source deltas + +Kiwi: +- Support new Kiwi v8 (experimental) +- Make sure kiwi is called in UTF-8 locale +- Kiwi appliance: support "replaces" attribute and handle it as buildignore +- KIWI profile support +- Support a way to map urls to OBS project/repos + +Debian: +- Support lintian when OBS_DCH_RELEASE set +- Add support for debbuild's eval and .debmacros + +------------------------------------------------------------------- Old: ---- obs-build-20151105.tar.gz New: ---- obs-build-20160304.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ build.spec ++++++ --- /var/tmp/diff_new_pack.m9OGPf/_old 2016-03-14 09:56:30.000000000 +0100 +++ /var/tmp/diff_new_pack.m9OGPf/_new 2016-03-14 09:56:30.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package build # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,7 +22,7 @@ Summary: A Script to Build SUSE Linux RPMs License: GPL-2.0+ and GPL-2.0 Group: Development/Tools/Building -Version: 20151105 +Version: 20160304 Release: 0 Source: obs-build-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ PKGBUILD ++++++ --- /var/tmp/diff_new_pack.m9OGPf/_old 2016-03-14 09:56:30.000000000 +0100 +++ /var/tmp/diff_new_pack.m9OGPf/_new 2016-03-14 09:56:30.000000000 +0100 @@ -1,5 +1,5 @@ pkgname=build -pkgver=20151105 +pkgver=20160304 pkgrel=0 pkgdesc="Build packages in sandbox" arch=('i686' 'x86_64') ++++++ build.dsc ++++++ --- /var/tmp/diff_new_pack.m9OGPf/_old 2016-03-14 09:56:30.000000000 +0100 +++ /var/tmp/diff_new_pack.m9OGPf/_new 2016-03-14 09:56:30.000000000 +0100 @@ -1,6 +1,6 @@ Format: 1.0 Source: build -Version: 20151105 +Version: 20160304 Binary: build Maintainer: Adrian Schroeter <[email protected]> Architecture: all ++++++ debian.changelog ++++++ --- /var/tmp/diff_new_pack.m9OGPf/_old 2016-03-14 09:56:30.000000000 +0100 +++ /var/tmp/diff_new_pack.m9OGPf/_new 2016-03-14 09:56:30.000000000 +0100 @@ -1,4 +1,4 @@ -build (20151105) unstable; urgency=low +build (20160304) unstable; urgency=low * Update to current git trunk - add sles11sp2 build config and adapt autodetection ++++++ obs-build-20151105.tar.gz -> obs-build-20160304.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/Build/Kiwi.pm new/obs-build-20160304/Build/Kiwi.pm --- old/obs-build-20151105/Build/Kiwi.pm 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/Build/Kiwi.pm 2016-03-04 17:19:26.000000000 +0100 @@ -24,6 +24,7 @@ use Build::SimpleXML; our $bootcallback; +our $urlmapper; sub unify { my %h = map {$_ => 1} @_; @@ -123,8 +124,14 @@ push @repos, '_obsrepositories'; next; } - die("bad instsource path: $kiwisource->{'path'}\n") unless $kiwisource->{'path'} =~ /^obs:\/\/\/?([^\/]+)\/([^\/]+)\/?$/; - push @repos, "$1/$2"; + if ($kiwisource->{'path'} =~ /^obs:\/\/\/?([^\/]+)\/([^\/]+)\/?$/) { + push @repos, "$1/$2"; + } else { + my $prp; + $prp = $urlmapper->($kiwisource->{'path'}) if $urlmapper; + die("instsource repo url not using obs:/ scheme: $kiwisource->{'path'}\n") unless $prp; + push @repos, $prp; + } } $ret->{'sourcemedium'} = -1; $ret->{'debugmedium'} = -1; @@ -166,9 +173,15 @@ if ($kiwisource->{'path'} eq 'obsrepositories:/') { push @repos, '_obsrepositories'; next; - }; - die("bad path using not obs:/ URL: $kiwisource->{'path'}\n") unless $kiwisource->{'path'} =~ /^obs:\/\/\/?([^\/]+)\/([^\/]+)\/?$/; - push @repos, "$1/$2"; + } + if ($kiwisource->{'path'} =~ /^obs:\/\/\/?([^\/]+)\/([^\/]+)\/?$/) { + push @repos, "$1/$2"; + } else { + my $prp; + $prp = $urlmapper->($kiwisource->{'path'}) if $urlmapper; + die("repo url not using obs:/ scheme: $kiwisource->{'path'}\n") unless $prp; + push @repos, $prp; + } } # Find packages and possible additional required architectures @@ -212,6 +225,10 @@ push @packages, "-".$package->{'name'}; next; } + # handle replaces as buildignore + if ($package->{'replaces'}) { + push @packages, "-".$package->{'replaces'}; + } # we need this package push @packages, $package->{'name'}; @@ -276,6 +293,7 @@ sub show { my ($fn, $field, $arch) = @ARGV; + local $urlmapper = sub { return $_[0] }; my $cf = {'arch' => $arch}; my $d = parse($cf, $fn); die("$d->{'error'}\n") if $d->{'error'}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/Build.pm new/obs-build-20160304/Build.pm --- old/obs-build-20151105/Build.pm 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/Build.pm 2016-03-04 17:19:26.000000000 +0100 @@ -947,7 +947,7 @@ my $requires = $config->{'requiresh'}; my %xignore = map {substr($_, 1) => 1} grep {/^-/} @p; - $ignoreignore = 1 if $xignore{'-ignoreignore--'}; + $ignore = {} if $xignore{'-ignoreignore--'}; my @directdepsend; if ($xignore{'-directdepsend--'}) { delete $xignore{'-directdepsend--'}; @@ -984,6 +984,7 @@ push @p, $p; next; } + next if $p{$q[0]}; return (undef, "$q[0] $aconflicts{$q[0]}") if $aconflicts{$q[0]}; print "added $q[0] because of $p (direct dep)\n" if $expand_dbg; push @p, $q[0]; @@ -1223,6 +1224,7 @@ sub recipe2buildtype { my ($recipe) = @_; + return undef unless defined $recipe; return $1 if $recipe =~ /\.(spec|dsc|kiwi|livebuild)$/; $recipe =~ s/.*\///; $recipe =~ s/^_service:.*://; @@ -1240,6 +1242,7 @@ my $d = Build::parse($cf, $fn); die("$d->{'error'}\n") if $d->{'error'}; $d->{'sources'} = [ map {ref($d->{$_}) ? @{$d->{$_}} : $d->{$_}} grep {/^source/} sort keys %$d ]; + $d->{'patches'} = [ map {ref($d->{$_}) ? @{$d->{$_}} : $d->{$_}} grep {/^patch/} sort keys %$d ]; my $x = $d->{$field}; $x = [ $x ] unless ref $x; print "$_\n" for @$x; @@ -1302,7 +1305,7 @@ $handle = $binname->[1]; $binname = $binname->[0]; } - return Build::Rpm::query($handle, %opts) if $do_rpm && $binname =~ /\.rpm$/; + return Build::Rpm::query($handle, %opts) if $do_rpm && $binname =~ /\.d?rpm$/; return Build::Deb::query($handle, %opts) if $do_deb && $binname =~ /\.deb$/; return Build::Kiwi::queryiso($handle, %opts) if $do_kiwi && $binname =~ /\.iso$/; return Build::Arch::query($handle, %opts) if $do_arch && $binname =~ /\.pkg\.tar(?:\.gz|\.xz)?$/; @@ -1330,7 +1333,7 @@ sub queryhdrmd5 { my ($binname) = @_; - return Build::Rpm::queryhdrmd5(@_) if $do_rpm && $binname =~ /\.rpm$/; + return Build::Rpm::queryhdrmd5(@_) if $do_rpm && $binname =~ /\.d?rpm$/; return Build::Deb::queryhdrmd5(@_) if $do_deb && $binname =~ /\.deb$/; return Build::Kiwi::queryhdrmd5(@_) if $do_kiwi && $binname =~ /\.iso$/; return Build::Kiwi::queryhdrmd5(@_) if $do_kiwi && $binname =~ /\.raw$/; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/Makefile new/obs-build-20160304/Makefile --- old/obs-build-20151105/Makefile 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/Makefile 2016-03-04 17:19:26.000000000 +0100 @@ -44,6 +44,7 @@ substitutedeps \ debtransform \ debtransformbz2 \ + debtransformxz \ debtransformzip \ mkbaselibs \ mkdrpms \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/build new/obs-build-20160304/build --- old/obs-build-20151105/build 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/build 2016-03-04 17:19:26.000000000 +0100 @@ -324,6 +324,17 @@ --vm-initrd FILE Kernel and initrd to use for VM (kvm and qemu only) + --vm-user USERNAME + User name to run qemu/kvm process + + --vm-telnet PORT + Is forwarding PORT to a telnet session inside of the VM. + Specify also needed extra packages via -x parameter, usually: + --vm-telnet 1234 -x telnet-server -x net-tools + And connect from the host via + telnet 1234 + NOTE: The telnet server gets started after all packages got installed. + --vm-net OPTION --vm-netdev OPTION --vm-device OPTION @@ -356,8 +367,13 @@ test -z "$1" && set 0 rm -f $BUILD_ROOT/exit if test "$1" -eq 1 -a -x /bin/df ; then + echo + echo "$HOST failed \"build $RECIPEFILE\" at `date --utc`." + echo # okay, it failed, but maybe because disk space? if df $BUILD_ROOT 2>/dev/null | grep -q "100%"; then + echo "$HOST ran out of disk space. Please try again." + echo set 3 fi fi @@ -495,11 +511,11 @@ case "$mem" in MemTotal:*) set -- $mem - eval "limit=\$(($2/3*4))" + eval "limit=\$(($2/3*2))" ;; SwapTotal:*) set -- $mem - eval "limit=\$(($2/3*4+$limit))" + eval "limit=\$(($2/3*2+$limit))" ;; esac done < <(cat /proc/meminfo) # cat for proc stuff @@ -1232,17 +1248,47 @@ mount -n -ttmpfs none $BUILD_ROOT/dev/shm 2> /dev/null if test -n "$RUNNING_IN_VM" ; then - if test -x /sbin/ip ; then - ip addr add 127.0.0.1/8 dev lo - ip addr add ::1/128 dev lo - ip link set lo up - else - ifconfig lo 127.0.0.1 up - ifconfig lo add ::1/128 - fi + if test -x /sbin/ip ; then + ip addr add 127.0.0.1/8 dev lo + ip addr add ::1/128 dev lo + ip link set lo up + else + ifconfig lo 127.0.0.1 up + ifconfig lo add ::1/128 + fi + if test -n "$VM_TELNET"; then + VM_TELNET_DEVICE=$( cd /sys/class/net/; echo * ) + VM_TELNET_DEVICE=${VM_TELNET_DEVICE#lo } + VM_TELNET_DEVICE=${VM_TELNET_DEVICE%% *} + if test -z "$VM_TELNET_DEVICE"; then + echo "ERROR: no network device found for telnet server" + cleanup_and_exit 1 + fi + if test -x /sbin/ip ; then + ip addr add 10.0.2.15/8 dev eth0 + ip addr add ::1/24 dev eth0 + ip link set ${VM_TELNET_DEVICE} up + else + if ! test -x /sbin/ifconfig ; then + echo "ERROR: /usr/sbin/in.telnetd is not running, please specify right package via -x option" + cleanup_and_exit 1 + fi + ifconfig ${VM_TELNET_DEVICE} 10.0.2.15 up + ifconfig ${VM_TELNET_DEVICE} add ::1/24 + fi + fi if test -n "$MYHOSTNAME" ; then hostname "$MYHOSTNAME" fi + if test -n "$VM_TELNET"; then + echo WARNING: telnet option used, setting up telnet server + if test -x /usr/sbin/in.telnetd; then + ( /usr/sbin/in.telnetd -L /.build/telnet_login_wrapper -debug 23 & ) + else + echo "ERROR: /usr/sbin/in.telnetd is not running, please specify right package via -x option" + cleanup_and_exit 1 + fi + fi fi setupicecream @@ -1277,10 +1323,25 @@ chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT$TOPDIR" cd $BUILD_ROOT$TOPDIR/SOURCES || cleanup_and_exit 1 + for i in *.obscpio ; do + test -e "$i" || continue + echo "Unpacking $i ..." + echo "#!/bin/sh -e" > $BUILD_ROOT/.unpack.command + shellquote cd "$TOPDIR/SOURCES" >> $BUILD_ROOT/.unpack.command + echo >> $BUILD_ROOT/.unpack.command + echo -n 'cpio --extract --owner="'$BUILD_USER'" --unconditional --preserve-modification-time --make-directories <' >> $BUILD_ROOT/.unpack.command + shellquote "$i" >> $BUILD_ROOT/.unpack.command + echo >> $BUILD_ROOT/.unpack.command + shellquote rm -f "$i" >> $BUILD_ROOT/.unpack.command + echo >> $BUILD_ROOT/.unpack.command + chmod 0755 $BUILD_ROOT/.unpack.command + chroot $BUILD_ROOT su -c /.unpack.command - $BUILD_USER + rm -f $BUILD_ROOT/.unpack.command + done if test -e _service; then - echo "Running build time source services..." - $BUILD_DIR/runservices --buildroot "$BUILD_ROOT" || cleanup_and_exit 1 + echo "Running build time source services..." + $BUILD_DIR/runservices --buildroot "$BUILD_ROOT" || cleanup_and_exit 1 fi echo ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/build-pkg-arch new/obs-build-20160304/build-pkg-arch --- old/obs-build-20151105/build-pkg-arch 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/build-pkg-arch 2016-03-04 17:19:26.000000000 +0100 @@ -46,6 +46,9 @@ } pkg_install_arch() { + # Pacman can't handle chroot + # https://bbs.archlinux.org/viewtopic.php?id=129661 + (cd $BUILD_ROOT/etc && sed -i "s/^CheckSpace/#CheckSpace/g" pacman.conf) # -d -d disables deps checking ( cd $BUILD_ROOT && chroot $BUILD_ROOT pacman -U --force -d -d --noconfirm .init_b_cache/$PKG.$PSUF 2>&1 || touch $BUILD_ROOT/exit ) | \ perl -ne '$|=1;/^(warning: could not get filesystem information for |loading packages|looking for inter-conflicts|Targets |Total Installed Size: |Net Upgrade Size: |Proceed with installation|checking package integrity|loading package files|checking for file conflicts|checking keyring|Packages \(\d+\):|:: Proceed with installation|checking available disk space|installing |upgrading |warning:.*is up to date -- reinstalling|Optional dependencies for| )/||/^$/||print' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/build-recipe-arch new/obs-build-20160304/build-recipe-arch --- old/obs-build-20151105/build-recipe-arch 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/build-recipe-arch 2016-03-04 17:19:26.000000000 +0100 @@ -41,7 +41,10 @@ recipe_prepare_arch() { echo "Preparing sources..." - _arch_recipe_makepkg -so "2>&1" ">/dev/null" + if ! _arch_recipe_makepkg -so "2>&1" ">/dev/null" ; then + echo "failed to prepare sources" + cleanup_and_exit 1 + fi } recipe_build_arch() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/build-recipe-debbuild new/obs-build-20160304/build-recipe-debbuild --- old/obs-build-20151105/build-recipe-debbuild 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/build-recipe-debbuild 2016-03-04 17:19:26.000000000 +0100 @@ -22,7 +22,11 @@ ################################################################ recipe_setup_debbuild() { - TOPDIR=/usr/src/debian + TOPDIR=`chroot $BUILD_ROOT su -c "debbuild --eval '%_topdir'" - $BUILD_USER` + if test -z "$TOPDIR"; then + echo "Error: TOPDIR empty" + cleanup_and_exit 1 + fi test "$DO_INIT_TOPDIR" = false || rm -rf "$BUILD_ROOT$TOPDIR" mkdir -p "$BUILD_ROOT$TOPDIR" mkdir -p "$BUILD_ROOT$TOPDIR/OTHER" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/build-recipe-dsc new/obs-build-20160304/build-recipe-dsc --- old/obs-build-20151105/build-recipe-dsc 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/build-recipe-dsc 2016-03-04 17:19:26.000000000 +0100 @@ -50,6 +50,7 @@ # remove rpm macros (everything after "%") # they are not evaluated by the Debian build process DEB_RELEASE=`sed 's/%.*$//' <<< $RELEASE` + OBS_DCH_RELEASE="" if test -n "$DEB_TRANSFORM" ; then CHANGELOGARGS= @@ -71,13 +72,14 @@ # Alternative to debtransform: apply OBS release number if tag OBS-DCH-RELEASE is set. if test -z "$DEB_TRANSFORM" && grep -Eq '^OBS-DCH-RELEASE: 1' $BUILD_ROOT$TOPDIR/SOURCES/$RECIPEFILE; then + OBS_DCH_RELEASE="+$DEB_RELEASE" chroot $BUILD_ROOT su -c /bin/sh <<EOF cd $TOPDIR/BUILD [ ! -f debian/changelog ] && exit 0 # avoid devscripts dependency and mimic dch PACKAGE=\$(dpkg-parsechangelog 2> /dev/null | grep -E '^Source:' | awk '{ print \$NF }') VERSION=\$(dpkg-parsechangelog 2> /dev/null | grep -E '^Version:' | awk '{ print \$NF }') -sed -i "s/\${PACKAGE} (\${VERSION})/\${PACKAGE} (\${VERSION}+$DEB_RELEASE)/" debian/changelog +sed -i "s/\${PACKAGE} (\${VERSION})/\${PACKAGE} (\${VERSION}$OBS_DCH_RELEASE)/" debian/changelog EOF fi @@ -106,7 +108,7 @@ else chroot $buildroot su -c "export DEB_BUILD_OPTIONS=${DSC_BUILD_OPTIONS} ; cd $TOPDIR/BUILD && $DSC_BUILD_CMD" - $BUILD_USER < /dev/null && BUILD_SUCCEEDED=true if test "$BUILD_SUCCEEDED" = true -a "$DO_CHECKS" != "false" && ( chroot $buildroot su -c "which lintian > /dev/null" - $BUILD_USER < /dev/null ); then - DEB_CHANGESFILE=${DEB_DSCFILE%.dsc}_"$(chroot $buildroot su -c 'dpkg-architecture -qDEB_BUILD_ARCH')".changes + DEB_CHANGESFILE=${DEB_DSCFILE%.dsc}$OBS_DCH_RELEASE"_"$(chroot $buildroot su -c 'dpkg-architecture -qDEB_BUILD_ARCH')".changes" chroot $buildroot su -c "cd $TOPDIR && echo Running lintian && (set -x && lintian -i $TOPDIR/$DEB_CHANGESFILE)" - $BUILD_USER < /dev/null || BUILD_SUCCEEDED=false fi fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/build-recipe-kiwi new/obs-build-20160304/build-recipe-kiwi --- old/obs-build-20151105/build-recipe-kiwi 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/build-recipe-kiwi 2016-03-04 17:19:26.000000000 +0100 @@ -259,6 +259,7 @@ recipe_setup_kiwi() { TOPDIR=/usr/src/packages + rm -rf "$BUILD_ROOT$TOPDIR" mkdir -p "$BUILD_ROOT$TOPDIR" mkdir -p "$BUILD_ROOT$TOPDIR/OTHER" mkdir -p "$BUILD_ROOT$TOPDIR/SOURCES" @@ -338,24 +339,112 @@ popd } +perform_image_build() { + local imgtype=$1 + local legacy=$2 + local prepare_call + local create_call + # When people test mixed build with legacy and new kiwi version + # The zypper cache was used in different ways. Therefore this + # needs a cleanup before the build starts + echo "Cleanup zypper image build cache" + if [ -d "$BUILD_ROOT/var/cache/kiwi/zypper" ];then + rm -rf $BUILD_ROOT/var/cache/kiwi/zypper + fi + echo "running kiwi --prepare for $imgtype..." + # Do not use $BUILD_USER here, since we always need root permissions + prepare_call="cd $TOPDIR/SOURCES && rm -rf $TOPDIR/KIWIROOT-$imgtype" + if [ "$legacy" = "true" ]; then + prepare_call="$prepare_call && /usr/sbin/kiwi --logfile terminal" + else + prepare_call="$prepare_call && LANG=en_US.UTF-8 /usr/bin/kiwi" + prepare_call="$prepare_call --compat -- --debug" + fi + prepare_call="$prepare_call --prepare $TOPDIR/SOURCES" + prepare_call="$prepare_call --root $TOPDIR/KIWIROOT-$imgtype" + prepare_call="$prepare_call $KIWI_PARAMETERS" + chroot $BUILD_ROOT \ + su -c "$prepare_call" - root < /dev/null || cleanup_and_exit 1 + + echo "running kiwi --create for $imgtype..." + mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype + create_call="cd $TOPDIR/SOURCES" + if [ "$legacy" = "true" ]; then + create_call="$create_call && LANG=en_US.UTF-8 /usr/sbin/kiwi" + create_call="$create_call --logfile terminal" + else + create_call="$create_call && /usr/bin/kiwi --compat -- --debug" + fi + create_call="$create_call --create $TOPDIR/KIWIROOT-$imgtype" + create_call="$create_call --type $imgtype" + create_call="$create_call -d $TOPDIR/KIWI-$imgtype" + create_call="$create_call $KIWI_PARAMETERS" + chroot $BUILD_ROOT \ + su -c "$create_call" - root < /dev/null || cleanup_and_exit 1 + + rm -rf "/$TOPDIR/KIWI.bundle" +} + +perform_image_bundle() { + local imgtype=$1 + local legacy=$2 + local bundle_call + if [ "$legacy" = "true" ]; then + bundle_call="/usr/sbin/kiwi --bundle-build $TOPDIR/KIWI-$imgtype" + bundle_call="$bundle_call -d /$TOPDIR/KIWI.bundle/" + bundle_call="$bundle_call --bundle-id Build$RELEASE" + else + bundle_call="LANG=en_US.UTF-8 /usr/bin/kiwi result bundle" + bundle_call="$bundle_call --target-dir $TOPDIR/KIWI-$imgtype" + bundle_call="$bundle_call --id Build$RELEASE" + bundle_call="$bundle_call --bundle-dir /$TOPDIR/KIWI.bundle/" + fi + if chroot $BUILD_ROOT su -c "$bundle_call" - root < /dev/null; then + mv "$BUILD_ROOT/$TOPDIR/KIWI.bundle/"* \ + "$BUILD_ROOT/$TOPDIR/KIWI/" || cleanup_and_exit 1 + rmdir "$BUILD_ROOT/$TOPDIR/KIWI.bundle" + # success + return 0 + fi + # need another way to bundle + return 1 +} + +is_legacy_kiwi() { + if [ -L "$BUILD_ROOT/usr/bin/kiwi" ];then + # The next generation of kiwi is installed to /usr/bin + # If this file is found we expect the new kiwi to be + # installed + return 1 + fi + # in any other case stick to the legacy kiwi + return 0 +} + build_kiwi_appliance() { if test -z "$RUNNING_IN_VM" ; then - # NOTE: this must be done with the outer system, because it loads the dm-mod kernel modules, which needs to fit to the kernel. - echo "starting device mapper for kiwi..." - test -x /etc/init.d/boot.device-mapper && /etc/init.d/boot.device-mapper start + # NOTE: this must be done with the outer system, because it loads + # the dm-mod kernel modules, which needs to fit to the kernel. + echo "starting device mapper for kiwi..." + test -x /etc/init.d/boot.device-mapper && \ + /etc/init.d/boot.device-mapper start + fi + KIWI_PROFILE=$(queryconfig \ + --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" \ + --archpath "$BUILD_ARCH" buildflags kiwiprofile + ) + if test -n "$KIWI_PROFILE"; then + KIWI_PARAMETERS="$KIWI_PARAMETERS --add-profile $KIWI_PROFILE" + fi + local legacy=false + if is_legacy_kiwi; then + legacy=true fi RUN_BUNDLE="true" for imgtype in $imagetype ; do - echo "running kiwi --prepare for $imgtype..." - # Do not use $BUILD_USER here, since we always need root permissions - chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && rm -rf $TOPDIR/KIWIROOT-$imgtype && kiwi --prepare $TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imgtype $KIWI_PARAMETERS" - root < /dev/null || cleanup_and_exit 1 - echo "running kiwi --create for $imgtype..." - mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype - chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --create $TOPDIR/KIWIROOT-$imgtype --logfile terminal --type $imgtype -d $TOPDIR/KIWI-$imgtype $KIWI_PARAMETERS" - root < /dev/null || cleanup_and_exit 1 - rm -rf "/$TOPDIR/KIWI.bundle" - if chroot $BUILD_ROOT su -c "kiwi --bundle-build $TOPDIR/KIWI-$imgtype -d /$TOPDIR/KIWI.bundle/ --bundle-id Build$RELEASE" - root < /dev/null; then - mv "$BUILD_ROOT/$TOPDIR/KIWI.bundle/"* "$BUILD_ROOT/$TOPDIR/KIWI/" || cleanup_and_exit 1 - rmdir "$BUILD_ROOT/$TOPDIR/KIWI.bundle" + perform_image_build $imagetype $legacy + if perform_image_bundle $imagetype $legacy; then + # bundling successful, skip alternative bundlers unset RUN_BUNDLE fi done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/build-recipe-simpleimage new/obs-build-20160304/build-recipe-simpleimage --- old/obs-build-20151105/build-recipe-simpleimage 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/build-recipe-simpleimage 2016-03-04 17:19:26.000000000 +0100 @@ -32,7 +32,7 @@ [ -x $BUILD_ROOT/bin/bash ] && SHELL="/bin/bash" if [ "`grep '^%build$' $BUILD_ROOT$TOPDIR/SOURCES/simpleimage`" ]; then echo "Running integration script..." - sed -n '/%build/,$ p' $BUILD_ROOT$TOPDIR/SOURCES/simpleimage | tail -n +2 | chroot $BUILD_ROOT $SHELL -x + sed -n '/%build/,$ p' $BUILD_ROOT$TOPDIR/SOURCES/simpleimage | tail -n +2 | chroot $BUILD_ROOT $SHELL -x || cleanup_and_exit 1 echo "Integration script finished." fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/build-recipe-spec new/obs-build-20160304/build-recipe-spec --- old/obs-build-20151105/build-recipe-spec 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/build-recipe-spec 2016-03-04 17:19:26.000000000 +0100 @@ -42,6 +42,9 @@ args=(--release "$RELEASE") fi + rawcfgmacros=.rpmmacros + test "$BUILDTYPE" = debbuild && rawcfgmacros=.debmacros + # fixup specfile CHANGELOGARGS= test -n "$CHANGELOG" -a -f "$BUILD_ROOT/.build-changelog" && CHANGELOGARGS="--changelog $BUILD_ROOT/.build-changelog" @@ -55,8 +58,8 @@ fi # extract macros from configuration - queryconfig rawmacros --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" > $BUILD_ROOT/root/.rpmmacros - if test -n "$BUILD_DEBUG" ; then + queryconfig rawmacros --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" > $BUILD_ROOT/root/$rawcfgmacros + if test -n "$BUILD_DEBUG" && test "$BUILDTYPE" != debbuild ; then echo ' %prep %{?!__debug_package:%{?_build_create_debug:%?_build_insert_debug_package}}%%prep %package %{?!__debug_package:%{?_build_create_debug:%?_build_insert_debug_package}}%%package @@ -65,16 +68,16 @@ %undefine _enable_debug_packages \ %debug_package -' >> $BUILD_ROOT/root/.rpmmacros +' >> $BUILD_ROOT/root/$rawcfgmacros fi if test -n "$BUILD_JOBS" ; then - cat >> $BUILD_ROOT/root/.rpmmacros <<-EOF + cat >> $BUILD_ROOT/root/$rawcfgmacros <<-EOF %jobs $BUILD_JOBS %_smp_mflags -j$BUILD_JOBS EOF fi - test $BUILD_USER = abuild && cp -p $BUILD_ROOT/root/.rpmmacros $BUILD_ROOT/home/abuild/.rpmmacros + test $BUILD_USER = abuild && cp -p $BUILD_ROOT/root/$rawcfgmacros $BUILD_ROOT/home/abuild/$rawcfgmacros # extract optflags from configuration queryconfig --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH" optflags ${BUILD_DEBUG:+debug} > $BUILD_ROOT/root/.rpmrc @@ -206,8 +209,7 @@ mount -n -tproc none $BUILD_ROOT/proc 2> /dev/null chroot $BUILD_ROOT su -s /opt/testing/bin/rpmlint "$BUILD_USER" -- \ --info ${LINT_RPM_FILE_LIST[*]#$BUILD_ROOT} \ - ${SRPM_FILE_LIST[*]#$BUILD_ROOT} > "$BUILD_ROOT$rpmlint_logfile" || ret=1 - cat "$BUILD_ROOT$rpmlint_logfile" + ${SRPM_FILE_LIST[*]#$BUILD_ROOT} > >(tee "$BUILD_ROOT$rpmlint_logfile") 2>&1 || ret=1 echo umount -n $BUILD_ROOT/proc 2>/dev/null || true if test "$ret" = 1 ; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/build-vm new/obs-build-20160304/build-vm --- old/obs-build-20151105/build-vm 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/build-vm 2016-03-04 17:19:26.000000000 +0100 @@ -48,6 +48,8 @@ VM_NETOPT=() VM_NETDEVOPT=() VM_DEVICEOPT=() +VM_TELNET= +VM_CONSOLE_INPUT= VMDISK_ROOTSIZE=4096 VMDISK_SWAPSIZE=1024 VMDISK_FILESYSTEM= @@ -63,7 +65,7 @@ # emulator specific? EMULATOR_SCRIPT= -for i in ec2 emulator kvm lxc openstack qemu uml xen zvm docker ; do +for i in ec2 emulator kvm lxc openstack qemu uml xen zvm docker pvm; do . "$BUILD_DIR/build-vm-$i" done @@ -136,7 +138,7 @@ VM_TYPE="$ARG" case "$VM_TYPE" in lxc|docker) ;; - ec2|xen|kvm|uml|qemu|emulator|openstack|zvm) + ec2|xen|kvm|uml|qemu|emulator|openstack|zvm|pvm) test -z "$VM_IMAGE" && VM_IMAGE=1 ;; none|chroot) VM_TYPE= ;; @@ -230,6 +232,19 @@ -vm-watchdog) VM_WATCHDOG=true ;; + -vm-user) + needarg + VM_USER="$ARG" + shift + ;; + -vm-enable-console) + VM_CONSOLE_INPUT=true + ;; + -vm-telnet) + needarg + VM_TELNET="$ARG" + shift + ;; -vm-net) needarg VM_NETOPT=("${VM_NETOPT[@]}" "$ARG") @@ -291,18 +306,24 @@ local img="$1" local size="$2" - echo "Creating $img (${size}M)" - mkdir -p "${img%/*}" || cleanup_and_exit 3 + if test -e "${img}" ; then + local origsize=$(cat "${img}.size" 2> /dev/null) + if test -z "$origsize" -o "$origsize" != "$size" ; then + echo "Resizing $img (${size}M)" + fi + else + echo "Creating $img (${size}M)" + rm -f "${img}.size" + fi - # prefer fallocate, which avoids fragmentation - r=1 + mkdir -p "${img%/*}" || cleanup_and_exit 3 + # truncate file to the desired size + dd if=/dev/zero of="$img" bs=1M count=0 seek="$size" || cleanup_and_exit 3 + echo "$size" > "${img}.size" + # allocate blocks if type -p fallocate > /dev/null ; then + fallocate -p -l "${size}M" "$img" fallocate -l "${size}M" "$img" - r=$? - fi - # fall back to dd method if fallocate is not supported - if test "$r" -gt 0 ; then - dd if=/dev/zero of="$img" bs=1M count=0 seek="$size" || cleanup_and_exit 3 fi } @@ -571,13 +592,11 @@ rm -rf "$VM_SWAP" fi fi - if test ! -e "$VM_IMAGE" ; then - vm_img_create "$VM_IMAGE" "$VMDISK_ROOTSIZE" - if test -z "$CLEAN_BUILD" ; then - vm_img_mkfs "$VMDISK_FILESYSTEM" "$VM_IMAGE" - fi + test -b "$VM_IMAGE" || vm_img_create "$VM_IMAGE" "$VMDISK_ROOTSIZE" + if test -z "$CLEAN_BUILD" ; then + vm_img_mkfs "$VMDISK_FILESYSTEM" "$VM_IMAGE" fi - if test -n "$VM_SWAP" -a ! -e "$VM_SWAP" -a ! -b "$VM_SWAP" ; then + if test -n "$VM_SWAP" -a ! -b "$VM_SWAP" ; then vm_img_create "$VM_SWAP" "$VMDISK_SWAPSIZE" fi if test ! -e "$VM_IMAGE" ; then @@ -715,6 +734,8 @@ echo "DO_INIT='${DO_INIT//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data echo "DO_INIT_TOPDIR='${DO_INIT_TOPDIR//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data echo "KIWI_PARAMETERS='${KIWI_PARAMETERS//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data + echo "VM_TELNET='${VM_TELNET//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data + echo "VM_CONSOLE_INPUT='${VM_CONSOLE_INPUT//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data test -n "$VM_SWAP" && echo "VM_SWAP='${VM_SWAPDEV//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data test -n "$VMDISK_MOUNT_OPTIONS" && echo "VMDISK_MOUNT_OPTIONS='${VMDISK_MOUNT_OPTIONS//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data PERSONALITY=0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/build-vm-docker new/obs-build-20160304/build-vm-docker --- old/obs-build-20151105/build-vm-docker 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/build-vm-docker 2016-03-04 17:19:26.000000000 +0100 @@ -32,7 +32,7 @@ docker rm "$name" >/dev/null 2>&1 || true docker run \ --rm --name "$name" --cap-add=sys_admin --net=none \ - -v "$BUILD_ROOT:/mnt" busybox /usr/sbin/chroot /mnt "$vm_init_script" + -v "$BUILD_ROOT:/mnt" busybox /bin/chroot /mnt "$vm_init_script" BUILDSTATUS="$?" test "$BUILDSTATUS" != 255 || BUILDSTATUS=3 cleanup_and_exit "$BUILDSTATUS" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/build-vm-kvm new/obs-build-20160304/build-vm-kvm --- old/obs-build-20151105/build-vm-kvm 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/build-vm-kvm 2016-03-04 17:19:26.000000000 +0100 @@ -27,8 +27,16 @@ # assume virtio support by default kvm_device=virtio-blk-pci kvm_serial_device= +kvm_rng_device=virtio-rng-pci kvm_options= +function complain() +{ + local ex=$1; shift + printf "Error: %s\n" "$@" >&2 + cleanup_and_exit $ex +} + kvm_check_ppc970() { if ! grep -q -E '(kvm_rma_count.*kvm_hpt_count)|(kvm_hpt_count.*kvm_rma_count)' /proc/cmdline ; then echo "put kvm_rma_count=<VM number> or kvm_hpt_count=<> to your boot options" @@ -72,18 +80,27 @@ test -e /boot/zImage.guest && vm_kernel=/boot/zImage.guest test -e /boot/initrd.guest && vm_initrd=/boot/initrd.guest kvm_device=virtio-blk-device + kvm_rng_device=virtio-rng-device ;; aarch64) kvm_bin="/usr/bin/qemu-system-aarch64" kvm_console=ttyAMA0 - kvm_options="-enable-kvm -M virt -cpu host" + kvm_options="-enable-kvm -cpu host " + # This option only exists with QEMU 2.5 or newer + if $kvm_bin -machine 'virt,?' 2>&1 | grep -q gic-version ; then + # We want to use the host gic version in order to make use + # of all available features (e.g. more than 8 CPUs) and avoid + # the emulation overhead of vGICv2 on a GICv3 host. + kvm_options+="-M virt,gic-version=host" + else + kvm_options+="-M virt" + fi vm_kernel=/boot/Image vm_initrd=/boot/initrd # prefer the guest kernel/initrd test -e /boot/Image.guest && vm_kernel=/boot/Image.guest test -e /boot/initrd.guest && vm_initrd=/boot/initrd.guest kvm_device=virtio-blk-device - kvm_rng_device=virtio-rng-pci ;; ppc|ppcle|ppc64|ppc64le) kvm_bin="/usr/bin/qemu-system-ppc64" @@ -98,7 +115,6 @@ fi grep -q "pSeries" /proc/cpuinfo && kvm_device=scsi-hd # no virtio on pSeries grep -q "PowerNV" /proc/cpuinfo || kvm_device=scsi-hd # no virtio on ppc != power7 yet - kvm_rng_device=virtio-rng-pci ;; s390|s390x) kvm_bin="/usr/bin/qemu-system-s390x" @@ -192,6 +208,16 @@ vm_startup_kvm() { qemu_bin="$kvm_bin" qemu_args=(-drive file="$VM_IMAGE",format=raw,if=none,id=disk,serial=0,cache=unsafe -device "$kvm_device",drive=disk) + local sudo= + if [ -n "$VM_USER" ] ; then + sudo=/usr/bin/sudo + [ -x $sudo ] || complain 21 "cannot find sudo" + grep -q "^$VM_USER:" /etc/passwd || complain 22 "cannot find KVM user '$VM_USER'" + sudo="$sudo -u $VM_USER" + for f in "$VM_IMAGE" "$VM_SWAP" "$vm_initrd" ; do + [ -n "$f" ] && chown $VM_USER "$f" + done + fi if test -n "$VM_SWAP" ; then qemu_args=("${qemu_args[@]}" -drive file="$VM_SWAP",format=raw,if=none,id=swap,serial=1,cache=unsafe -device "$kvm_device",drive=swap) fi @@ -199,6 +225,8 @@ # which is why we can not use virtio-serial on other platforms if test -n "$kvm_serial_device" ; then qemu_args=("${qemu_args[@]}" -device "$kvm_serial_device" -device virtconsole,chardev=virtiocon0 -chardev stdio,id=virtiocon0) + elif test -n "$VM_CONSOLE_INPUT" ; then + qemu_args=("${qemu_args[@]}" -serial mon:stdio) else qemu_args=("${qemu_args[@]}" -serial stdio) fi @@ -223,7 +251,10 @@ if test -z "$VM_NETOPT" -a -z "$VM_NETDEVOPT"; then kvm_options="$kvm_options -net none" fi - set -- $qemu_bin -nodefaults -no-reboot -nographic -vga none $kvm_options \ + if test -n "$VM_TELNET"; then + kvm_options="$kvm_options -netdev user,id=telnet,hostfwd=tcp:127.0.0.1:$VM_TELNET-:23 -device e1000,netdev=telnet" + fi + set -- $sudo $qemu_bin -nodefaults -no-reboot -nographic -vga none $kvm_options \ -kernel $vm_kernel \ -initrd $vm_initrd \ -append "root=$qemu_rootdev $qemu_rootfstype $qemu_rootflags panic=1 quiet no-kvmclock nmi_watchdog=0 rw rd.driver.pre=binfmt_misc elevator=noop console=$kvm_console init=$vm_init_script" \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/build-vm-lxc new/obs-build-20160304/build-vm-lxc --- old/obs-build-20151105/build-vm-lxc 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/build-vm-lxc 2016-03-04 17:19:26.000000000 +0100 @@ -51,8 +51,16 @@ mount --bind "$BUILD_ROOT" "$LXCROOTFS" EOF chmod a+x "$LXCHOOK" - lxc-create -n "$LXCID" -t none -f "$LXCCONF" || cleanup_and_exit 1 - lxc-start -n "$LXCID" -F "$vm_init_script" + case "$(lxc-create --version)" in + 1.0*) + lxc-create -n "$LXCID" -f "$LXCCONF" || cleanup_and_exit 1 + lxc-start -n "$LXCID" "$vm_init_script" + ;; + *) + lxc-create -n "$LXCID" -f "$LXCCONF" -t none || cleanup_and_exit 1 + lxc-start -n "$LXCID" -F "$vm_init_script" + ;; + esac BUILDSTATUS="$?" test "$BUILDSTATUS" != 255 || BUILDSTATUS=3 cleanup_and_exit "$BUILDSTATUS" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/build-vm-pvm new/obs-build-20160304/build-vm-pvm --- old/obs-build-20151105/build-vm-pvm 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20160304/build-vm-pvm 2016-03-04 17:19:26.000000000 +0100 @@ -0,0 +1,179 @@ +#PowerVM build functions +test -z "$VM_WORKER_NR" && VM_WORKER_NR=1 +lpname="worker-$VM_WORKER_NR" +lpartype="AIX/Linux" +bootloader_size="8M" +rootlv="$lpname"-root +swaplv="$lpname"-swap +master_lpar=$(cat /proc/device-tree/ibm,partition-name) + +size_gb(){ + size_gb=`expr $1 / 1024` +} + +setup_bootloader(){ + disk=$1 + parted -s $disk mklabel msdos + parted -s $disk mkpart primary ext2 0 $bootloader_size + parted -s $disk set 1 boot on + parted -s $disk set 1 prep on + parted -s $disk mkpart primary ext3 8M 100% + bl_target=${disk}1 +} + +getdiskname(){ + lv=$1 + if [ -z "$SKIP" ];then + args=$(pvmctl scsi list -f ' ' -d VirtualDisk.udid ClientAdapter.loc_code --where VirtualDisk.name=$lv) + eval $args + host=$(ls-vscsi | grep $loc_code| awk -F " " '{print $1}') + echo "- - -" > /sys/class/scsi_host/$host/scan + udid=$(echo $udid | cut -c 3-) + devid="/dev/disk/by-id/scsi-SAIX_VDASD_$udid" + until test -L $devid;do + sleep 1; + done + dev=$(readlink -f $devid) + fi + case $lv in + *root) test -z "$SKIP" && setup_bootloader "$dev"; + VM_IMAGE="${dev}2";; + *swap) VM_SWAP="${dev}";; + esac +} +createdev() { + name=$1 + size=$2 + target=$3 + size_gb $size + test -z $3 && target=$master_lpar + is_created $name + if [ -z "$SKIP" ];then + execute lv create --name $name --size $size_gb + target=$master_lpar + fi + execute scsi create --vg name=rootvg --type lv --lpar name=$target --stor-id $name + test -z "$SKIP" && getdiskname $name +} +execute(){ + cmd=$@ + pvmctl $cmd +} + +vm_kill_pvm() { + execute lpar power-off --hard -i name="$VM_NAME" +} +is_created() { + dev=$1 + $(pvmctl lv list -d LogicalVolume.name | grep -q $dev) && SKIP=1 +} +vm_attach_root_pvm(){ + target=$1 + createdev $rootlv $VMDISK_ROOTSIZE $target +} + +vm_attach_swap_pvm(){ + createdev $swaplv $VMDISK_SWAPSIZE $target +} +lpar_is_running(){ + state=$(pvmctl lpar list -d LogicalPartition.state --where LogicalPartition.name=$lpname |awk -F "=" '{print $2}') + CONSOLEPID=`pgrep -f "cat $hvcdev"` + if [ "$state" = "running" ];then + return 0 + else + test -n $CONSOLEPID && kill -TERM $CONSOLEPID + return 1 + fi +} +watch_build(){ + while lpar_is_running $lpname;do + sleep 10 + done +} +vm_startup_pvm(){ + cpus=$BUILD_JOBS + cores=`echo 0.05 \* $cpus| bc -l` + execute lpar create --name $lpname --mem $VM_MEMSIZE --proc-unit $cores --proc $cpus --proc-type shared --sharing-mode uncapped --type $lpartype + nametoid $lpname + vm_attach_root_pvm $lpname + vm_attach_swap_pvm $lpname + openconsole $lparid + execute lpar power-on -i name=$lpname + watch_build & + PID=$! + cat $hvcdev + vm_detach_root_pvm $lpname + vm_detach_swap_pvm $lpname +} +vm_verify_options_pvm(){ + : +} +detachdev(){ + lv=$1 + lpar=$2 + execute scsi delete --lpar name=$lpar --type lv --stor-id $lv +} + +vm_detach_swap_pvm(){ + lpar=$1 + test -z $lpar && lpar=$master_lpar + detachdev $swaplv $lpar +} +vm_detach_root_pvm(){ + lpar=$1 + test -z $lpar && lpar=$master_lpar + detachdev $rootlv $lpar +} +deletelv(){ + viosvrcmd --id 1 -c "rmbdsp -bd $1" +} +openconsole(){ + id=$1 + pvmutil -o create_vterm_dev --id $id + hvcsadmin -console $id + hvcdev=$(hvcsadmin -console $id|awk '{print $4}') +} + +nametoid(){ + local id + name=$1 + lparid=$(pvmctl lpar list -d LogicalPartition.id -i name=$name | awk -F "=" '{print $2}') +} +closeconsole(){ + hvcdev=$(hvcsadmin -console $id|awk '{print $4}') + hvcsadmin -close $hvcdev + pvmutil -o delete_vterm_dev --id $1 +} + +vm_cleanup_pvm(){ + nametoid $lpname + closeconsole $lparid + vm_detach_root_pvm $lpname + vm_detach_root_pvm + vm_detach_swap_pvm $lpname + vm_detach_swap_pvm + execute lpar delete -i name=$lpname + deletelv $rootlv + deletelv $swaplv +} +vm_fixup_pvm(){ + VM_SWAPDEV=/dev/sdb + GRUBDIR=`mktemp -d /tmp/grubinstall.XXXX` + modules="ext2 part_msdos linux disk elf" + grubcfg="$GRUBDIR/grub.cfg" + grubimg="$GRUBDIR/grub.img" + cat <<'EOF' >> $GRUBDIR/grub.cfg +insmod ext2 +insmod part_msdos +insmod linux +insmod disk +insmod elf +set root='ieee1275//vdevice/v-scsi@30000002/disk@8100000000000000,msdos2' +linux /.build.kernel.kvm init=/.build/build console=hvc0 root=/dev/sda2 rw elevator=noop +initrd /.build.initrd.kvm +boot +EOF + grub2-mkimage -O powerpc-ieee1275 -o $grubimg -c $grubcfg $modules + dd if=$grubimg of=$bl_target + rm -rf $GRUBDIR +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/configs/debian.conf new/obs-build-20160304/configs/debian.conf --- old/obs-build-20151105/configs/debian.conf 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/configs/debian.conf 2016-03-04 17:19:26.000000000 +0100 @@ -5,7 +5,7 @@ Preinstall: libreadline4 tar gawk dpkg Preinstall: sysv-rc gzip base-files -Runscripts: base-files +Runscripts: base-files initscripts VMinstall: util-linux binutils libblkid1 libuuid1 libdevmapper1.02 mount diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/expanddeps new/obs-build-20160304/expanddeps --- old/obs-build-20151105/expanddeps 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/expanddeps 2016-03-04 17:19:26.000000000 +0100 @@ -28,7 +28,7 @@ use Build; -my ($dist, $rpmdeps, $archs, $configdir, $useusedforbuild, $installonly, $noinstall); +my ($dist, $rpmdeps, $archs, $configdir, $useusedforbuild, $installonly, $noinstall, $isvm); $configdir = ($::ENV{'BUILD_DIR'} || '/usr/lib/build') . '/configs'; @@ -76,6 +76,11 @@ Build::define("_without_$def --without-$def"); next; } + if ($ARGV[0] eq '--vm') { + shift @ARGV; + $isvm = 1; + next; + } last; } @@ -386,7 +391,7 @@ } # make sure all preinstalls are in bdeps; -# XXX: also add vmdeps? @bdeps = Build::unify(@bdeps, Build::get_preinstalls($cf)); +@bdeps = Build::unify(@bdeps, Build::get_vminstalls($cf)) if $isvm; print_rpmlist(@bdeps); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/init_buildsystem new/obs-build-20160304/init_buildsystem --- old/obs-build-20151105/init_buildsystem 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/init_buildsystem 2016-03-04 17:19:26.000000000 +0100 @@ -517,7 +517,9 @@ # RPMLIST=$BUILD_ROOT/.init_b_cache/rpmlist test -z "$LIST_STATE" && echo "expanding package dependencies..." - if ! $BUILD_DIR/expanddeps $USEUSEDFORBUILD "${definesnstuff[@]}" --dist "$BUILD_DIST" --depfile "$CACHE_FILE" --archpath "$BUILD_ARCH" --configdir $CONFIG_DIR "${PKGS[@]}" > $RPMLIST ; then + VMOPT= + test -z "$PREPARE_VM" || VMOPT=--vm + if ! $BUILD_DIR/expanddeps $USEUSEDFORBUILD $VMOPT "${definesnstuff[@]}" --dist "$BUILD_DIST" --depfile "$CACHE_FILE" --archpath "$BUILD_ARCH" --configdir $CONFIG_DIR "${PKGS[@]}" > $RPMLIST ; then rm -f $BUILD_IS_RUNNING cleanup_and_exit 1 fi @@ -902,7 +904,7 @@ read PKGID < $BUILD_ROOT/.init_b_cache/rpms/$PKG.id read OLDPKGID < $BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG if test "$PKGID" = "$OLDPKGID" ; then - #echo "keeping ${PKGID%% *}" + echo "keeping ${PKGID%% *}" rm -f $BUILD_ROOT/.init_b_cache/$PKG.$PSUF echo "$PKGID" > $BUILD_ROOT/installed-pkg/$PKG test -n "$PKG_HDRMD5" && echo "$PKG_HDRMD5 $PKGID" > $BUILD_ROOT/.preinstall_image/$PKG @@ -919,7 +921,7 @@ pkg_erase else if test "$VERIFY_BUILD_SYSTEM" != true || pkg_verify_installed ; then - #echo "keeping ${PKGID%% *}" + echo "keeping ${PKGID%% *}" echo "$PKGID" > $BUILD_ROOT/installed-pkg/$PKG test -n "$PKG_HDRMD5" && echo "$PKG_HDRMD5 $PKGID" > $BUILD_ROOT/.preinstall_image/$PKG continue @@ -1052,7 +1054,6 @@ pkg_initdb_rpm chroot $BUILD_ROOT rpm -q --whatprovides rpm >/dev/null 2>&1 # create provides index fi - rm -f $BUILD_ROOT/.rpmmacros $BUILD_ROOT/root/.rpmmacros rm -rf "$BUILD_ROOT/.init_b_cache" rm -f $BUILD_IS_RUNNING diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/mkbaselibs new/obs-build-20160304/mkbaselibs --- old/obs-build-20151105/mkbaselibs 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/mkbaselibs 2016-03-04 17:19:26.000000000 +0100 @@ -1117,6 +1117,11 @@ warn ("$rpm does not exist, skipping\n"); next; } + my @rpmfiles = `rpm -qp --queryformat "[%{FILENAMES}\n]" $rpm`; + if (!@rpmfiles) { + warn ("$rpm is empty, skipping\n"); + next; + } next if $rpm =~ /\.(no)?src\.rpm$/; # ignore source rpms next if $rpm =~ /\.spm$/; $rpmn =~ s/.*\///; # Remove leading path info @@ -1136,6 +1141,11 @@ for my $deb (@pkgs) { my $debn = $deb; next unless $debn =~ /\.deb$/; + my @debfiles = `dpkg --contents $deb`; + if (!@debfiles) { + warn ("$deb is empty, skipping\n"); + next; + } $debn =~ s/.*\///; # Remove leading path info $debn =~ s/_[^_]+_[^_]+\.deb$//; # remove all version info and extension push @debs, $deb if $debs_to_process{$debn}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/mkdrpms new/obs-build-20160304/mkdrpms --- old/obs-build-20151105/mkdrpms 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/mkdrpms 2016-03-04 17:19:26.000000000 +0100 @@ -96,7 +96,10 @@ for my $file (lsrpms($dir)) { my $q = query($file); next unless $q; + next if $q->{'arch'} eq 'src' || $q->{'arch'} eq 'nosrc'; + next if $q->{'name'} =~ /-debug(:?info|source)/; # no debug deltas my $n = $q->{'name'}.'.'.$q->{'arch'}; + for my $oq (@{$oldpkgs{$n} || []}) { my $v = $oq->{'version'}; my $r = $oq->{'release'}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/spec_add_patch new/obs-build-20160304/spec_add_patch --- old/obs-build-20151105/spec_add_patch 2015-11-05 15:59:47.000000000 +0100 +++ new/obs-build-20160304/spec_add_patch 2016-03-04 17:19:26.000000000 +0100 @@ -64,6 +64,7 @@ my $in_global = 1; my $last_patch_in_prep_index = 0; my $last_patch_in_global_index = 0; +my $last_source_in_global_index = 0; my @c = (); my $index = 0; @@ -109,7 +110,7 @@ } if ($in_global && $ifdef_level == 0 && /^Source(?:\d+)?:/) { - $last_patch_in_global_index = $index; + $last_source_in_global_index = $index; } if ($in_prep && $ifdef_level == 0 && /^\%patch/) { @@ -120,6 +121,11 @@ } close(S); +# append after last Source if this spec doesn't have any Patches +if ($last_patch_in_global_index == 0) { + $last_patch_in_global_index = $last_source_in_global_index; +} + die if ($ifdef_level > 0); die if ($in_global || $in_prep); die if ($last_patch_in_prep_index == 0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20151105/telnet_login_wrapper new/obs-build-20160304/telnet_login_wrapper --- old/obs-build-20151105/telnet_login_wrapper 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20160304/telnet_login_wrapper 2016-03-04 17:19:26.000000000 +0100 @@ -0,0 +1,8 @@ +#!/bin/sh + +# login wrapper, just start a shell without arguments. +# this skips all parameters and is the only way to open a shell without login +# prompt on most telnetd implementations + +/bin/bash --login || sh +
