--- /usr/share/perl5/Dpkg/Source/Package/V2.pm.orig	2018-02-04 14:37:17.568686018 +0100
+++ /usr/share/perl5/Dpkg/Source/Package/V2.pm	2018-02-04 14:40:54.324192770 +0100
@@ -563,35 +563,58 @@
             $self->register_error();
         }
     };
+    
+    # Identify original tarballs
+    my ($tarfile, %addonfile);
+    my $comp_ext_regex = compression_get_file_extension_regex();
+    my @origtarballs;
 
-    # Create a patch
-    my $autopatch = File::Spec->catfile($dir, 'debian', 'patches',
-                                        $self->get_autopatch_name());
-    my $tmpdiff = $self->_generate_patch($dir, order_from => $autopatch,
-                                        header_from => $autopatch,
-                                        handle_binary => $handle_binary,
-                                        skip_auto => $self->{options}{auto_commit},
-                                        usage => 'build');
-    unless (-z $tmpdiff or $self->{options}{auto_commit}) {
-        info(g_('you can integrate the local changes with %s'),
-             'dpkg-source --commit');
-        error(g_('aborting due to unexpected upstream changes, see %s'),
-              $tmpdiff);
+    foreach my $file (sort $self->find_original_tarballs()) {
+        if ($file =~ /\.orig\.tar\.$comp_ext_regex$/) {
+            if (defined($tarfile)) {
+                error(g_('several orig.tar files found (%s and %s) but only ' .
+                         'one is allowed'), $tarfile, $file);
+            }
+            $tarfile = $file;
+            push @origtarballs, $file;
+            $self->add_file($file);
+            $self->add_file("$file.asc") if -e "$file.asc";
+        } elsif ($file =~ /\.orig-([[:alnum:]-]+)\.tar\.$comp_ext_regex$/) {
+            $addonfile{$1} = $file;
+            push @origtarballs, $file;
+            $self->add_file($file);
+            $self->add_file("$file.asc") if -e "$file.asc";
+        }
     }
-    push_exit_handler(sub { unlink($tmpdiff) });
+
+    # Create a patch
+#    my $autopatch = File::Spec->catfile($dir, 'debian', 'patches',
+#                                        $self->get_autopatch_name());
+#    my $tmpdiff = $self->_generate_patch($dir, order_from => $autopatch,
+#                                        header_from => $autopatch,
+#                                        handle_binary => $handle_binary,
+#                                        skip_auto => $self->{options}{auto_commit},
+#                                        usage => 'build');
+#    unless (-z $tmpdiff or $self->{options}{auto_commit}) {
+#        info(g_('you can integrate the local changes with %s'),
+#             'dpkg-source --commit');
+#        error(g_('aborting due to unexpected upstream changes, see %s'),
+#              $tmpdiff);
+#    }
+#    push_exit_handler(sub { unlink($tmpdiff) });
     $binaryfiles->update_debian_source_include_binaries() if $include_binaries;
 
-    # Install the diff as the new autopatch
-    if ($self->{options}{auto_commit}) {
-        make_path(File::Spec->catdir($dir, 'debian', 'patches'));
-        $autopatch = $self->register_patch($dir, $tmpdiff,
-                                           $self->get_autopatch_name());
-        info(g_('local changes have been recorded in a new patch: %s'),
-             $autopatch) if -e $autopatch;
-        rmdir(File::Spec->catdir($dir, 'debian', 'patches')); # No check on purpose
-    }
-    unlink($tmpdiff) or syserr(g_('cannot remove %s'), $tmpdiff);
-    pop_exit_handler();
+#    # Install the diff as the new autopatch
+#    if ($self->{options}{auto_commit}) {
+#        make_path(File::Spec->catdir($dir, 'debian', 'patches'));
+#        $autopatch = $self->register_patch($dir, $tmpdiff,
+#                                           $self->get_autopatch_name());
+#        info(g_('local changes have been recorded in a new patch: %s'),
+#             $autopatch) if -e $autopatch;
+#        rmdir(File::Spec->catdir($dir, 'debian', 'patches')); # No check on purpose
+#    }
+#    unlink($tmpdiff) or syserr(g_('cannot remove %s'), $tmpdiff);
+#    pop_exit_handler();
 
     # Create the debian.tar
     my $debianfile = "$basenamerev.debian.tar." . $self->{options}{comp_ext};
