From d827c6cf1631209f5042a9d1d8a7ecc24223c8a0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 23:06:40 +0200 Subject: Adding upstream version 13.11.4. Signed-off-by: Daniel Baumann --- .../01-868204-ignore-broken-symlinks.t | 30 +++++++++ t/dh_installdocs/debian/changelog | 5 ++ t/dh_installdocs/debian/control | 21 ++++++ t/dh_installdocs/debian/copyright | 1 + t/dh_installdocs/debian/docfile | 1 + t/dh_installdocs/dh_installdocs.t | 75 ++++++++++++++++++++++ 6 files changed, 133 insertions(+) create mode 100755 t/dh_installdocs/01-868204-ignore-broken-symlinks.t create mode 100644 t/dh_installdocs/debian/changelog create mode 100644 t/dh_installdocs/debian/control create mode 100644 t/dh_installdocs/debian/copyright create mode 100644 t/dh_installdocs/debian/docfile create mode 100755 t/dh_installdocs/dh_installdocs.t (limited to 't/dh_installdocs') diff --git a/t/dh_installdocs/01-868204-ignore-broken-symlinks.t b/t/dh_installdocs/01-868204-ignore-broken-symlinks.t new file mode 100755 index 0000000..b9801d2 --- /dev/null +++ b/t/dh_installdocs/01-868204-ignore-broken-symlinks.t @@ -0,0 +1,30 @@ +#!/usr/bin/perl +use strict; +use warnings; +use Test::More; + +use File::Basename qw(dirname); +use lib dirname(dirname(__FILE__)); +use Test::DH; +use File::Path qw(remove_tree make_path); +use Debian::Debhelper::Dh_Lib qw(!dirname); + +plan(tests => 1); + +each_compat_subtest { + my ($compat) = @_; + # #868204 - dh_installdocs did not replace dangling symlink + make_path('debian/debhelper/usr/share/doc/debhelper'); + make_symlink_raw_target('../to/nowhere/bar', + 'debian/debhelper/usr/share/doc/debhelper/README.Debian'); + create_empty_file('debian/README.Debian'); + + ok(-l 'debian/debhelper/usr/share/doc/debhelper/README.Debian'); + ok(!-e 'debian/debhelper/usr/share/doc/debhelper/README.Debian'); + + ok(run_dh_tool('dh_installdocs')); + ok(!-l 'debian/debhelper/usr/share/doc/debhelper/README.Debian', "#868204 [${compat}]"); + ok(-f 'debian/debhelper/usr/share/doc/debhelper/README.Debian', "#868204 [${compat}]"); + remove_tree('debian/debhelper', 'debian/tmp'); +}; + diff --git a/t/dh_installdocs/debian/changelog b/t/dh_installdocs/debian/changelog new file mode 100644 index 0000000..5850f0e --- /dev/null +++ b/t/dh_installdocs/debian/changelog @@ -0,0 +1,5 @@ +foo (1.0-1) unstable; urgency=low + + * Initial release. (Closes: #XXXXXX) + + -- Test Mon, 11 Jul 2016 18:10:59 +0200 diff --git a/t/dh_installdocs/debian/control b/t/dh_installdocs/debian/control new file mode 100644 index 0000000..7e9a228 --- /dev/null +++ b/t/dh_installdocs/debian/control @@ -0,0 +1,21 @@ +Source: foo +Section: misc +Priority: optional +Maintainer: Test +Rules-Requires-Root: no +Standards-Version: 3.9.8 + +Package: foo +Architecture: all +Description: package foo + Package foo + +Package: bar +Architecture: all +Description: package bar + Package bar + +Package: baz +Architecture: all +Description: package baz + Package baz diff --git a/t/dh_installdocs/debian/copyright b/t/dh_installdocs/debian/copyright new file mode 100644 index 0000000..7e6ffb0 --- /dev/null +++ b/t/dh_installdocs/debian/copyright @@ -0,0 +1 @@ +Some test copyright file diff --git a/t/dh_installdocs/debian/docfile b/t/dh_installdocs/debian/docfile new file mode 100644 index 0000000..2719eec --- /dev/null +++ b/t/dh_installdocs/debian/docfile @@ -0,0 +1 @@ +This file must not be empty, or dh_installdocs won't install it. diff --git a/t/dh_installdocs/dh_installdocs.t b/t/dh_installdocs/dh_installdocs.t new file mode 100755 index 0000000..64f1254 --- /dev/null +++ b/t/dh_installdocs/dh_installdocs.t @@ -0,0 +1,75 @@ +#!/usr/bin/perl +use strict; +use warnings; +use Test::More; + + +use File::Path qw(remove_tree); +use File::Basename qw(dirname); +use lib dirname(dirname(__FILE__)); +use Test::DH; + +our @TEST_DH_EXTRA_TEMPLATE_FILES = (qw( + debian/changelog + debian/control + debian/docfile + debian/copyright +)); + +plan(tests => 5); + + +my $NODOC_PROFILE = { + 'env' => { + 'DEB_BUILD_PROFILES' => 'nodoc', + }, +}; + +my $doc = "debian/docfile"; + +each_compat_subtest { + ok(run_dh_tool('dh_installdocs', '-pbar', $doc)); + ok(-e "debian/bar/usr/share/doc/bar/docfile"); + remove_tree(qw(debian/foo debian/bar debian/baz)); +}; + +each_compat_subtest { + #regression in debhelper 9.20160702 (#830309) + ok(run_dh_tool('dh_installdocs', '-pbaz', '--link-doc=foo', $doc)); + + ok(-l "debian/baz/usr/share/doc/baz"); + ok(readlink("debian/baz/usr/share/doc/baz") eq 'foo'); + ok(-e "debian/baz/usr/share/doc/foo/docfile"); + remove_tree(qw(debian/foo debian/bar debian/baz)); +}; + +each_compat_subtest { + ok(run_dh_tool('dh_installdocs', '-pfoo', '--link-doc=bar', $doc)); + + ok(-l "debian/foo/usr/share/doc/foo"); + ok(readlink("debian/foo/usr/share/doc/foo") eq 'bar'); + ok(-e "debian/foo/usr/share/doc/bar/docfile"); + remove_tree(qw(debian/foo debian/bar debian/baz)); +}; + +# ... and with nodoc + +each_compat_subtest { + # docs are ignored, but copyright file is still there + ok(run_dh_tool($NODOC_PROFILE, 'dh_installdocs', $doc)); + for my $pkg (qw(foo bar baz)) { + ok(! -e "debian/$pkg/usr/share/doc/$pkg/docfile"); + ok(-e "debian/$pkg/usr/share/doc/$pkg/copyright"); + } + remove_tree(qw(debian/foo debian/bar debian/baz)); +}; + +each_compat_subtest { + # docs are ignored, but symlinked doc dir is still there + ok(run_dh_tool($NODOC_PROFILE, 'dh_installdocs', '-pfoo', '--link-doc=bar', $doc)); + ok(-l "debian/foo/usr/share/doc/foo"); + ok(readlink("debian/foo/usr/share/doc/foo") eq 'bar'); + ok(! -e "debian/foo/usr/share/doc/bar/docfile"); + remove_tree(qw(debian/foo debian/bar debian/baz)); +}; + -- cgit v1.2.3