~ubuntu-branches/ubuntu/vivid/dpkg/vivid

« back to all changes in this revision

Viewing changes to scripts/t/910_merge_changelogs.t

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2014-04-21 18:14:10 UTC
  • mfrom: (1.6.8 sid)
  • Revision ID: package-import@ubuntu.com-20140421181410-94kvb2zodjd2og32
Tags: 1.17.7ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - Allow -fstack-protector on arm64 now that GCC and glibc support it.
  - Change native source version/format mismatch errors into warnings
    until the dust settles on Debian bug 737634 about override options.
  - Add DPKG_UNTRANSLATED_MESSAGES environment check so that higher-level
    tools can get untranslated dpkg terminal log messages while at the
    same time having translated debconf prompts.
  - Special-case arm{el,hf} ELF objects in Shlibs/Objdump.pm for multilib.
  - Map unqualified package names of multiarch-same packages to the native
    arch instead of throwing an error, so that we don't break on upgrade
    when there are unqualified names stored in the dpkg trigger database.
  - Add logic to the postinst to `dpkg --add-architecture i386' on new
    installs on amd64, mimicking our previous behaviour with the conffile.
  - Apply a workaround from mvo to consider RC packages as multiarch,
    during the dpkg consistency checks. (see LP: 1015567 and 1057367).
* Drop obsolete migration code and guards from pre-trusty dpkg versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
#
3
 
# This program is free software; you can redistribute it and/or modify
4
 
# it under the terms of the GNU General Public License as published by
5
 
# the Free Software Foundation; either version 2 of the License, or
6
 
# (at your option) any later version.
7
 
#
8
 
# This program is distributed in the hope that it will be useful,
9
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
# GNU General Public License for more details.
12
 
#
13
 
# You should have received a copy of the GNU General Public License
14
 
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
15
 
 
16
 
use strict;
17
 
use warnings;
18
 
 
19
 
use Test::More tests => 3;
20
 
 
21
 
use Dpkg::IPC;
22
 
use File::Spec;
23
 
use File::Compare;
24
 
use File::Temp qw(tempfile);
25
 
 
26
 
my $srcdir = $ENV{srcdir} || '.';
27
 
my $datadir = "$srcdir/t/910_merge_changelogs";
28
 
 
29
 
my $res;
30
 
sub test_merge {
31
 
    my ($expected_file, @options) = @_;
32
 
    my ($fh, $filename) = tempfile();
33
 
    spawn(exec => ["$srcdir/dpkg-mergechangelogs.pl", @options],
34
 
          to_handle => $fh, error_to_file => '/dev/null',
35
 
          wait_child => 1, nocheck => 1);
36
 
    my $res = compare($expected_file, $filename);
37
 
    if ($res) {
38
 
        system("diff -u $expected_file $filename >&2");
39
 
    }
40
 
    ok($res == 0, "merged changelog matches expected one ($expected_file)");
41
 
    unlink($filename);
42
 
}
43
 
 
44
 
my $has_alg_merge = 1;
45
 
eval 'use Algorithm::Merge;';
46
 
if ($@) {
47
 
    $has_alg_merge = 0;
48
 
}
49
 
 
50
 
my @input = ("$datadir/ch-old", "$datadir/ch-a", "$datadir/ch-b");
51
 
if ($has_alg_merge) {
52
 
    test_merge("$datadir/ch-merged", @input);
53
 
    test_merge("$datadir/ch-merged-pr", '-m', @input);
54
 
} else {
55
 
    test_merge("$datadir/ch-merged-basic", @input);
56
 
    test_merge("$datadir/ch-merged-pr-basic", '-m', @input);
57
 
}
58
 
test_merge("$datadir/ch-badver-merged",  ("$datadir/ch-badver-old",
59
 
    "$datadir/ch-badver-a", "$datadir/ch-badver-b"));