+++ /dev/null
-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
-
+++ /dev/null
-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
-
+++ /dev/null
-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
-
+++ /dev/null
-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
-
+++ /dev/null
-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
-
+++ /dev/null
-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
-
+++ /dev/null
-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
-
+++ /dev/null
-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
-
+++ /dev/null
-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
-
+++ /dev/null
-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
-
+++ /dev/null
-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
-
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
%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