--- build-20150115.orig/.gbp.conf
+++ build-20150115/.gbp.conf
@@ -0,0 +1,15 @@
+[DEFAULT]
+upstream-tag = upstream/%(version)s
+patch-export = True
+patch-export-ignore-path = (.gbp.conf|.gbs.conf|packaging/.*|debian/.*|.gitignore)
+packaging-dir = packaging
+#packaging-tag = tizen/%(upstreamversion)s-%(nowtime)s
+
+[git-buildpackage]
+upstream-tag = upstream/%(version)s
+
+[git-dch]
+upstream-tag = upstream/%(version)s
+
+[gbp-pq-rpm]
+pq-branch = patch-queue/%(branch)s
--- build-20150115.orig/Build/Rpmmd.pm
+++ build-20150115/Build/Rpmmd.pm
@@ -169,7 +169,7 @@
   return if $dep =~ /^rpmlib\(/;
   if(exists $attr{'flags'}) {
     my $evr = $attr{'ver'};
-    return unless defined($evr) && exists($flagmap{$attr{'flags'}});
+    #return unless defined($evr) && exists($flagmap{$attr{'flags'}});
     $evr = "$attr{'epoch'}:$evr" if $attr{'epoch'};
     $evr .= "-$attr{'rel'}" if defined $attr{'rel'};
     $dep .= " $flagmap{$attr{'flags'}} $evr";
--- build-20150115.orig/createdirdeps
+++ build-20150115/createdirdeps
@@ -85,7 +85,7 @@
 	}
       }
     }
-    my $q = Build::query($path, 'addselfprovides' => 1, 'conflicts' => 1, 'evra' => 1, 'buildtime' => 1);
+    my $q = Build::query($path, 'addselfprovides' => 1, 'conflicts' => 1, 'evra' => 1, 'buildtime' => 1, 'alldeps' => 1);
     next unless $q && defined($q->{'name'}) && defined($q->{'arch'}) && defined($q->{'version'});
     my $idx = "$q->{'name'}.$q->{'arch'}-$id";
     next if $seen{$idx};
--- build-20150115.orig/createrepomddeps
+++ build-20150115/createrepomddeps
@@ -33,6 +33,8 @@
 use Digest::MD5 ();
 use File::Path qw(mkpath rmtree);
 use File::Basename;
+use IPC::SysV qw(IPC_PRIVATE S_IRUSR S_IWUSR IPC_CREAT IPC_EXCL SEM_UNDO);
+use IPC::Semaphore;
 
 Getopt::Long::Configure("no_ignore_case");
 
@@ -87,7 +89,20 @@
     $dir = "$cachedir/$repoid/";
     $baseurl .= '/' unless $baseurl =~ /\/$/;
     mkpath("${dir}repodata");
-    system($INC[0].'/download', "${dir}repodata", "${baseurl}repodata/repomd.xml");
+    my $sem;
+    my $key = IPC::SysV::ftok($dir, '1');
+    if ($sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL)) {
+      $sem->setval(0, 1);
+    } else {
+      $sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT);
+    }
+
+    $sem->op(0, -1, SEM_UNDO);
+    if (!-f "${dir}repodata/repomd.xml") {
+      system($INC[0].'/download', "${dir}repodata", "${baseurl}repodata/repomd.xml");
+    }
+    $sem->op(0, 1, SEM_UNDO);
+    $sem->remove();
   } else {
     $dir = $url;
   }
@@ -111,6 +126,14 @@
       utf8::downgrade($u);
     }
     my $cached;
+    my $sem;
+    my $key = IPC::SysV::ftok("${dir}repodata/", '1');
+    if ($sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL)) {
+      $sem->setval(0, 1);
+    } else {
+      $sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT);
+    }
+    $sem->op(0, -1, SEM_UNDO);
     if (-e $u) {
       $cached = 1;
       $cached = 0 if exists($f->{'size'}) && $f->{'size'} != (-s _);
@@ -126,6 +149,9 @@
 	die("inconsistent repodata in $url\n");
       }
     }
+    $sem->op(0, 1, SEM_UNDO);
+    $sem->remove();
+
     my $fh;
     open($fh, '<', $u) or die "Error opening $u: $!\n";
     if ($u =~ /\.gz$/) {
--- build-20150115.orig/debian/control
+++ build-20150115/debian/control
@@ -10,7 +10,7 @@
 Depends: ${perl:Depends},
   rpm,
   libxml-parser-perl,
-  libcrypt-ssleay-perl (= 0.64-tizen20130308),
+  libcrypt-ssleay-perl (>= 0.64-tizen20130308),
   binfmt-support,
   tizen-qemu-arm-static-2013.12.12
 Recommends: rpm2cpio
--- build-20150115.orig/init_buildsystem
+++ build-20150115/init_buildsystem
@@ -208,6 +208,7 @@
     else
 	unsafe_preinstall_check
 	CPIO="cpio --extract --unconditional --preserve-modification-time --make-directories --no-absolute-filenames --quiet"
+	cpio --help 2>/dev/null | grep -q -e --extract-over-symlinks && CPIO="$CPIO --extract-over-symlinks"
 	TAR="tar -x"
     fi
     pkg_preinstall
--- build-20150115.orig/packaging/build.spec
+++ build-20150115/packaging/build.spec
@@ -136,7 +136,7 @@
 make CFLAGS="$RPM_BUILD_FLAGS" initvm-all
 
 %if 0%{?fedora} == 23
-cp -f find-debuginfo.sh /usr/lib/rpm/find-debuginfo.sh
+%global debug_package %{nil}
 %endif
 
 %install
