--- build-2012.09.12.orig/debian/compat
+++ build-2012.09.12/debian/compat
@@ -0,0 +1 @@
+4
--- build-2012.09.12.orig/debian/docs
+++ build-2012.09.12/debian/docs
@@ -0,0 +1 @@
+README
--- build-2012.09.12.orig/debian/rules
+++ build-2012.09.12/debian/rules
@@ -0,0 +1,68 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany
+# This file and all modifications and additions to the pristine package
+# are under the same license as the package itself.
+#
+# Please submit bugfixes or commens via http://bugs.opensuse.org
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+include /usr/share/dpatch/dpatch.make
+
+SHELL=/bin/bash
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp  patch-stamp
+	dh_testdir
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+	make DESTDIR=$(CURDIR)/debian/build install
+	make DESTDIR=$(CURDIR)/debian/build initvm-install
+
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs
+	dh_installdocs
+	dh_installexamples
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary-indep: build install
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
--- build-2012.09.12.orig/debian/control
+++ build-2012.09.12/debian/control
@@ -0,0 +1,14 @@
+Source: build
+Section: devel
+Priority: optional
+Maintainer: Adrian Schroeter <adrian@suse.de>
+Build-Depends: debhelper (>= 4), dpatch, cdbs,
+Standards-Version: 3.7.2
+
+Package: build
+Architecture: all
+Depends: ${perl:Depends}, rpm, libxml-parser-perl, libcrypt-ssleay-perl (>= 0.59)
+Recommends: rpm2cpio
+Description: A script to build SUSE Linux RPMs
+ This package provides a script for building RPMs for SUSE Linux
+ in a chroot environment.
--- build-2012.09.12.orig/debian/changelog
+++ build-2012.09.12/debian/changelog
@@ -0,0 +1,228 @@
+build (2012.09.12-1) unstable; urgency=high
+
+  * update to version 2012.09.12
+
+ -- Zhang Qiang <qiang.z.zhang@intel.com>  Wed, 11 Sep 2012 19:30:22 +0200
+
+build (2012.08.10-1) unstable; urgency=high
+
+  * update to version 2012.08.10
+
+ -- Zhang Qiang <qiang.z.zhang@intel.com>  Sat, 11 Aug 2012 19:30:22 +0200
+
+build (2012.07.21-1) unstable; urgency=high
+
+  * bump to a new higher version to get this updated always
+  * clean up .src.cache file if --clean option specified
+
+ -- Zhang Qiang <qiang.z.zhang@intel.com>  Wed, 20 Jun 2012 19:30:22 +0200
+
+build (2012.04.17-1) unstable; urgency=high
+
+  * https repo support
+  * clean up print info
+  * Refine-download-preinstall-install-progress-info
+
+ -- Zhang Qiang <qiang.z.zhang@intel.com>  Sat, 2 Jun 2012 19:30:22 +0200
+
+build (2012.02.13-1) unstable; urgency=low
+
+  * Update to current git trunk
+    - add sles11sp2 build config and adapt autodetection
+
+ -- Michael Schroeder <mls@suse.de>  Mon, 10 Oct 2011 19:30:22 +0200
+
+build (2011.09.26-1) unstable; urgency=low
+
+  * Update to current git trunk
+
+ -- Adrian Schroeter <adrian@suse.de>  Fri, 01 Jul 2010 10:03:54 +0200
+
+build (2011.07.01-1) unstable; urgency=low
+
+  * Update to current git trunk
+
+ -- Adrian Schroeter <adrian@suse.de>  Fri, 01 Jul 2010 10:03:54 +0200
+
+build (2010.12.15-1) unstable; urgency=low
+
+  * Update to current git trunk
+    - support bsdtar for setting up build enviroment
+    - make expanddeps use the highest version of a package if multiple 
+      versions aver available in a repository [bnc#656599]
+
+ -- Michael Schroeder <mls@suse.de>  Wed, 15 Dec 2010 14:08:29 +0200
+
+build (2010.07.28-1) unstable; urgency=low
+
+  * Update to current git trunk
+    - document --repo and --dist
+    - update wiki links
+    - fix bugs in repo handling
+    - fix distribution autodetection code
+
+ -- Michael Schroeder <mls@suse.de>  Wed, 28 Jul 2010 12:46:52 +0200
+
+build (2010.07.08-1) unstable; urgency=low
+
+  * Update to current git trunk
+
+ -- Adrian Schroeter <adrian@suse.de>  Wed, 08 Jul 2010 10:03:54 +0200
+
+build (2010.06.29-1) unstable; urgency=low
+
+  * Update to current git trunk
+    - add 11.3 config
+    - fix repo creation in --noinit case
+    - support ovf files directly
+    - allow multiple --oldpackages
+    - delta rpm support
+
+ -- Adrian Schroeter <adrian@suse.de>  Tue, 29 Jun 2010 10:03:54 +0200
+
+build (2010.02.02-1) unstable; urgency=low
+
+  * Update to current git trunk
+    - Support new kiwi 4.1 schema files
+
+ -- Adrian Schroeter <adrian@suse.de>  Tue, 02 Feb 2010 10:03:54 +0200
+
+build (2009.09.23-1) unstable; urgency=low
+
+  * Update to current svn trunk
+
+ -- Michael Schroeder <mls@suse.de>  Wed, 23 Sep 2009 12:03:54 +0200
+
+build (2009.04.20-1) unstable; urgency=low
+
+  * Update to current svn trunk
+
+ -- Adrian Schroeter <adrian@suse.de>  Mon, 20 Feb 2009 08:27:13 +0200
+
+build (2009.02.20-1) unstable; urgency=low
+
+  * 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
+
+ -- Adrian Schroeter <adrian@suse.de>  Fri, 20 Feb 2009 08:27:13 +0200
+
+build (2007.09.14-1) unstable; urgency=low
+
+  * update to 2173:
+    - add sl10.3 config [#310089]
+    - also look for BuildRequires in subpackage definitions [#305568]
+    - allow removal of more config parameters
+
+ -- Michael Schroeder <mls@suse.de>  Fri, 14 Sep 2007 18:27:13 +0200
+
+build (2007.08.02-1) unstable; urgency=low
+
+  * update to 1902:
+    - 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
+
+ -- Michael Schroeder <mls@suse.de>  Thu, 2 Aug 2007 15:58:48 +0200
+
+build (2007.06.13-1) unstable; urgency=low
+
+  * update to 1727:
+    - 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
+
+ -- Michael Schroeder <mls@suse.de>  Wed, 13 Jun 2007 17:18:17 +0100
+
+build (2007.05.10-1) unstable; urgency=low
+
+  * update to 1653:
+    - add _vendor to configs
+    - fix deban dependency compare
+    - allow not operator in configs
+    - fix build from source rpms
+
+ -- Michael Schroeder <mls@suse.de>  Thu, 10 May 2007 20:02:29 +0100
+
+build (2007.04.12-1) unstable; urgency=low
+
+  * update to 1575:
+    - add --root to rpm call in rpm to work around a bug in rpm [#255720]
+
+ -- Michael Schroeder <mls@suse.de>  Thu, 12 Apr 2007 16:22:51 +0100
+
+build (2007.04.05-1) unstable; urgency=low
+
+  * update to 1561:
+    - support architecture dependand requires in dsc files
+    - support "global" definitions for rpm
+    - support vminstall config option
+
+ -- Michael Schroeder <mls@suse.de>  Thu, 5 Apr 2007 16:01:51 +0100
+
+build (2007.03.12-1) unstable; urgency=low
+
+  * update to r1419:
+    - fix buildroot in debtransform call
+    - obey version numbers when expanding
+
+ -- Michael Schroeder <mls@suse.de>  Mon, 12 Mar 2007 15:42:48 +0100
+
+build (2007.03.02-1) unstable; urgency=low
+
+  * update
+    - transform suse changes file to rpm specfile format
+    - improved debian support
+
+ -- Michael Schroeder <mls@suse.de>  Fri, 2 Mar 2007 21:22:41 +0100
+
+build (2007.01.26-1) unstable; urgency=low
+
+  * update to r1114
+    - re-add the lost unrpm script
+    - 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
+
+ -- Peter Poeml <poeml@suse.de>  Fri, 26 Jan 2007 14:15:22 +0100
+
+build (2006.10.5-1) unstable; urgency=low
+
+  * update for fixed XEN build
+
+ -- Michael Schroeder <mls@suse.de>  Thu, 5 Oct 2006 10:58:42 +0200
+
+build (2006.8.10-1) unstable; urgency=low
+
+  * update for fixed XEN build and proc mounting
+
+ -- Adrian Schroeter <adrian@suse.de>  Thu, 10 Aug 2006 12:01:08 +0200
+
+build (2006.6.14-1) unstable; urgency=low
+
+  * Initial release based on build-2006.6.14-5.1.src.rpm
+
+ -- Rene Engelhard <rengelhard@suse.de>  Thu, 22 Jun 2006 12:01:08 +0200
+
--- build-2012.09.12.orig/debian/copyright
+++ build-2012.09.12/debian/copyright
@@ -0,0 +1,21 @@
+This package was debianized by Rene Engelhard <rengelhard@suse.de> on
+Thu, 22 Jun 2006 12:01:08 +0200.
+
+It was downloaded from http://software.opensuse.org/download/openSUSE:/Tools/SUSE_Linux_Factory/src
+
+Upstream authors: Thorsten Kukuk <kukuk@suse.de>
+                  Michael Schröter <mls@suse.de>
+		  Bernhard Kaindl <bk@suse.de>
+		  Mad Martin Jorgensen <mmj@suse.de>
+		  Andreas Schwab <schwab@suse.de>
+		  Rüdiger Oertel <ro@suse.de>
+		  Andreas Gruenbacher <agruen@suse.de>
+
+Copyright: (c) 1997-2007 SuSE GmbH Nuernberg, Germany
+
+License:
+
+GPL
+
+The Debian packaging is (C) 2006, Rene Engelhard <rengelhard@suse.de> and
+is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
--- build-2012.09.12.orig/debian/patches/0001-Refine-download-progress-info.patch
+++ build-2012.09.12/debian/patches/0001-Refine-download-progress-info.patch
@@ -0,0 +1,69 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+##
+##
+
+@DPATCH@
+
+From 33f30ea07acc39f1a0d64f81c04ce569baa53e1c Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Sat, 11 Aug 2012 07:51:17 +0800
+Subject: [PATCH 1/5] Refine download  progress info
+
+---
+ init_buildsystem |   27 ++++++++++++++++++++++++++-
+ 1 files changed, 26 insertions(+), 1 deletions(-)
+
+diff --git a/init_buildsystem b/init_buildsystem
+index b399d86..c3773a8 100755
+--- a/init_buildsystem
++++ b/init_buildsystem
+@@ -768,7 +768,18 @@ else
+ 	    url="$SRC"
+ 	    case "$url" in
+ 		zypp://* | http://* | https://* | ftp://* | ftps://*)
+-		    downloadpkg "$url"
++                    cachedir="$(getcachedir "$url")"
++                    pkgname="$(basename "$url")"
++                    pkgname=${pkgname/%.pkg.tar.?z/.arch}
++                    rpmpkg="$cachedir/$pkgname"
++                    if [ -e $rpmpkg ]
++                    then
++                        rpm -K --nosignature "$rpmpkg" > $rpmpkg.v || echo "$PKG $SRC" >>${RPMLIST}.download
++                        rpm -K --nosignature "$rpmpkg" > $rpmpkg.v && downloadpkg "$url"
++                        rm -f $rpmpkg.v
++                    else
++                        echo "$PKG $SRC" >>${RPMLIST}.download
++                    fi
+ 		    ;;
+ 		*)
+ 		    echo "unsupported url for '$PKG': $url" >&2
+@@ -781,6 +792,19 @@ else
+ 	ln -s "$SRC" "$BUILD_ROOT/.init_b_cache/rpms/$PKG.${SRCSUF##*.}"
+ 	PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL $PKG"
+     done < $RPMLIST
++    if [ -e ${RPMLIST}.download ]
++    then
++        PACKAGES_TO_DOWNLOAD=`cat ${RPMLIST}.download|awk '{print $2}'`
++        progress_setup PACKAGES_TO_DOWNLOAD
++        while read PKG SRC ; do
++            progress_step PACKAGES_TO_DOWNLOAD
++            downloadpkg "$SRC"
++            rm -f "$BUILD_ROOT/.init_b_cache/rpms/$PKG.${SRC##*.}"
++            ln -s "$SRC" "$BUILD_ROOT/.init_b_cache/rpms/$PKG.${SRC##*.}"
++        done < ${RPMLIST}.download
++        rm ${RPMLIST}.download -f
++        printf "\n"
++    fi
+ 
+     test -n "$PACKAGES_TO_CBPREINSTALL" && echo "cbpreinstall: $PACKAGES_TO_CBPREINSTALL"
+     test -n "$PACKAGES_TO_CBINSTALL" && echo "cbinstall   : $PACKAGES_TO_CBINSTALL"
+@@ -850,6 +874,7 @@ if test ! -f $BUILD_ROOT/var/lib/rpm/packages.rpm -a ! -f $BUILD_ROOT/var/lib/rp
+ 	progress_step PACKAGES_TO_PREINSTALL_FILTERED
+ 	preinstall ${PKG##*/}
+     done
++    printf "\n"
+     if test -n "$PREPARE_VM" ; then
+         PACKAGES_TO_VMINSTALL_FILTERED=`reorder $PACKAGES_TO_VMINSTALL_FILTERED`
+ 	progress_setup PACKAGES_TO_VMINSTALL_FILTERED
+-- 
+1.7.1
--- build-2012.09.12.orig/debian/patches/0004-remove-cachefile-if-clean-specified.patch
+++ build-2012.09.12/debian/patches/0004-remove-cachefile-if-clean-specified.patch
@@ -0,0 +1,29 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+##
+##
+
+@DPATCH@
+
+From 4205bfa1f04d741f5539c2016365e026857d4d1e Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Sat, 11 Aug 2012 07:59:14 +0800
+Subject: [PATCH 4/5] remove cachefile if --clean specified
+
+---
+ init_buildsystem |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+diff --git a/init_buildsystem b/init_buildsystem
+index 5f61952..e5d97d0 100755
+--- a/init_buildsystem
++++ b/init_buildsystem
+@@ -124,6 +124,7 @@ clean_build_root()
+ 	    rm -rf -- "$BUILD_ROOT/.build"
+ 	    rm -rf -- "$BUILD_ROOT/.root"
+ 	    rm -rf -- "$BUILD_ROOT/.init_b_cache"
++	    rm -f -- $BUILD_ROOT/.srcfiles.cache*
+ 	    rm -rf -- "$BUILD_ROOT/.preinstall_image/*"
+ 	    rm -rf -- "$BUILD_ROOT/.preinstallimage"*
+ 	    mkdir -p "$BUILD_ROOT/proc"
+-- 
+1.7.1
--- build-2012.09.12.orig/debian/patches/0010-Split-build_arch-as-individual-arch-while-checking-e.patch
+++ build-2012.09.12/debian/patches/0010-Split-build_arch-as-individual-arch-while-checking-e.patch
@@ -0,0 +1,32 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+##
+##
+
+@DPATCH@
+
+From 2bc76a5f2bc9f79bffe8fc936a50f202d4d56be1 Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Mon, 10 Sep 2012 06:41:46 +0800
+Subject: [PATCH 10/10] Split build_arch as individual arch while checking emulator arch
+
+BUILD_ARCH maybe several archs sep by ":", so BUILD_ARCH should be
+splitted before checking emulator arch
+---
+ common_functions |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/common_functions b/common_functions
+index 9eb437d..1708f34 100755
+--- a/common_functions
++++ b/common_functions
+@@ -46,7 +46,7 @@ is_emulator_arch()
+ {
+     local arch
+     for arch in $EMULATOR_ARCHS; do
+-	if test "$BUILD_ARCH" = "$arch" -a "$BUILD_HOST_ARCH" != "$arch"; then
++	if echo $BUILD_ARCH:|sed -n 's/:/\n/gp'|grep -q "^$arch$" && test "$BUILD_HOST_ARCH" != "$arch"; then
+ 	    return 0
+ 	fi
+     done
+-- 
+1.7.1
--- build-2012.09.12.orig/debian/patches/0009-Refinement-about-interactive-interface.patch
+++ build-2012.09.12/debian/patches/0009-Refinement-about-interactive-interface.patch
@@ -0,0 +1,30 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+##
+##
+
+@DPATCH@
+
+From 5f8e683d5db4433f5e1619a597ecbe5bfe8bfc15 Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Mon, 10 Sep 2012 06:40:55 +0800
+Subject: [PATCH 09/10] Refinement about interactive interface
+
+---
+ build |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/build b/build
+index 9b7732c..e8a8867 100755
+--- a/build
++++ b/build
+@@ -1429,7 +1429,7 @@ if test -n "$LOGFILE" -a -z "$shell" ; then
+ 	exec 1> >(exec -a 'build logging' perl -e 'open(F,">>",$ARGV[0])||die("$ARGV[0]: $!\n");$|=1;select(F);$|=1;while(<STDIN>){my $p=sprintf("[%5ds] ", time()-'$STARTTIME');print STDOUT $p.$_;s/^\r//s;s/\r\n/\n/gs;print F $p.$_}' $LOGFILE) 2>&1
+     else
+         # plain chroot
+-	exec 1> >(exec -a 'build logging' perl -e 'open(F,">>",$ARGV[0])||die("$ARGV[0]: $!\n");$|=1;select(F);$|=1;while(<STDIN>){my $p=sprintf("[%5ds] ", time()-'$STARTTIME');print STDOUT $p.$_;print F $p.$_}' $LOGFILE) 2>&1
++	exec 1> >(exec -a 'build logging' perl -e ' use IO::Handle;open(F,">>",$ARGV[0])||die("$ARGV[0]: $!\n");F->autoflush(1);;$|=1;select(F);$|=1;while(<STDIN>){my $p=sprintf("[%5ds] ", time()-'$STARTTIME');my $info = $_ ; $info =~ s/\n// if ($info =~ m#^\[y/N/c\] $#); print STDOUT $p.$info;print F $p.$info};$|=1' $LOGFILE) 2>&1
+     fi
+ fi
+ 
+-- 
+1.7.1
--- build-2012.09.12.orig/debian/patches/0008-reused-cached-repo-data-file-to-speed-up-building.patch
+++ build-2012.09.12/debian/patches/0008-reused-cached-repo-data-file-to-speed-up-building.patch
@@ -0,0 +1,92 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+##
+##
+
+@DPATCH@
+
+From 2bfaaa0c9b460db5b672cb8270f3fb2e2818f081 Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Tue, 28 Aug 2012 15:40:05 +0800
+Subject: [PATCH 08/10] reused cached repo data file to speed up building
+
+checksum and size is checked before trying to resuse it. #279
+---
+ createrepomddeps |   30 ++++++++++++++++++++++++++++--
+ 1 files changed, 28 insertions(+), 2 deletions(-)
+
+diff --git a/createrepomddeps b/createrepomddeps
+index b3d8593..cc9b2b0 100755
+--- a/createrepomddeps
++++ b/createrepomddeps
+@@ -34,9 +34,13 @@ my $repomdparser = {
+   repomd => {
+     data => {
+       _start => \&repomd_handle_data_start,
++      _end => \&repomd_handle_data_end,
+       location => {
+ 	_start => \&repomd_handle_location,
+       },
++      size => {
++	_text => \&repomd_handle_size,
++      },
+     },
+   },
+ };
+@@ -72,6 +76,7 @@ my $primaryparser = {
+ # [ [tag, \%], ... ]
+ my @cursor = ();
+ 
++my %datafile;
+ sub repomd_handle_data_start
+ {
+   my $p = shift;
+@@ -83,6 +88,14 @@ sub repomd_handle_data_start
+   }
+ }
+ 
++sub repomd_handle_data_end
++{
++  my $p = shift;
++  my $el = shift;
++  push @primaryfiles, {%datafile};
++}
++
++
+ sub repomd_handle_location
+ {
+   my $p = shift;
+@@ -90,9 +103,16 @@ sub repomd_handle_location
+ 
+   my $attr = map_attrs(@_);
+   if(exists $attr->{'href'}) {
+-    push @primaryfiles, { location => $attr->{'href'} };
++    $datafile{location} = $attr->{'href'};
+   }
+ }
++sub repomd_handle_size
++{
++  my $p = shift;
++  my $el = shift;
++  $datafile{size} = $el;
++}
++
+ 
+ sub generic_handle_start
+ {
+@@ -421,7 +441,13 @@ for my $url (@ARGV) {
+     @cursor = ([undef, $primaryparser]);
+ 
+     my $u = $dir . $f->{'location'};
+-    if ($url =~ /^http[s]?:\/\/([^\/]*)\/?/) {
++    my $size = 0;
++    my $cached = 0;
++    if ( -e $u ) {
++        $size = (stat($u))[7];
++        $cached = 1 if ($f->{'size'} == $size);
++    }
++    if ($url =~ /^http[s]?:\/\/([^\/]*)\/?/ and !$cached) {
+         if (system($INC[0].'/download', $dir . "repodata/", $baseurl . "repodata/" . basename($u))) {
+ 	  die("download failed\n");
+ 	}
+-- 
+1.7.1
--- build-2012.09.12.orig/debian/patches/0011-incremental-build-support-short-circuit-and-no-topdi.patch
+++ build-2012.09.12/debian/patches/0011-incremental-build-support-short-circuit-and-no-topdi.patch
@@ -0,0 +1,105 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+##
+##
+
+@DPATCH@
+
+From 77ec67b8acb04630403b1386998bbf9125edbe46 Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Thu, 20 Sep 2012 12:53:12 +0800
+Subject: [PATCH 11/11] incremental build support --short-circuit and -no-topdir-cleanup
+
+---
+ build |   49 ++++++++++++++++++++++++++++++++++++++-----------
+ 1 files changed, 38 insertions(+), 11 deletions(-)
+
+diff --git a/build b/build
+index e8a8867..2fe808d 100755
+--- a/build
++++ b/build
+@@ -54,6 +54,7 @@ ABUILD_GID=399
+ DO_INIT=true
+ DO_LINT=
+ DO_CHECKS=true
++SHORT_CIRCUIT=false
+ CLEAN_BUILD=
+ USE_SYSTEM_QEMU=
+ SPECFILES=()
+@@ -1037,6 +1038,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"
+       ;;
+@@ -2009,11 +2016,12 @@ 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 [ -z "$NO_TOPDIR_CLEANUP" ]; 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
+ 
+@@ -2188,7 +2196,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"
+@@ -2211,11 +2219,30 @@ 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
++            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.1
--- build-2012.09.12.orig/debian/patches/0006-pass-use-system-qemu-option-to-init_buildsystem.patch
+++ build-2012.09.12/debian/patches/0006-pass-use-system-qemu-option-to-init_buildsystem.patch
@@ -0,0 +1,30 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+##
+##
+
+@DPATCH@
+
+From ce1fbb11f9a7fd7ba76957966ea39dd7625e08ab Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Sun, 12 Aug 2012 15:33:11 +0800
+Subject: [PATCH 6/6] pass --use-system-qemu option to init_buildsystem
+
+---
+ build |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/build b/build
+index 8f61a81..8241342 100755
+--- a/build
++++ b/build
+@@ -906,7 +906,7 @@ while test -n "$1"; do
+ 	CREATE_BASELIBS=internal
+ 	;;
+       *-use-system-qemu)
+-	USE_SYSTEM_QEMU=true
++        USE_SYSTEM_QEMU="--use-system-qemu"
+       ;;
+       *-root)
+ 	needarg
+-- 
+1.7.1
--- build-2012.09.12.orig/debian/patches/0007-remove-n-option-to-make-echo-always-flush-info-to-st.patch
+++ build-2012.09.12/debian/patches/0007-remove-n-option-to-make-echo-always-flush-info-to-st.patch
@@ -0,0 +1,30 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+##
+##
+
+@DPATCH@
+
+From 79944c95c5e7d0775dc9c4f664c9c13070776a1c Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Mon, 20 Aug 2012 16:01:16 +0800
+Subject: [PATCH 7/7] remove -n option to make echo always flush info to stdout
+
+---
+ init_buildsystem |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/init_buildsystem b/init_buildsystem
+index e5d97d0..6fcbb35 100755
+--- a/init_buildsystem
++++ b/init_buildsystem
+@@ -593,7 +593,7 @@ if test -e $BUILD_IS_RUNNING ; then
+     echo "y - yes, cleanup the build root"
+     echo "N - No, abort build (default on enter)"
+     echo "c - Continue anyway with this build root"
+-    echo -n "[y/N/c] "
++    echo "[y/N/c] "
+     read ANSWER
+     case "$ANSWER" in
+ 	c|C) rm -f $BUILD_IS_RUNNING ;;
+-- 
+1.7.1
--- build-2012.09.12.orig/debian/patches/0002-Ignore-rpm-signature-checking.patch
+++ build-2012.09.12/debian/patches/0002-Ignore-rpm-signature-checking.patch
@@ -0,0 +1,38 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+##
+##
+
+@DPATCH@
+
+From 3fa75aa86fcd48cd4b8494fbfd312b15d049a0a8 Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Thu, 19 Apr 2012 15:48:59 +0800
+Subject: [PATCH 2/5] Ignore rpm signature checking
+
+---
+ init_buildsystem |   10 ----------
+ 1 files changed, 0 insertions(+), 10 deletions(-)
+
+diff --git a/init_buildsystem b/init_buildsystem
+index c3773a8..5f61952 100755
+--- a/init_buildsystem
++++ b/init_buildsystem
+@@ -535,16 +535,6 @@ downloadpkg()
+ 	    echo "expected $destfile after download but it's missing" >&2
+ 	    cleanup_and_exit 1
+ 	fi
+-	case $destfile in
+-	  *.rpm)
+-	    rpm -K "$destfile" > $destfile.v || { echo "rpm verify failed" >&2; rm -rf "$destdir"; cleanup_and_exit 1; }
+-	    if grep "NOT OK" $destfile.v; then
+-		rm -rf "$destdir"
+-		cleanup_and_exit 1
+-	    fi
+-	    rm -f "$destfile.v"
+-	    ;;
+-	esac
+ 	mv "$destfile" "$SRC" || cleanup_and_exit 1
+     fi
+ }
+-- 
+1.7.1
--- build-2012.09.12.orig/debian/patches/00list
+++ build-2012.09.12/debian/patches/00list
@@ -0,0 +1,11 @@
+0001-Refine-download-progress-info.patch
+0002-Ignore-rpm-signature-checking.patch
+0003-https-repo-support.patch
+0004-remove-cachefile-if-clean-specified.patch
+0005-hide-passwords.patch
+0006-pass-use-system-qemu-option-to-init_buildsystem.patch
+0007-remove-n-option-to-make-echo-always-flush-info-to-st.patch
+0008-reused-cached-repo-data-file-to-speed-up-building.patch
+0009-Refinement-about-interactive-interface.patch
+0010-Split-build_arch-as-individual-arch-while-checking-e.patch
+0011-incremental-build-support-short-circuit-and-no-topdi.patch
--- build-2012.09.12.orig/debian/patches/0005-hide-passwords.patch
+++ build-2012.09.12/debian/patches/0005-hide-passwords.patch
@@ -0,0 +1,109 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+##
+##
+
+@DPATCH@
+
+From 160a548ff79b0476fc98e1304570e16608f22a79 Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Sun, 19 Aug 2012 14:23:28 +0800
+Subject: [PATCH 5/6] hide passwords
+
+---
+ build    |   21 +++++++++++++++++++++
+ download |   27 ++++++++++++++++++++++++---
+ 2 files changed, 45 insertions(+), 3 deletions(-)
+
+diff --git a/build b/build
+index 67368e1..f319087 100755
+--- a/build
++++ b/build
+@@ -739,6 +739,26 @@ linux64()
+ 	perl -e 'syscall('$PERSONALITY_SYSCALL', 0); exec(@ARGV) || die("$ARGV[0]: $!\n")' "$@"
+ }
+ 
++
++hide_passwords()
++{
++    local i j
++    r=()
++    rm -f $HOME/.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 >> $HOME/.repo.config
++            j=$(echo $i | sed -e "s#://[^@]*@#://#")
++            r=("${r[@]}" "$j")
++        fi
++    done
++    repos=("${r[@]}")
++    echo ${repos[@]}
++}
++
++
+ check_for_ppc()
+ {
+     local uname
+@@ -1116,6 +1136,7 @@ while test -n "$1"; do
+ done
+ 
+ check_for_ppc
++hide_passwords
+ 
+ if test "$VM_TYPE" = "lxc"; then
+     VM_IMAGE=''
+diff --git a/download b/download
+index 93ed595..9383156 100755
+--- a/download
++++ b/download
+@@ -22,6 +22,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);
+@@ -32,7 +33,27 @@ for my $url (@ARGV) {
+     $url =~ s/^zypp:\/\/[^\/]*\/*//;
+     $url = URI->new($u.$url)
+   } else {
+-    $url = URI->new($url);
++    my $found = 0;
++    if ( -e $ENV{HOME} . "/.repo.config" ) {
++        open FILE, "<", $ENV{HOME} . "/.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);
+@@ -42,8 +63,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 "reqesting $url failed: ".$res->status_line."\n" unless $retry && $res->previous;
+-    warn "retrying $url\n";
++    die "reqesting $original failed: ".$res->status_line."\n" unless $retry && $res->previous;
++    warn "retrying $original\n";
+   }
+ }
+ 
+-- 
+1.7.1
--- build-2012.09.12.orig/debian/patches/0003-https-repo-support.patch
+++ build-2012.09.12/debian/patches/0003-https-repo-support.patch
@@ -0,0 +1,69 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+##
+##
+
+@DPATCH@
+
+From e71346f9780ff26d3317095517abcbedf2d9867e Mon Sep 17 00:00:00 2001
+From: Zhang Qiang <qiang.z.zhang@intel.com>
+Date: Sat, 11 Aug 2012 07:55:40 +0800
+Subject: [PATCH 3/5] https repo support
+
+---
+ createrepomddeps |    4 ++--
+ download         |    4 +++-
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/createrepomddeps b/createrepomddeps
+index 5273c7b..b3d8593 100755
+--- a/createrepomddeps
++++ b/createrepomddeps
+@@ -396,7 +396,7 @@ for my $url (@ARGV) {
+     } else {
+       die "unsupported repo type: $type\n";
+     }
+-  } elsif ($url =~ /^http:\/\/([^\/]*)\/?/) {
++  } elsif ($url =~ /^http[s]?:\/\/([^\/]*)\/?/) {
+     my $repoid = md5_hex($url);
+     $dir = "$cachedir/$repoid/";
+     $baseurl = $url;
+@@ -421,7 +421,7 @@ for my $url (@ARGV) {
+     @cursor = ([undef, $primaryparser]);
+ 
+     my $u = $dir . $f->{'location'};
+-    if ($url =~ /^http:\/\/([^\/]*)\/?/) {
++    if ($url =~ /^http[s]?:\/\/([^\/]*)\/?/) {
+         if (system($INC[0].'/download', $dir . "repodata/", $baseurl . "repodata/" . basename($u))) {
+ 	  die("download failed\n");
+ 	}
+diff --git a/download b/download
+index 8b75ebf..93ed595 100755
+--- a/download
++++ b/download
+@@ -1,6 +1,8 @@
+ #!/usr/bin/perl -w
+ 
++use Net::SSL ();
+ BEGIN {
++  $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0,
+   unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
+ }
+ 
+@@ -17,7 +19,6 @@ my $dir = shift @ARGV;
+ 
+ my $ua = LWP::UserAgent->new(
+   agent => "openSUSE build script",
+-  env_proxy => 1,
+   timeout => 42);
+ 
+ for my $url (@ARGV) {
+@@ -33,6 +34,7 @@ for my $url (@ARGV) {
+   } else {
+     $url = URI->new($url);
+   }
++  $ua->env_proxy  if $url->scheme ne 'https';
+   my $dest = "$dir/".basename($url->path);
+   unlink($dest);	# just in case
+   my $retry = 3;
+-- 
+1.7.1
