Imported vendor release 2013.11.12-3.1
authorZhang Qiang <qiang.z.zhang@intel.com>
Thu, 3 Apr 2014 07:53:09 +0000 (15:53 +0800)
committerZhang Qiang <qiang.z.zhang@intel.com>
Thu, 3 Apr 2014 07:53:09 +0000 (15:53 +0800)
12 files changed:
packaging/0001-Update-uid-gid-of-build-root-if-uid-gid-is-not-match.patch [new file with mode: 0644]
packaging/0002-Add-option-keep-packs-to-keep-packages-already-in-bu.patch [new file with mode: 0644]
packaging/0003-support-incremental-build.patch [new file with mode: 0644]
packaging/0004-hide-password-if-user-pass-needed-for-packages-repos.patch [new file with mode: 0644]
packaging/0005-add-back-use-system-qemu.patch [new file with mode: 0644]
packaging/0006-use-qemu-arm-static-binary.patch [new file with mode: 0644]
packaging/0007-fix-initvm-binary-search-issue.patch [new file with mode: 0644]
packaging/0008-Support-ExportFilter.patch [new file with mode: 0644]
packaging/0009-always-register-qemu-handler.patch [new file with mode: 0644]
packaging/0010-download-packages-to-different-dirs-for-each-build-i.patch [new file with mode: 0644]
packaging/0011-clean-up-old-registered-binfmt-handlers-before-use-i.patch [new file with mode: 0644]
packaging/build.spec [new file with mode: 0644]

diff --git a/packaging/0001-Update-uid-gid-of-build-root-if-uid-gid-is-not-match.patch b/packaging/0001-Update-uid-gid-of-build-root-if-uid-gid-is-not-match.patch
new file mode 100644 (file)
index 0000000..451082d
--- /dev/null
@@ -0,0 +1,39 @@
+From bc058235dfd983d775e2d777d3be3539cbf78578 Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Tue, 22 Jan 2013 15:49:36 -0500
+Subject: [PATCH 1/5] Update uid/gid of build root if uid/gid is not match
+
+This is very useful for sharing build root to other developers,
+and create a full build root for using by all developer.
+
+Change-Id: I1edd3830a499cff7ab357d17484075e46bd8319b
+---
+ build |   12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/build b/build
+index aa7a217..82b435f 100755
+--- a/build
++++ b/build
+@@ -2718,13 +2718,11 @@ for SPECFILE in "${SPECFILES[@]}" ; do
+           chown "$ABUILD_UID:$ABUILD_GID" $BUILD_ROOT/home/abuild
+       else
+           if ! egrep "^abuild:x?:${ABUILD_UID}:${ABUILD_GID}" >/dev/null <$BUILD_ROOT/etc/passwd ; then
+-              echo "abuild user present in the buildroot ($BUILD_ROOT) but uid:gid does not match"
+-              echo "buildroot currently using:"
+-              egrep "^abuild:" <$BUILD_ROOT/etc/passwd
+-              echo "build script attempting to use:"
+-              echo "abuild::${ABUILD_UID}:${ABUILD_GID}:..."
+-              echo "build aborting"
+-              cleanup_and_exit 1
++                sed -i '/^abuild:/d' $BUILD_ROOT/etc/passwd
++                sed -i '/^abuild:/d' $BUILD_ROOT/etc/group
++                echo "abuild:x:${ABUILD_UID}:${ABUILD_GID}:Autobuild:/home/abuild:/bin/bash" >>$BUILD_ROOT/etc/passwd
++                echo "abuild:x:${ABUILD_GID}:" >>$BUILD_ROOT/etc/group
++                chown "$ABUILD_UID:$ABUILD_GID" $BUILD_ROOT/home/abuild -R
+           fi
+       fi
+       if test -f $BUILD_ROOT/etc/shadow ; then
+-- 
+1.7.9.5
+
diff --git a/packaging/0002-Add-option-keep-packs-to-keep-packages-already-in-bu.patch b/packaging/0002-Add-option-keep-packs-to-keep-packages-already-in-bu.patch
new file mode 100644 (file)
index 0000000..a062696
--- /dev/null
@@ -0,0 +1,127 @@
+From 438ab37dad1998fa85b134e74459d30dc23edfbb Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Fri, 22 Nov 2013 10:25:06 +0800
+Subject: [PATCH 2/5] Add option --keep-packs to keep packages already in
+ build root
+
+with --keep-packs, unused packages will not be removed while resusing
+buildroot. This can speed up build hundred of packages significantly.
+
+This option also usefull to create a single buildroot to share with other
+developers to build all packages.
+
+Change-Id: Ibcb68e49b8eed0bdf695485c2ec79a8eb4efb824
+---
+ build            |    8 ++++++--
+ init_buildsystem |   41 ++++++++++++++++++++++++-----------------
+ 2 files changed, 30 insertions(+), 19 deletions(-)
+
+diff --git a/build b/build
+index 82b435f..5643628 100755
+--- a/build
++++ b/build
+@@ -77,6 +77,7 @@ DO_LINT=
+ DO_CHECKS=true
+ CLEAN_BUILD=
+ USE_SYSTEM_QEMU=
++KEEP_PACKS=
+ SPECFILES=()
+ SRCDIR=
+ BUILD_JOBS=
+@@ -1188,6 +1189,9 @@ while test -n "$1"; do
+       *-use-system-qemu)
+       USE_SYSTEM_QEMU="--use-system-qemu"
+       ;;
++      --keep-packs)
++      KEEP_PACKS="--keep-packs"
++      ;;
+       *-root)
+       needarg
+       BUILD_ROOT="$ARG"
+@@ -2073,7 +2077,7 @@ for SPECFILE in "${SPECFILES[@]}" ; do
+       if test "$DO_INIT" = true ; then
+           # do first stage of init_buildsystem
+           rm -f $BUILD_ROOT/.build.success
+-          set -- init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" --prepare "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $USE_SYSTEM_QEMU $USEUSEDFORBUILD $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS
++          set -- init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" --prepare "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $USE_SYSTEM_QEMU $KEEP_PACKS $USEUSEDFORBUILD $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS
+           echo "$* ..."
+             start_time=`date +%s`
+           "$@" || cleanup_and_exit 1
+@@ -2598,7 +2602,7 @@ for SPECFILE in "${SPECFILES[@]}" ; do
+       CREATE_BUILD_BINARIES=
+       test "$BUILDTYPE" = preinstallimage && mkdir -p $BUILD_ROOT/.preinstall_image
+       egrep '^#[       ]*needsbinariesforbuild[       ]*$' >/dev/null <$MYSRCDIR/$SPECFILE && CREATE_BUILD_BINARIES=--create-build-binaries
+-      set -- init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $USE_SYSTEM_QEMU $USEUSEDFORBUILD $CREATE_BUILD_BINARIES $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS
++      set -- init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $USE_SYSTEM_QEMU $KEEP_PACKS $USEUSEDFORBUILD $CREATE_BUILD_BINARIES $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS
+       echo "$* ..."
+         start_time=`date +%s`
+       "$@" || cleanup_and_exit 1
+diff --git a/init_buildsystem b/init_buildsystem
+index ff0bddd..c7dc95a 100755
+--- a/init_buildsystem
++++ b/init_buildsystem
+@@ -35,6 +35,7 @@ RPMIDFMT="%{NAME}-%{VERSION}-%{RELEASE} %{BUILDTIME}\n"
+ PREPARE_VM=
+ USE_SYSTEM_QEMU=
++KEEP_PACKS=
+ USEUSEDFORBUILD=
+ LIST_STATE=
+ RPMLIST=
+@@ -51,6 +52,10 @@ while test -n "$1" ; do
+           shift
+           USE_SYSTEM_QEMU=true
+           ;;
++      --keep-packs)
++          shift
++          KEEP_PACKS=true
++          ;;
+       --create-build-binaries)
+           shift
+           CREATE_BUILD_BINARIES=true
+@@ -906,23 +911,25 @@ rpm_e()
+ #
+ # delete all packages we don't want
+ #
+-mkdir -p $BUILD_ROOT/.init_b_cache/todelete
+-for PKG in $BUILD_ROOT/.init_b_cache/alreadyinstalled/* ; do
+-    PKG=${PKG##*/}
+-    test "$PKG" = "*" && continue
+-    ln $BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG $BUILD_ROOT/.init_b_cache/todelete/$PKG
+-done
+-for PKG in $PACKAGES_TO_INSTALL; do
+-    rm -f $BUILD_ROOT/.init_b_cache/todelete/$PKG
+-done
+-for PKG in $BUILD_ROOT/.init_b_cache/todelete/* ; do
+-    PKG=${PKG##*/}
+-    test "$PKG" = "*" && continue
+-    echo "deleting $PKG"
+-    rpm_e "$PKG"
+-    check_exit
+-done
+-rm -rf "$BUILD_ROOT/.init_b_cache/todelete"
++if [ -z "$KEEP_PACKS" ]; then
++    mkdir -p $BUILD_ROOT/.init_b_cache/todelete
++    for PKG in $BUILD_ROOT/.init_b_cache/alreadyinstalled/* ; do
++        PKG=${PKG##*/}
++        test "$PKG" = "*" && continue
++        ln $BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG $BUILD_ROOT/.init_b_cache/todelete/$PKG
++    done
++    for PKG in $PACKAGES_TO_INSTALL; do
++        rm -f $BUILD_ROOT/.init_b_cache/todelete/$PKG
++    done
++    for PKG in $BUILD_ROOT/.init_b_cache/todelete/* ; do
++        PKG=${PKG##*/}
++        test "$PKG" = "*" && continue
++        echo "deleting $PKG"
++        rpm_e "$PKG"
++        check_exit
++    done
++    rm -rf "$BUILD_ROOT/.init_b_cache/todelete"
++fi
+ rm -rf "$BUILD_ROOT/.init_b_cache/preinstalls"
+ mkdir -p "$BUILD_ROOT/.init_b_cache/preinstalls"
+-- 
+1.7.9.5
+
diff --git a/packaging/0003-support-incremental-build.patch b/packaging/0003-support-incremental-build.patch
new file mode 100644 (file)
index 0000000..58ca9dd
--- /dev/null
@@ -0,0 +1,160 @@
+From 71b766c043802bc8c02441e22b89e0f624ed02c7 Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Tue, 19 Mar 2013 20:24:45 -0400
+Subject: [PATCH 3/5] support incremental build
+
+Incremental build is very important for developer, especially for developing
+big project, such as webkit, kernel, ect.
+
+This patch add three options to support incremental build:
+--no-build: create build root using spec file, and don't execute
+            build stage
+--short-circuit: incremental build option, this need work with --stage
+            option.
+--no-topdir-cleanup: don't remove rpmbuild build topdir, this need
+            to be specified for incremental build
+
+Basic usage:
+1) $ build test.spec --no-build
+2) $ mount source code to buildroot/abuild/rpmbuild/BUILD/$name-$verson
+3) build packages
+ a) just compile
+ $ build test.spec --no-init --short-circuit --no-topdir-cleanup --stage=bc
+ b) generate RPM packags
+ $ build test.spec --no-init --short-circuit --no-topdir-cleanup --stage=bs
+4) $ umount buildroot/abuild/rpmbuild/BUILD/$name-$verson
+
+Change-Id: I7e1f7029c49e85fdb3f5a260631c10d052164d17
+---
+ build |   64 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
+ 1 file changed, 53 insertions(+), 11 deletions(-)
+
+diff --git a/build b/build
+index 5643628..30c56e9 100755
+--- a/build
++++ b/build
+@@ -73,8 +73,11 @@ ABUILD_UID=399
+ ABUILD_GID=399
+ DO_INIT=true
++DO_BUILD=true
+ DO_LINT=
+ DO_CHECKS=true
++SHORT_CIRCUIT=false
++NO_TOPDIR_CLEANUP=false
+ CLEAN_BUILD=
+ USE_SYSTEM_QEMU=
+ KEEP_PACKS=
+@@ -1131,6 +1134,9 @@ while test -n "$1"; do
+       *-no*init)
+       DO_INIT=false
+       ;;
++      *-no-build)
++      DO_BUILD=false
++      ;;
+       *-no*checks)
+       DO_CHECKS=false
+       ;;
+@@ -1362,6 +1368,12 @@ while test -n "$1"; do
+       BUILD_RPM_BUILD_STAGE="$ARG"
+       shift
+       ;;
++      *-short-circuit)
++        SHORT_CIRCUIT=true
++      ;;
++      *-no-topdir-cleanup)
++        NO_TOPDIR_CLEANUP=true
++      ;;
+       *-useusedforbuild)
+       USEUSEDFORBUILD="--useusedforbuild"
+       ;;
+@@ -1468,6 +1480,11 @@ done
+ check_for_ppc
+ check_for_arm
++if [ "$SHORT_CIRCUIT" = true -a -z "$BUILD_RPM_BUILD_STAGE" ]; then
++    echo "--short-circuit needs a stage (use --stage)"
++    cleanup_and_exit 1
++fi
++
+ if test "$VM_TYPE" = "lxc"; then
+     VM_IMAGE=''
+     VM_SWAP=''
+@@ -2678,6 +2695,9 @@ for SPECFILE in "${SPECFILES[@]}" ; do
+       mv $BUILD_ROOT/usr/lib/rpm/rpmrc $BUILD_ROOT/usr/lib/rpm/rpmrc_i586
+       sed -e 's/^buildarchtranslate: athlon.*/buildarchtranslate: athlon: i686/' -e 's/^buildarchtranslate: i686.*/buildarchtranslate: i686: i686/' < $BUILD_ROOT/usr/lib/rpm/rpmrc_i586 > $BUILD_ROOT/usr/lib/rpm/rpmrc
+     fi
++    if test "$DO_BUILD" = false ; then
++        cleanup_and_exit 0
++    fi
+     #
+     # install dummy sign program if needed
+@@ -2788,11 +2808,13 @@ for SPECFILE in "${SPECFILES[@]}" ; do
+     #
+     # now clean up RPM building directories
+-    #
+-    rm -rf "$BUILD_ROOT$TOPDIR"
+-    for i in BUILD RPMS/`uname -m` RPMS/i386 RPMS/noarch SOURCES SPECS SRPMS BUILDROOT OTHER ; do
+-      mkdir -p $BUILD_ROOT$TOPDIR/$i
+-    done
++    if [ "$NO_TOPDIR_CLEANUP" = false ]; then
++        rm -rf "$BUILD_ROOT$TOPDIR"
++        for i in BUILD RPMS/`uname -m` RPMS/i386 RPMS/noarch SOURCES SPECS SRPMS BUILDROOT OTHER ; do
++            mkdir -p $BUILD_ROOT$TOPDIR/$i
++        done
++    fi
++
+     chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT$TOPDIR"
+     check_exit
+@@ -2968,7 +2990,7 @@ for SPECFILE in "${SPECFILES[@]}" ; do
+       test -x $BUILD_ROOT/usr/bin/rpmbuild || rpmbuild=rpm
+       # XXX: move _srcdefattr to macro file?
+-      rpmbopts=("$BUILD_RPM_BUILD_STAGE" "--define" "_srcdefattr (-,root,root)")
++      rpmbopts=("--define" "_srcdefattr (-,root,root)")
+       if test "$rpmbuild" == "rpmbuild" ; then
+                 # use only --nosignature for rpm v4
+           rpmbopts[${#rpmbopts[@]}]="--nosignature"
+@@ -2991,11 +3013,31 @@ for SPECFILE in "${SPECFILES[@]}" ; do
+       # su involves a shell which would require even more
+       # complicated quoting to bypass than this
+-      toshellscript $rpmbuild \
+-              "${definesnstuff[@]}" \
+-              "${rpmbopts[@]}" \
+-              "$TOPDIR/SOURCES/$SPECFILE" \
+-              > $BUILD_ROOT/.build.command
++        if test "$SHORT_CIRCUIT" = false ; then
++            rpmbopts[${#rpmbopts[@]}]="$BUILD_RPM_BUILD_STAGE"
++            toshellscript $rpmbuild \
++                    "${definesnstuff[@]}" \
++                    "${rpmbopts[@]}" \
++                    "$TOPDIR/SOURCES/$SPECFILE" \
++                    > $BUILD_ROOT/.build.command
++        else
++            rpmbopts[${#rpmbopts[@]}]='--short-circuit'
++            buildopts="-bc -bi -bb -bs"
++            cmds=""
++            echo "#!/bin/sh -x" >$BUILD_ROOT/.build.command
++            echo "set -e" >>$BUILD_ROOT/.build.command
++            for opt in $buildopts
++            do
++                shellquote $rpmbuild  \
++                        "${definesnstuff[@]}" \
++                        "${rpmbopts[@]}" $opt \
++                        "$TOPDIR/SOURCES/$SPECFILE" \
++                        >> $BUILD_ROOT/.build.command
++                echo >>$BUILD_ROOT/.build.command
++                [ "$opt" == "$BUILD_RPM_BUILD_STAGE" ] && break
++            done
++        fi
++
+       chmod 755 $BUILD_ROOT/.build.command
+       check_exit
+       if test -n "$shell"; then
+-- 
+1.7.9.5
+
diff --git a/packaging/0004-hide-password-if-user-pass-needed-for-packages-repos.patch b/packaging/0004-hide-password-if-user-pass-needed-for-packages-repos.patch
new file mode 100644 (file)
index 0000000..351ec50
--- /dev/null
@@ -0,0 +1,130 @@
+From 2fc900cdafe1ef02aabf747ee5a42f13aada4e8e Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Tue, 19 Mar 2013 20:29:39 -0400
+Subject: [PATCH 4/5] hide password if user/pass needed for packages repos
+
+.repo.config is generated generated for passwd retrieving, and
+.repo.config is saved to $BUILD_ROOT/ and remove it in build
+cleanup stage.
+
+fix #459, #390.
+
+Change-Id: I2a5b3e23d504346414ee4b4dbb36ee0bbcb2e67a
+---
+ build    |   20 ++++++++++++++++++++
+ download |   33 ++++++++++++++++++++++++++++++---
+ 2 files changed, 50 insertions(+), 3 deletions(-)
+
+diff --git a/build b/build
+index 30c56e9..bc64a85 100755
+--- a/build
++++ b/build
+@@ -377,6 +377,7 @@ usage () {
+ cleanup_and_exit () {
+     trap EXIT
+     test -z "$1" && set 0
++    rm -f $BUILD_ROOT/.repo.config
+     rm -f $BUILD_ROOT/exit
+     if test "$1" -eq 1 -a -x /bin/df ; then
+         # okay, it failed, but maybe because disk space?
+@@ -1034,6 +1035,24 @@ check_for_arm()
+     export VM_INITRD
+ }
++hide_passwords()
++{
++    local i j
++    r=()
++    rm -f $BUILD_ROOT/.repo.config
++    for i in "${repos[@]}"; do
++        if [ "$i" == "--repo" -o "$i" == "--repository" ]; then
++            r=("${r[@]}" "$i")
++        else
++            echo $i |grep -E "^http[s]?:\/\/[^\/]*\/?" >/dev/null && echo $i >> $BUILD_ROOT/.repo.config
++            j=$(echo $i | sed -e "s#://[^@]*@#://#")
++            r=("${r[@]}" "$j")
++        fi
++    done
++    repos=("${r[@]}")
++    echo ${repos[@]}
++}
++
+ check_for_ppc()
+ {
+     local uname
+@@ -1941,6 +1960,7 @@ if test -z "$RUNNING_IN_VM" ; then
+ fi
+ mkdir_build_root
++hide_passwords
+ if [ "$BUILD_ROOT" = / ]; then
+     browner="$(stat -c %u /)"
+diff --git a/download b/download
+index 9ac2bdf..4314617 100755
+--- a/download
++++ b/download
+@@ -13,6 +13,12 @@ use File::Basename;
+ use strict;
++sub hide_passwd {
++    my $url = shift;
++    $url =~ s|://[^@]*@|://|;
++    return $url
++}
++
+ die "USAGE: $0 DIR URLS..." unless $#ARGV >= 1;
+ my $dir = shift @ARGV;
+@@ -22,6 +28,7 @@ my $ua = LWP::UserAgent->new(
+   timeout => 42);
+ for my $url (@ARGV) {
++  my $original = $url;
+   if ($url =~ /^zypp:\/\/([^\/]*)\/?/) {
+     use Build::Zypp;
+     my $repo = Build::Zypp::parsecfg($1);
+@@ -38,7 +45,27 @@ for my $url (@ARGV) {
+       last;
+     }
+   } else {
+-    $url = URI->new($url);
++    my $found = 0;
++    if ( defined $ENV{BUILD_ROOT} && -e $ENV{BUILD_ROOT} . "/.repo.config" ) {
++        open FILE, "<", $ENV{BUILD_ROOT} . "/.repo.config" or die $!;
++        while (<FILE>) {
++            next if ($_ !~ /^http[s]?:\/\/([^\/]*)\/?/);
++            chomp($_);
++            my $hidden = URI->new($_);
++            my $ui = $hidden->userinfo;
++            $hidden->userinfo(undef);
++            if ( $url =~ m/^$hidden/ ) {
++                $url = URI->new($url);
++                $url->userinfo($ui);
++                $found = 1;
++                last;
++            }
++        }
++        close FILE;
++    }
++    if ($found == 0 ) {
++        $url = URI->new($url);
++    }
+   }
+   $ua->env_proxy  if $url->scheme ne 'https';
+   my $dest = "$dir/".basename($url->path);
+@@ -48,8 +75,8 @@ for my $url (@ARGV) {
+     my $res = $ua->mirror($url, $dest);
+     last if $res->is_success;
+     # if it's a redirect we probably got a bad mirror and should just retry
+-    die "requesting $url failed: ".$res->status_line."\n" unless $retry && $res->previous;
+-    warn "retrying $url\n";
++    die "reqesting " . hide_passwd($original) . " failed: ".$res->status_line."\n" unless $retry && $res->previous;
++    warn "retrying " . hide_passwd($original) . "\n";
+   }
+ }
+-- 
+1.7.9.5
+
diff --git a/packaging/0005-add-back-use-system-qemu.patch b/packaging/0005-add-back-use-system-qemu.patch
new file mode 100644 (file)
index 0000000..71a9777
--- /dev/null
@@ -0,0 +1,111 @@
+From 0113a5e1e052cb13c6ae0a53fe528caf3f858945 Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Fri, 22 Nov 2013 15:16:37 +0800
+Subject: [PATCH 5/5] add back --use-system-qemu
+
+Change-Id: Ia0b11954327407f576154552a96c406bd9e666ff
+---
+ init_buildsystem |   80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 80 insertions(+)
+
+diff --git a/init_buildsystem b/init_buildsystem
+index c7dc95a..750797d 100755
+--- a/init_buildsystem
++++ b/init_buildsystem
+@@ -430,6 +430,85 @@ validate_cache_file()
+     fi
+ }
++check_copy_qemu()
++{
++    local arch
++
++    for arch in $EMULATOR_DEVS; do
++      if test -e $BUILD_DIR/qemu-$arch; then
++          return 0
++      fi
++    done
++    return 1
++}
++
++copy_qemu()
++{
++    local path dest
++
++    echo "copying qemu"
++
++    mkdir -p $BUILD_ROOT/usr/bin
++
++    if check_copy_qemu; then
++
++      for path in $BUILD_DIR/qemu-*; do
++          if file $path | grep -q static; then
++              dest="$BUILD_ROOT/usr/bin/${path##*/}"
++              if [ -f "$path" -a ! -x "$dest" ]; then
++                  echo -n " $path"            # report copy
++                  #echo install -m755 "$path" "$dest"
++                  install -m755 "$path" "$dest"
++              fi
++          fi
++      done
++
++    else
++
++      for path in /usr/bin/qemu-*; do
++          if file $path | grep -q static; then
++              dest="$BUILD_ROOT/usr/bin/${path##*/}"
++              if [ -f "$path" -a ! -x "$dest" ]; then
++                  echo -n " $path"            # report copy
++                  #echo install -m755 "$path" "$dest"
++                  install -m755 "$path" "$dest"
++              fi
++          fi
++      done
++
++      if [ -e /usr/sbin/qemu-binfmt-conf.sh \
++          -a ! -e $BUILD_ROOT/usr/sbin/qemu-binfmt-conf.sh ]; then
++          echo " /usr/sbin/qemu-binfmt-conf.sh"               # report copy
++          mkdir -p $BUILD_ROOT/usr/sbin
++          install -m755 /usr/sbin/qemu-binfmt-conf.sh $BUILD_ROOT/usr/sbin
++      fi
++
++    fi
++    echo ""
++
++    # Below for backward compatibility when /.build/initvm is not present
++
++    if [ -n "$PREPARE_VM" ]; then
++      if [ -x /bin/bash-static -a -x /bin/mount-static ]; then
++          echo " /bin/bash-static /bin/mount-static"  # report copy
++          mkdir -p $BUILD_ROOT/bin
++          install -m755 /bin/bash-static $BUILD_ROOT/bin
++          install -m755 /bin/mount-static $BUILD_ROOT/bin
++      fi
++    fi
++}
++
++check_binfmt_registered()
++{
++    local arch
++    for arch in $EMULATOR_DEVS; do
++      if test -e /proc/sys/fs/binfmt_misc/$arch; then
++          return 0
++      fi
++    done
++    return 1
++}
++
+ fail_exit()
+ {
+   cleanup_and_exit 1
+@@ -607,6 +686,7 @@ else
+     # register the QEMU emulator
+     #
+     if check_use_emulator; then
++          [ -n "$USE_SYSTEM_QEMU" ] && copy_qemu
+           echo "registering binfmt handlers for VM"
+           if [ -x "$BUILD_DIR/initvm.`uname -m`" -a -e "$BUILD_DIR/qemu-reg" ]; then
+-- 
+1.7.9.5
+
diff --git a/packaging/0006-use-qemu-arm-static-binary.patch b/packaging/0006-use-qemu-arm-static-binary.patch
new file mode 100644 (file)
index 0000000..fd0ee6e
--- /dev/null
@@ -0,0 +1,26 @@
+From f386a8443752b1b827d2a73e62b3a9ee47e2f999 Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Mon, 25 Nov 2013 08:30:55 +0800
+Subject: [PATCH 6/6] use qemu-arm-static binary
+
+Change-Id: Ice3f5e9b19b7b8bf8d1e751285205a4a12e1b253
+---
+ qemu-reg |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/qemu-reg b/qemu-reg
+index fe1eca5..66afb3e 100644
+--- a/qemu-reg
++++ b/qemu-reg
+@@ -5,7 +5,7 @@
+ # NOTE: this requires a qemu with the binfmt misc handler binary
+ :aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-arm64-binfmt:P
+-:arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-binfmt:P
++:arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfa\xff\xff\xff:/usr/bin/qemu-arm-static:
+ :armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-armeb-binfmt:P
+ :ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc-binfmt:P
+ :mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips-binfmt:P
+-- 
+1.7.9.5
+
diff --git a/packaging/0007-fix-initvm-binary-search-issue.patch b/packaging/0007-fix-initvm-binary-search-issue.patch
new file mode 100644 (file)
index 0000000..8b3fb73
--- /dev/null
@@ -0,0 +1,28 @@
+From 9c7b53621ca910e7211fc3bfe65013acf6ab23f0 Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Mon, 25 Nov 2013 10:26:06 +0800
+Subject: [PATCH 7/7] fix initvm binary search issue
+
+Change-Id: Ie101b8138fb6b429b29c03c42e7f393ab5f77979
+---
+ init_buildsystem |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/init_buildsystem b/init_buildsystem
+index 750797d..701bc51 100755
+--- a/init_buildsystem
++++ b/init_buildsystem
+@@ -689,8 +689,8 @@ else
+           [ -n "$USE_SYSTEM_QEMU" ] && copy_qemu
+           echo "registering binfmt handlers for VM"
+-          if [ -x "$BUILD_DIR/initvm.`uname -m`" -a -e "$BUILD_DIR/qemu-reg" ]; then
+-              $BUILD_DIR/initvm.`uname -m`
++          if [ -x "$BUILD_DIR/initvm.$BUILD_HOST_ARCH" -a -e "$BUILD_DIR/qemu-reg" ]; then
++              $BUILD_DIR/initvm.$BUILD_HOST_ARCH
+           else
+               echo "Warning: could not register binfmt handlers. Neither build-initvm nor /usr/sbin/qemu-binfmt-conf.sh exist"
+           fi
+-- 
+1.7.9.5
+
diff --git a/packaging/0008-Support-ExportFilter.patch b/packaging/0008-Support-ExportFilter.patch
new file mode 100644 (file)
index 0000000..adbc3ef
--- /dev/null
@@ -0,0 +1,131 @@
+From 7c25326d428398cf7c14a28451310b96d1b89b32 Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Fri, 13 Sep 2013 11:51:54 +0800
+Subject: [PATCH 8/8] Support ExportFilter
+
+Change-Id: I264810e90026d060cd5b152fb18a911fc1c27432
+Fixes: #1311
+---
+ expanddeps |   80 +++++++++++++++++++++++++++++++++++-------------------------
+ 1 file changed, 47 insertions(+), 33 deletions(-)
+
+diff --git a/expanddeps b/expanddeps
+index 46ae1f2..fe54d2b 100755
+--- a/expanddeps
++++ b/expanddeps
+@@ -7,6 +7,7 @@ BEGIN {
+ use strict;
+ use Build;
++use File::Basename;
+ my ($dist, $rpmdeps, $archs, $configdir, $useusedforbuild);
+@@ -80,18 +81,64 @@ my %ids;
+ my %packs_arch;
+ my %packs_done;
++
++# XXX: move to separate tool
++if (!defined($dist) || $dist eq '') {
++  my $rpmarch = (grep {$fn{"rpm.$_"}} @archs)[0];
++  if (!$rpmarch) {
++    $dist = 'default';
++  } else {
++    my $rpmfn = $fn{"rpm.$rpmarch"};
++    if ($rpmfn =~ /^[a-z]+:\/\//) {
++      require File::Temp;
++      my $tmpdir = File::Temp::tempdir('CLEANUP' => 1);
++      $rpmfn =~ s/.*\//$tmpdir\// unless system("$INC[0]/download", $tmpdir, $rpmfn);
++    }
++    my $rpmdist = '';
++    if ($rpmfn =~ /^\// && -e $rpmfn) {
++      my %res = Build::Rpm::rpmq($rpmfn, 1010);
++      $rpmdist = $res{1010}->[0] || '';
++    }
++    $dist = Build::dist_canon($rpmdist, $archs[0]);
++    # need some extra work for sles11 :(
++    if ($dist =~ /^sles11-/) {
++      my %res = Build::Rpm::rpmq($rpmfn, 1049);
++      $dist =~ s/^sles11-/sles11sp2-/ if grep {/^liblzma/} @{$res{1049} || []};
++    }
++  }
++  print STDERR "Warning: distribution not specified, assuming '$dist' (see $configdir).\n";
++}
++
++my $cf = Build::read_config_dist($dist, $archs[0], $configdir);
++$cf->{'warnings'} = 1;
++
++my $dofileprovides = %{$cf->{'fileprovides'}};
++
++my %exportfilters = %{$cf->{'exportfilter'}};
+ open(F, '<', $rpmdeps) || die("$rpmdeps: $!\n");
+ # WARNING: the following code assumes that the 'I' tag comes last
+ my ($pkgF, $pkgP, $pkgR);
+ while(<F>) {
+   chomp;
+   if (/^F:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
++    my $pkgname = basename($2);
+     $pkgF = $2;
+     next if $fn{$1};
+     $fn{$1} = $2;
+     my $pack = $1;
+     $pack =~ /^(.*)\.([^\.]+)$/ or die;
+     push @{$packs_arch{$2}}, $1;
++    my $basename = $1;
++    my $arch = $2;
++    for(keys %exportfilters) {
++      next if ($pkgname !~ /$_/);
++      for (@{$exportfilters{$_}}) {
++        my $a = $_;
++        next if ($a eq ".");
++        next if (! grep ($_ eq $a, @archs));
++        $packs{$basename} = "$basename.$arch"
++      }
++    }
+   } elsif (/^P:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
+     $pkgP = $2;
+     next if $prov{$1};
+@@ -127,39 +174,6 @@ close F;
+ for my $arch (@archs) {
+   $packs{$_} ||= "$_.$arch" for @{$packs_arch{$arch} || []};
+ }
+-
+-# XXX: move to separate tool
+-if (!defined($dist) || $dist eq '') {
+-  my $rpmarch = (grep {$fn{"rpm.$_"}} @archs)[0];
+-  if (!$rpmarch) {
+-    $dist = 'default';
+-  } else {
+-    my $rpmfn = $fn{"rpm.$rpmarch"};
+-    if ($rpmfn =~ /^[a-z]+:\/\//) {
+-      require File::Temp;
+-      my $tmpdir = File::Temp::tempdir('CLEANUP' => 1);
+-      $rpmfn =~ s/.*\//$tmpdir\// unless system("$INC[0]/download", $tmpdir, $rpmfn);
+-    }
+-    my $rpmdist = '';
+-    if ($rpmfn =~ /^\// && -e $rpmfn) {
+-      my %res = Build::Rpm::rpmq($rpmfn, 1010);
+-      $rpmdist = $res{1010}->[0] || '';
+-    }
+-    $dist = Build::dist_canon($rpmdist, $archs[0]);
+-    # need some extra work for sles11 :(
+-    if ($dist =~ /^sles11-/) {
+-      my %res = Build::Rpm::rpmq($rpmfn, 1049);
+-      $dist =~ s/^sles11-/sles11sp2-/ if grep {/^liblzma/} @{$res{1049} || []};
+-    }
+-  }
+-  print STDERR "Warning: distribution not specified, assuming '$dist' (see $configdir).\n";
+-}
+-
+-my $cf = Build::read_config_dist($dist, $archs[0], $configdir);
+-$cf->{'warnings'} = 1;
+-
+-my $dofileprovides = %{$cf->{'fileprovides'}};
+-
+ for my $pack (keys %packs) {
+   my $r = {};
+   my (@s, $s, @pr, @re);
+-- 
+1.7.9.5
+
diff --git a/packaging/0009-always-register-qemu-handler.patch b/packaging/0009-always-register-qemu-handler.patch
new file mode 100644 (file)
index 0000000..e11a3e3
--- /dev/null
@@ -0,0 +1,35 @@
+From aa82809640f8ffdf69030cd32f60300840ead80a Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Tue, 3 Dec 2013 17:24:09 +0800
+Subject: [PATCH 9/9] always register qemu handler
+
+always register qemu handler even if interpreter does not exist, and
+in this case report warning instead of skip it. This way it just work
+like qemu-binfmt-conf.sh script in qemu
+
+Change-Id: Idf0f5eb8b6a4fec53ea272d2424beb9658cec6a4
+---
+ initvm.c |    7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/initvm.c b/initvm.c
+index bed0cc4..dd2495c 100644
+--- a/initvm.c
++++ b/initvm.c
+@@ -212,10 +212,9 @@ enum okfail binfmt_register(char *datafile, char *regfile)
+               if (access(f[interpreter], X_OK) != 0) {
+-                      fprintf(stderr, 
+-                              "%s: line %d: interpreter '%s' not found,"
+-                              " ignoring\n", datafile, line, f[interpreter]);
+-                      goto skip;
++                      fprintf(stderr,
++                              "warning: %s: line %d: interpreter '%s' not "
++                              "found\n", datafile, line, f[interpreter]);
+               }
+               if (!write_file_string(regfile, buf)) {
+-- 
+1.7.9.5
+
diff --git a/packaging/0010-download-packages-to-different-dirs-for-each-build-i.patch b/packaging/0010-download-packages-to-different-dirs-for-each-build-i.patch
new file mode 100644 (file)
index 0000000..4551a2e
--- /dev/null
@@ -0,0 +1,38 @@
+From 301ca3beba18d92873fa8544be47a4e357214c10 Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Tue, 10 Dec 2013 15:37:49 +0800
+Subject: [PATCH 10/10] download packages to different dirs for each build
+ instances
+
+This patch can avoid download error during multiple build instance
+runing at the same time
+
+Change-Id: Ie2ae7b6e73c8f7c7358b4dfd8b758ec662db7bbd
+---
+ init_buildsystem |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/init_buildsystem b/init_buildsystem
+index 512ba1f..e72613a 100755
+--- a/init_buildsystem
++++ b/init_buildsystem
+@@ -534,7 +534,7 @@ downloadpkg()
+       cleanup_and_exit 1
+     fi
+-    local destdir="$cachedir/tmp"
++    local destdir="$cachedir/tmp_$$"
+     mkdir -p "$destdir"
+     echo "downloading $url ... ";
+     $BUILD_DIR/download "$destdir" "$url" || cleanup_and_exit 1
+@@ -554,6 +554,7 @@ downloadpkg()
+       ;;
+     esac
+     mv "$destfile" "$SRC" || cleanup_and_exit 1
++    rm -rf $destdir
+ }
+ getcachedir()
+-- 
+1.7.9.5
+
diff --git a/packaging/0011-clean-up-old-registered-binfmt-handlers-before-use-i.patch b/packaging/0011-clean-up-old-registered-binfmt-handlers-before-use-i.patch
new file mode 100644 (file)
index 0000000..d492361
--- /dev/null
@@ -0,0 +1,28 @@
+From 563ac44d8a45cafa68f621f409547551a5176a0d Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Thu, 27 Feb 2014 10:57:44 +0800
+Subject: [PATCH 11/11] clean up old registered binfmt handlers before use it
+
+Change-Id: Ic3892e13ab28a1c83e885e0e087ab6675a4a3b71
+---
+ init_buildsystem |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/init_buildsystem b/init_buildsystem
+index e72613a..58ec929 100755
+--- a/init_buildsystem
++++ b/init_buildsystem
+@@ -688,6 +688,10 @@ else
+     #
+     if check_use_emulator; then
+           [ -n "$USE_SYSTEM_QEMU" ] && copy_qemu
++
++          echo "clean up registered binfmt handlers"
++            sudo sh -c "echo -1 >/proc/sys/fs/binfmt_misc/status"
++
+           echo "registering binfmt handlers for VM"
+           if [ -x "$BUILD_DIR/initvm.$BUILD_HOST_ARCH" -a -e "$BUILD_DIR/qemu-reg" ]; then
+-- 
+1.7.9.5
+
diff --git a/packaging/build.spec b/packaging/build.spec
new file mode 100644 (file)
index 0000000..b67d5bf
--- /dev/null
@@ -0,0 +1,716 @@
+#
+# spec file for package build
+#
+# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+
+
+Name:           build
+Summary:        A Script to Build SUSE Linux RPMs
+License:        GPL-2.0+ and GPL-2.0
+Group:          Development/Tools/Building
+%if 0%{?suse_version} >= 1230
+Version:        20131112
+%else
+Version:        2013.11.12
+%else
+%endif
+Release:        3.1
+#!BuildIgnore:  build-mkbaselibs
+Source:         obs-build-2013.11.12.tar.gz
+Patch0:         0001-Update-uid-gid-of-build-root-if-uid-gid-is-not-match.patch
+Patch1:         0002-Add-option-keep-packs-to-keep-packages-already-in-bu.patch
+Patch2:         0003-support-incremental-build.patch
+Patch3:         0004-hide-password-if-user-pass-needed-for-packages-repos.patch
+Patch4:         0005-add-back-use-system-qemu.patch 
+Patch5:         0006-use-qemu-arm-static-binary.patch
+Patch6:         0007-fix-initvm-binary-search-issue.patch
+Patch7:         0008-Support-ExportFilter.patch
+Patch8:         0009-always-register-qemu-handler.patch
+Patch9:         0010-download-packages-to-different-dirs-for-each-build-i.patch
+Patch10:        0011-clean-up-old-registered-binfmt-handlers-before-use-i.patch
+
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+# Manual requires to avoid hard require to bash-static
+AutoReqProv:    off
+# Keep the following dependencies in sync with obs-worker package
+BuildRequires:  glibc-devel
+Requires:       bash
+Requires:       perl
+Requires:       binutils
+Requires:       tar
+Requires:       perl(LWP::Protocol::https)
+Requires:       perl(LWP::UserAgent)
+Requires:       perl(Crypt::SSLeay)
+Requires:       perl(XML::Parser)
+Requires:       perl(Archive::Tar)
+Requires:       tizen-qemu-arm-static >= 2013.12.12
+Requires:       perl-Crypt-SSLeay >= 0.64-tizen20130308
+
+%if 0%{?fedora_version} || 0%{?suse_version} == 1220 || 0%{?centos_version}
+Requires:       rpm-build
+%endif
+Requires:       rpm
+
+Conflicts:      bsdtar < 2.5.5
+%if 0%{?suse_version} > 1000
+# None of them are actually required for core features.
+# Perl helper scripts use them.
+Recommends:     perl(Date::Language)
+Recommends:     perl(Date::Parse)
+Recommends:     perl(Pod::Usage)
+Recommends:     perl(Time::Zone)
+Recommends:     perl(URI)
+Recommends:     bsdtar
+%endif
+
+%if 0%{?suse_version} > 1120 || ! 0%{?suse_version}
+Requires:       build-mkbaselibs
+%endif
+
+%if 0%{?suse_version} > 1120 || 0%{?mdkversion}
+Recommends:     build-mkdrpms
+%endif
+Provides:   tizen-build = 20140227
+%description
+This package provides a script for building RPMs for SUSE Linux in a
+chroot environment.
+
+
+%if 0%{?suse_version} > 1120 || ! 0%{?suse_version}
+
+%package mkbaselibs
+Summary:        Tools to generate base lib packages
+Group:          Development/Tools/Building
+# NOTE: this package must not have dependencies which may break boot strapping (eg. perl modules)
+
+%description mkbaselibs
+This package contains the parts which may be installed in the inner build system
+for generating base lib packages.
+
+%package mkdrpms
+Summary:        Tools to generate delta rpms
+Group:          Development/Tools/Building
+Requires:       deltarpm
+# XXX: we wanted to avoid that but mkdrpms needs Build::Rpm::rpmq
+Requires:       build
+%if 0%{?fedora_version} || 0%{?centos_version}
+Autoreq:        0
+%endif
+
+%description mkdrpms
+This package contains the parts which may be installed in the inner build system
+for generating delta rpm packages.
+
+%endif
+
+%define initvm_arch %{_host_cpu}
+%if %{_host_cpu} == "i686"
+%define initvm_arch i586
+%endif
+
+%package initvm-%{initvm_arch}
+Summary:        Virtualization initializer for emulated cross architecture builds
+Group:          Development/Tools/Building
+Requires:       build
+BuildRequires:  gcc
+BuildRequires:  glibc-devel
+Provides:       tizen-build-initvm-%{initvm_arch} = 20140227
+Obsoletes:      build-initvm
+%if 0%{?suse_version}
+BuildRequires:  glibc-devel-static
+%else
+BuildRequires:  glibc-static
+%endif
+
+%description initvm-%{initvm_arch}
+This package provides a script for building RPMs for SUSE Linux in a
+chroot or a secure virtualized
+
+%prep
+%setup -q -n obs-build-2013.11.12
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
+%patch10 -p1
+
+%build
+# initvm
+make CFLAGS="$RPM_BUILD_FLAGS" initvm-all
+
+%install
+# initvm
+make DESTDIR=$RPM_BUILD_ROOT initvm-install
+strip $RPM_BUILD_ROOT/usr/lib/build/initvm.*
+export NO_BRP_STRIP_DEBUG="true"
+chmod 0644 $RPM_BUILD_ROOT/usr/lib/build/initvm.*
+
+# main
+make DESTDIR=$RPM_BUILD_ROOT install
+cd $RPM_BUILD_ROOT/usr/lib/build/configs/
+%if 0%{?suse_version}
+%if 0%{?sles_version}
+ ln -s sles%{sles_version}.conf default.conf
+%else
+ V=%suse_version
+ ln -s sl${V:0:2}.${V:2:1}.conf default.conf
+%endif
+test -e default.conf
+%endif
+
+%files
+%defattr(-,root,root)
+%doc README
+/usr/bin/build
+/usr/bin/buildvc
+/usr/bin/unrpm
+/usr/lib/build
+%config(noreplace) /usr/lib/build/emulator/emulator.sh
+%{_mandir}/man1/build.1*
+%exclude /usr/lib/build/initvm.*
+
+%if 0%{?suse_version} > 1120 || ! 0%{?suse_version}
+%exclude /usr/lib/build/mkbaselibs
+%exclude /usr/lib/build/baselibs*
+%exclude /usr/lib/build/mkdrpms
+
+%files mkbaselibs
+%defattr(-,root,root)
+%dir /usr/lib/build
+/usr/lib/build/mkbaselibs
+/usr/lib/build/baselibs*
+
+%files mkdrpms
+%defattr(-,root,root)
+%dir /usr/lib/build
+/usr/lib/build/mkdrpms
+
+%endif
+%files initvm-%{initvm_arch}
+%defattr(-,root,root)
+/usr/lib/build/initvm.*
+
+%changelog
+* Tue Sep 11 2012 qiang.z.zhang@intel.com
+- update to version 2012.09.11
+* Sat Aug 11 2012 qiang.z.zhang@intel.com
+- update to version 2012.08.10
+* Wed Jun 20 2012 qiang.z.zhang@intel.com
+- bump to a new higher version to get this updated always
+- clean up .src.cache file if --clean option specified
+* Sat Jun  2 2012 qiang.z.zhang@intel.com
+- https repo support
+- clean up print info
+- Refine-download-preinstall-install-progress-info
+* Mon Feb 13 2012 adrian@suse.de
+- Support for openSUSE 12.2 (current factory)
+- Support for crossbuild via Hostarch directive
+- PPC KVM support
+- swap space gets taken into account for ulimits
+- Failure on not supported personality set
+* Tue Oct 25 2011 adrian@suse.de
+- use github.com as git repo now
+- fix build for rpmv5
+* Mon Oct 10 2011 mls@suse.de
+- add sles11sp2 build config and adapt autodetection [bnc#711770]
+* Tue Oct  4 2011 adrian@suse.de
+- use new qemu-*-binfmt handler to run commands with correct $0
+- fix build for Factory
+* Mon Sep 26 2011 adrian@suse.de
+- fixing kvm cpuid setting for AMD and Intel CPU's
+- support new xen tools
+- fixed qemu build initialisation
+* Sun Aug  7 2011 opensuse@cboltz.de
+- Requires:/Recommends: were part of the package description.
+  Moved them to the correct place.
+* Fri Jul  1 2011 adrian@suse.de
+- compat mode for broken kiwi of openSUSE 11.4
+* Thu Jun 30 2011 adrian@suse.de
+- fixed kiwi execution call for some versions
+* Fri Jun 17 2011 adrian@suse.de
+- support new kiwi command line mode
+* Mon Jun  6 2011 adrian@suse.de
+- do not build ia64 baselibs packages for openSUSE anymore
+* Wed May 25 2011 adrian@suse.de
+- allow to use simple spec file parser via Build::show
+* Thu May 12 2011 adrian@suse.de
+- conflict with old bsdtar (not supporting --chroot)
+* Wed Apr 27 2011 adrian@suse.de
+- revert to single cpu build default for debian packages
+* Fri Apr 15 2011 adrian@suse.de
+- switch back to single process build for debian to be conform with
+  their policy
+- use cpuid kvm64 on kvm for 64bit as workaround for a cpuid bug
+* Tue Mar 29 2011 lnussel@suse.de
+- make sure default.conf is no stale symlink
+* Tue Mar  1 2011 adrian@suse.de
+- support new cross build initvm. Done by James Perkins from LinuxFoundation
+- do not use loop device anymore when using block devices directly
+* Thu Nov 11 2010 adrian@suse.de
+- workaround for distros with appstart like Ubuntu 10.10
+* Tue Nov  2 2010 lnussel@suse.de
+- delta size limit 80%%
+- actually unlink the delta file if the delta is too big
+* Wed Oct 27 2010 lnussel@suse.de
+- use '.drpm' suffix instead of '.delta.rpm' for delta rpms
+- makedeltarpms -> mkdrpms and also rename subpackage to match
+  script name
+- since mkdrpms needs Build.pm make perl-TimeDate dependency of
+  build optional
+* Mon Oct 18 2010 lnussel@suse.de
+- add missing optional perl dependencies
+* Fri Oct 15 2010 adrian@suse.de
+- update to current git
+  * export also fallback archs as exclusive archs for kiwi product
+    building, fixes factory dvd5 64bit media
+  * cross build fixes by Martin Mohring
+  * correct disk image file creation, it was one byte too large by James Perkins
+* Tue Sep 21 2010 adrian@suse.de
+- update to current git
+  * workaround for supporting rpm install on cross build with native
+    acceleration
+* Mon Sep 20 2010 lnussel@suse.de
+- package mkdrpms script in separate package
+* Tue Aug 24 2010 adrian@suse.de
+- update to current git
+  * support for mips cross build
+* Wed Aug  4 2010 adrian@suse.de
+- update to current git
+  * replace release number macros with 0 if not specified
+* Wed Jul 28 2010 mls@suse.de
+- update to current git
+  * document --repo and --dist
+  * update wiki links
+  * fix bugs in repo handling
+  * fix distribution autodetection code
+* Thu Jul 22 2010 adrian@suse.de
+- update to current git
+  * support for Files provide
+* Thu Jul  8 2010 adrian@suse.de
+- update to current git
+  * export BUILD_DEBUG so rpmlint can check for it (bnc#618004)
+* Tue Jun 29 2010 mls@suse.de
+- update to current git
+  * add 11.3 config
+  * fix repo creation in --noinit case
+  * support ovf files directly
+  * allow multiple --oldpackages
+  * delta rpm support
+* Mon Jun 21 2010 adrian@suse.de
+- update to current git
+  * fixes for image building for SLE 10
+  * fix parsing of macros that contain {} blocks
+  * support xz decoder helper script
+  * don't substitute in lines with %%(), the parser cannot handle it (bnc#613965)
+  * run kvm instance with the right number of cpus according to given parallel build jobs
+* Sat May 29 2010 adrian@suse.de
+- update to current git
+  * noatime VM mount
+  * _service file rename happens inside of chroot/vm now.
+* Tue May  4 2010 adrian@suse.de
+- update to current git
+  * CBinstall and CBPreninstall directive support from Jan-Simon
+* Wed Apr 21 2010 adrian@suse.de
+- detect kvm virtio initrds on SUSE systems automatically
+* Sun Apr 18 2010 ro@suse.de
+- build-mkbaselibs: also move baselibs*conf to subpackage
+* Thu Apr 15 2010 ro@suse.de
+- add BuildIgnore build-mkbaselibs to be able to bootstrap
+* Thu Apr 15 2010 adrian@suse.de
+- split out -mkbaselibs package to avoid build dependency problems
+  on perl version updates in future.
+- update to current git
+  * added armv6el to emulator archs by Jan-Simon.
+  * fixing a logic error in arch= attribute handling for kiwi
+* Fri Apr  9 2010 adrian@suse.de
+- update to current git
+  * Support for remote yum repos by yi.y.yang@intel.com
+  * fixed kiwi file parsing for arch= attributes
+* Wed Mar 31 2010 adrian@suse.de
+- update to current git
+  * kvm autosetup enhancements
+  * multiple bugfixes and refactoring
+* Wed Mar 10 2010 adrian@suse.de
+- update to current git
+  * Kiwi exclude arch handling
+* Mon Mar  8 2010 adrian@suse.de
+- create default.conf symlink to correct *.conf based on
+  %%suse_version and %%sles_version macros
+* Thu Feb 25 2010 adrian@suse.de
+- add dependency to tar (needed for deb builds)
+- use current git
+  * Added '--uid uid:gid' feature to specify abuild id in chroot
+    (by David Greaves)
+* Sat Feb 20 2010 adrian@suse.de
+- update to current git
+  * fix for permissions for debian (done by Jan-Simon)
+* Thu Feb 11 2010 adrian@suse.de
+- update to current git
+  * fixed handling of kiwi build results
+* Mon Feb  8 2010 adrian@suse.de
+- update to current git
+  * support kiwi 4.1 schema files
+* Tue Jan 19 2010 adrian@suse.de
+- update to current git
+  * fixed missing --root parameter for substitutedeps call
+* Mon Jan 18 2010 adrian@suse.de
+- update to current git
+  * create .sha256 files for kiwi image results
+* Wed Jan 13 2010 adrian@suse.de
+- update to current git repo
+  * unbreaking kiwi builds again
+* Sun Jan  3 2010 adrian@suse.de
+- update to current git repo, update to commit 549cf6c6e148b7f8c05c12ee06f3094cb67149f9
+  * minor bugfixes
+  * sparc support fixes
+* Thu Dec 10 2009 adrian@suse.de
+- switch to git repository, update to commit c8b33e430bfb40b80df43249279bd561d874d786
+  * product building via abuild user
+  * prodoct building speedup
+* Fri Nov 27 2009 adrian@suse.de
+- update to svn(r9279)
+  Debian packages get configured at install time  again now.
+  But keeping additional configuration step afterwards for failed
+  configutions (due to dep cycles)
+* Fri Nov 27 2009 adrian@suse.de
+- add requires to perl-TimeDate for changelog2spec app
+* Wed Nov 25 2009 adrian@suse.de
+- update to svn(r9238)
+  * Debian chroot enviroments are running post installation scripts
+    now after all packages got installed, not after each installation
+    (partly fixes Ubuntu 9.10 setup)
+* Sat Nov 21 2009 adrian@suse.de
+- update to current svn(r9154)
+  * add support for xz compressed rpms (Fedora 12) on platforms without xz support in
+    rpm.
+  * speed up install by disabling fsync in rpm config
+* Thu Nov  5 2009 adrian@suse.de
+- update to current svn (r8506)
+  - product iso generation is done by kiwi now
+  - debs get generated via "make install"
+* Wed Sep 23 2009 mls@suse.de
+- update to current svn (r8048)
+  - support openSUSE 11.2 [bnc#539914]
+* Mon Jul 27 2009 ro@suse.de
+- update to current svn (r7751)
+  - support for legacy releasepkg mechanism
+  - only print parse warnings if $config->{'warnings'} is set
+  - set warnings for expanddeps/substitutedeps
+  - use UTC as default timezone
+  - also consider patches as sources
+  - do not call depmod until we use also the native kernel,
+    it can't match otherwise
+  - return with value 3, if basic file system creation fails.
+    bs_worker will mark the build host as bad and retries on another one.
+  - handle files from service correctly and strip their prefix.
+  - - also add rpmv3 compatibility hack to createrpmdeps
+  - mount proc filesystem for build compare run
+  - fix for ccache support from
+  - add build-ids for debuginfo packages for subpacks
+* Wed Jun  3 2009 adrian@suse.de
+- update to current svn (r7483)
+  * Jan-Simons "ChangeTarget" support
+  * fix for handling missing self provides with rpm format 3.0.6
+* Thu Apr 23 2009 adrian@suse.de
+- update to current svn (r7164)
+  * package vc tool correctly
+  * avoid running fsck on vm instances after 23 build runs
+- install files via Makefile instead of manual calls in spec file
+* Mon Apr 20 2009 adrian@suse.de
+- update to current svn (r7126)
+  * new blocklist based build result export
+  * Martin Mohrings cross build extensions
+  * vc tool included now
+* Mon Mar 23 2009 adrian@suse.de
+- Fix for "Requires(pre/post)" tags
+- fix missing abuild group in /etc/gshadow on debian like distros
+* Wed Feb 25 2009 adrian@suse.de
+- Update for bug fix for image build with additional packages in --create step
+  (fix from cthiel, bnc#479537)
+* Fri Feb 20 2009 adrian@suse.de
+- Fix kvm support together with Alexander
+- Support for new disturl containing a complete pointer to build
+  service instance resource
+- add support for package compare to allow Build Service to drop
+  same packages after build
+- image repack support from Christoph
+* Tue Jan 27 2009 adrian@suse.de
+- update to current buildservice/1.5 branch
+- More fixes for kiwi image build
+- Move Susetags.pm to correct Build:: namespace
+* Wed Dec 10 2008 froh@suse.de
+- update to r5853:
+- added: new armv7el arch for all binaries for up to ARMv7 EABI with VFP
+- Fix kiwi image build support within osc
+* Fri Dec  5 2008 froh@suse.de
+- remove baselibs.conf from the spec file, too
+* Thu Dec  4 2008 ro@suse.de
+- delete baselibs.conf (nowadays stored in package sources)
+* Wed Dec  3 2008 ro@suse.de
+- delete automatic requires for debuginfo-xxbit
+* Wed Dec  3 2008 froh@suse.de
+- config update
+* Fri Nov 28 2008 froh@suse.de
+- many kiwi fixes
+- _no_ cross build support yet
+* Thu Nov 13 2008 ro@suse.de
+- update mkbaselibs broken by previous debuginfo change
+- various fixes for kiwi build
+- add sl11.1.conf
+- add support for --disturl
+- also save .desktopfiles for coolo
+* Thu Oct 23 2008 ro@suse.de
+- disable ppc:ia32 stuff again, causes trouble and can not work
+* Tue Oct 21 2008 jblunck@suse.de
+- Generate debuginfo packages for baselibs (bnc #396196)
+* Mon Oct 20 2008 ro@suse.de
+- update to svn trunk of today:
+- init_buildsystem: check for some left space before calling rpmbuild
+  - create dev/shm as directory
+- baselibs_global.conf: update to current internal revision
+  - add ia32 stuff for x86 binaries on ppc
+  - add ldconfig for all non-devel baselibs packages
+- changed: to function also with emulators better use fakeroot-tcp
+  for debian build
+- fixed: changed basis for memory calculation to assume also a stack
+  which can be swapped well. gcc often needs much memory here
+- recognize SLES10
+- fix boolification in && and ||
+- re-preinstall critical packages on update
+- fix creation of buildenv to do it the same time with and without VM.
+- fixes installation-images build for ppc
+- fixed #406596: don't ignore BuildRequires in subpackages
+- print finished message
+- set BUILD_USER depending on the suse_version like it is done in
+  old autobuild
+- added documentation for specfile control comments for build(1)
+- add --incarnation
+- add --create-build-binaries
+- support badarch (aka excludearch)
+- add support for Requires(pre) or (post) semantic
+* Mon Aug 11 2008 adrian@suse.de
+  Update from current svn trunk:
+- Improved XEN support (XEN call only once per build)
+- Add post build check hooks
+- rpmlint support
+- added kvm support
+- refactored code in various places
+* Tue Jun  3 2008 mls@suse.de
+- fix debtransform bug [bnc#396766]
+* Thu May 29 2008 mls@suse.de
+- add 11.0 config
+- fix debian provides
+- fix rpm tag parsing
+- add with/without/define/ccache/icecream/debug options
+- update mkbaselibs
+* Fri Sep 14 2007 mls@suse.de
+- add sl10.3 config [#310089]
+- also look for BuildRequires in subpackage definitions [#305568]
+- allow removal of more config parameters
+* Thu Aug  2 2007 mls@suse.de
+- support 'order' config option
+- support 'patterntype' config option
+- new setdeps() method
+- support for flexible query options
+- support 'description' query
+- fix bug in changelog2spec time cutoff
+- make debtransform understand Debtransform-Tar/Debtransform-Files-Tar/
+  Debtransform-Series
+- fix bug in substitutedeps
+* Wed Jun 13 2007 mls@suse.de
+- implement rpm installation order calculation in perl
+- make substitute code modify requires, too
+- add filelist query support
+- add prereq parsing support
+- speed up version comparison a bit
+* Thu May 10 2007 mls@suse.de
+- add _vendor to configs
+- fix deban dependency compare
+- allow not operator in configs
+- fix build from source rpms
+* Thu Apr 12 2007 mls@suse.de
+- add --root to rpm call in rpm to work around a bug in rpm [#255720]
+* Thu Apr  5 2007 mls@suse.de
+- update to 1561:
+  * support architecture dependand requires in dsc files
+  * support "global" definitions for rpm
+  * support vminstall config option
+* Mon Mar 12 2007 mls@suse.de
+- update to r1419:
+  * fix buildroot in debtransform
+  * obey version numbers when expanding
+* Fri Mar  2 2007 mls@suse.de
+- transform suse changes file to rpm specfile format
+- improved debian support
+* Fri Jan 26 2007 poeml@suse.de
+- update to r1114:
+  - re-add the lost unrpm script
+* Fri Jan 26 2007 poeml@suse.de
+- update to r1110:
+  - make exclarch an array
+  - remount root rw in xen case, needed if root is not reiserfs
+  - add repotype/runscripts options
+  - remove devs in sl10.1/10.2
+  - fix boolean test to make "00" false like rpm does
+  - add rpm_verscmp for version comparison
+  - runscripts
+  - macro blocks
+  - read_config_dist
+  - useful xen exit status
+  - add --kill
+  - update 10.2 config
+  - extend spec/dsc parser
+  - fixed two bugs in the specfile parser
+* Fri Nov 24 2006 mls@suse.de
+- fix suse_version in sl10.1/sles10 config
+- add sl10.2 config
+- make dist autodetection work with opensuse
+- fix macro sequencing and expression parser bugs
+- treat preinstalls as keep
+* Wed Aug 23 2006 ro@suse.de
+- init_buildsystem: when preinstalling, handle only sh scripts
+* Wed Jun 14 2006 mls@suse.de
+- support for buildservice and debian packages
+* Fri Apr 28 2006 mls@suse.de
+- add ndeps back to expansion calls
+- save original macro name so that other regexp calls don't destroy
+  it
+* Wed Apr 19 2006 mls@suse.de
+- add --list-state option [#119869]
+- suppress stat messages when deleting rpms [#154385]
+- delete not-ready flag when rpm expansion failes [#133568]
+- update baselibs.conf
+* Tue Apr 11 2006 mls@suse.de
+- fix typo in configs
+- fix macro handling
+* Fri Apr  7 2006 mls@suse.de
+- mkbaselibs: do not leave .src.rpm in the release [#158816]
+* Tue Apr  4 2006 mls@suse.de
+- add update-alternatives to java2-devel-packages macro [#156137]
+* Mon Mar 27 2006 mls@suse.de
+- run zic to set default timezone [#142363]
+- update baselibs.conf
+* Fri Mar 24 2006 mls@suse.de
+- fix handling of "keep" [#160346]
+- fix old configs [#159947]
+* Mon Mar 20 2006 mls@suse.de
+- make mkbaselibs use the right version for the srcrpm
+- update mkbaselibs configuration files
+* Fri Mar 10 2006 mls@suse.de
+- add package expansion and dependency substitution support
+* Wed Feb  8 2006 agruen@suse.de
+- Adjust the package lists so that the build script can at least
+  be used again.
+* Wed Jan 25 2006 mls@suse.de
+- converted neededforbuild to BuildRequires
+* Mon Sep 12 2005 mls@suse.de
+- also search for ix86 packages when building x86_64 [#116069]
+* Mon Sep  5 2005 mls@suse.de
+- add --baselibs option
+- fix --extra-packs
+* Thu May 12 2005 mls@suse.de
+- Fix typo in init_buildsystem that prevented the reuse of the build
+  environment [#74714]
+* Fri Mar 11 2005 mls@suse.de
+- integrated patches into tarball
+- allowed build for older dists [#65506]
+* Wed Mar  2 2005 agruen@suse.de
+- Some more cleanups for 9.3.
+- When using the default list of packages, also try to include the
+  packages in neededforbuild.
+* Mon Feb 28 2005 agruen@suse.de
+- ldconfig must be called with its absolute path.
+* Tue May 25 2004 mls@suse.de
+- overhaul the manpage
+* Thu Mar 25 2004 mls@suse.de
+- incorporate ro's diff
+* Wed Mar 24 2004 mls@suse.de
+- really adapt to 9.1
+- add --root and --extra-packs options
+- use BuildRequires: line
+- use user 'abuild' if norootforbuild found
+- fix BUILD_DIR security issue (#35281)
+* Thu Mar 11 2004 ro@suse.de
+- adapted for 9.1
+* Mon Nov 10 2003 mmj@suse.de
+- Accept "-h" for help
+- rpm -ba is now rpmbuild -ba
+- Add Maximum RPM reference
+* Mon Nov 10 2003 mmj@suse.de
+- Update the default USEDFORBUILD to match todays packages
+- Don't build as root
+* Wed Oct 15 2003 mmj@suse.de
+- Fix to work on amd64 (from mls) [#32229]
+* Fri Sep  5 2003 mls@suse.de
+- select i586 on i686 is user didn't specify arch
+- complain if user wan't to build i686 on a not-i686 processor
+- patch rpmrc so that i686 rpms are written if building for i686
+* Thu Sep  4 2003 mls@suse.de
+- port to sl90
+- allow path for BUILD_RPMS
+- add BUILD_ARCH and autodetection
+- add --jobs and --target options
+* Thu Aug 28 2003 nashif@suse.de
+- fixed call for "head"
+* Thu Aug  7 2003 schwab@suse.de
+- Fix typo.
+* Thu Aug  7 2003 mmj@suse.de
+- Enhance build.1 a bit
+* Sat Mar  8 2003 kukuk@suse.de
+- Fix build on 8.2 (coreutils) [Bug #24895]
+* Fri Jan 31 2003 kukuk@suse.de
+- Fix build patch from bk.
+* Wed Jan 29 2003 kukuk@suse.de
+- Add workaround for duplicate packages for different archs
+- Add support for upcoming 8.2
+* Fri Oct  4 2002 bk@suse.de
+- integrate 8.1 diff into tarball and update README
+- build.dif: init_buildsystem: add support for earlyer distributions
+* Mon Sep  9 2002 mls@suse.de
+- Adjust for SuSE Linux 8.1 again
+- Fix parameter parsing
+- Changed build to accept .src.rpm sources
+* Mon Aug 19 2002 kukuk@suse.de
+- Adjust for SuSE Linux 8.1
+* Tue Jul 30 2002 kukuk@suse.de
+- Fix get_version_number.sh
+* Thu Jul 18 2002 kukuk@suse.de
+- Don't create /etc/rc.config
+* Wed Jul  3 2002 kukuk@suse.de
+- Add default package list for new spec files without usedforbuild
+- Make it work with gcc 2.95 and gcc 3.1
+* Thu Mar  7 2002 kukuk@suse.de
+- Fix build/init_buildsystem
+* Mon Jan 14 2002 kukuk@suse.de
+- Add manual page from Gerd Knorr
+* Fri Dec 14 2001 kukuk@suse.de
+- Fix file list
+- Ignore new RPMs from pre-8.0 on 7.3
+* Fri Dec 14 2001 kukuk@suse.de
+- More fixes
+* Tue Nov 27 2001 kukuk@suse.de
+- New build script which uses "usedforbuild"
+* Thu Jan 18 2001 kukuk@suse.de
+- Update Readme and init_buildsystem for 7.1
+* Thu Nov 30 2000 kukuk@suse.de
+- Update init_buildsystem, add README
+* Wed Nov 15 2000 kukuk@suse.de
+- First version