Merge lp:~debfx/ubuntu/precise/pkgbinarymangler/dependency-cycle into lp:ubuntu/precise/pkgbinarymangler

Proposed by Felix Geyer
Status: Merged
Merged at revision: 237
Proposed branch: lp:~debfx/ubuntu/precise/pkgbinarymangler/dependency-cycle
Merge into: lp:ubuntu/precise/pkgbinarymangler
Diff against target: 74 lines (+46/-0)
3 files modified
debian/changelog (+10/-0)
pkgstripfiles (+1/-0)
test/run (+35/-0)
To merge this branch: bzr merge lp:~debfx/ubuntu/precise/pkgbinarymangler/dependency-cycle
Reviewer Review Type Date Requested Status
Martin Pitt Approve
Dave Walker (community) Approve
Review via email: mp+90602@code.launchpad.net

Description of the change

  * pkgstripfiles, symlink_doc(): Don't create symlinks that would point to
    the same package. (LP: #923343)
  * test/run: Add test_doc_symlink_dependency_cycle() to make sure that
    pkgstripfiles works correctly when there is a dependency cycle inside
    a source package.

To post a comment you must log in.
Revision history for this message
Dave Walker (davewalker) wrote :

pkgstripfiles change looks good and simple.. the Test looks valid.. Happy to upload if you can confirm it's ready..

Thanks.

review: Approve
Revision history for this message
Martin Pitt (pitti) wrote :

This looks fine to me, thank you!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-01-13 16:06:28 +0000
3+++ debian/changelog 2012-01-29 13:50:30 +0000
4@@ -1,3 +1,13 @@
5+pkgbinarymangler (114) UNRELEASED; urgency=low
6+
7+ * pkgstripfiles, symlink_doc(): Don't create symlinks that would point to
8+ the same package. (LP: #923343)
9+ * test/run: Add test_doc_symlink_dependency_cycle() to make sure that
10+ pkgstripfiles works correctly when there is a dependency cycle inside
11+ a source package.
12+
13+ -- Felix Geyer <debfx@ubuntu.com> Sun, 29 Jan 2012 12:45:35 +0100
14+
15 pkgbinarymangler (113) precise; urgency=low
16
17 * dh_translations: fixes previous issues harder (lp: #913085)
18
19=== modified file 'pkgstripfiles'
20--- pkgstripfiles 2011-12-12 11:19:19 +0000
21+++ pkgstripfiles 2012-01-29 13:50:30 +0000
22@@ -149,6 +149,7 @@
23 depfile="$r/../$dep/usr/share/doc/$dep/$f"
24 fi
25
26+ [ "$dep" != "$PKGNAME" ] || continue
27 [ -f "$depfile" ] || continue
28
29 # special-case Debian changelog: as we truncate them they may
30
31=== modified file 'test/run'
32--- test/run 2011-12-12 09:41:52 +0000
33+++ test/run 2012-01-29 13:50:30 +0000
34@@ -967,6 +967,41 @@
35 self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/test.c']['linkto'], '../vanilla/test.c')
36 self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/changelog.gz']['linkto'], '../vanilla/changelog.gz')
37
38+ def test_doc_symlink_dependency_cycle(self):
39+ '''doc symlinking: cyclic dependency'''
40+
41+ with open(os.path.join(self.pkgdir, 'debian', 'vanilla.docs'), 'w') as f:
42+ f.write('test.c')
43+ with open(os.path.join(self.pkgdir, 'debian', 'chocolate.docs'), 'w') as f:
44+ f.write('test.c')
45+ self.sed_control('/^Architecture:/ s/any/all/g')
46+ self.sed_control('s/^Description: vanilla/Depends: chocolate\\n&/')
47+ self.sed_control('s/^Description: chocolate/Depends: vanilla\\n&/')
48+ orig_size = os.path.getsize(os.path.join(self.pkgdir, 'test.c'))
49+
50+ self.build()
51+ c = self.deb_contents()
52+
53+ vanilla_link = c['vanilla']['./usr/share/doc/vanilla/test.c']['linkto']
54+ chocolate_link = c['chocolate']['./usr/share/doc/chocolate/test.c']['linkto']
55+
56+ # exactly one of them has to be a symlink
57+ self.assertTrue(vanilla_link is None or chocolate_link is None)
58+ self.assertTrue(vanilla_link is not None or chocolate_link is not None)
59+
60+ if vanilla_link is None:
61+ file_pkg = "vanilla"
62+ link_pkg = "chocolate"
63+ else:
64+ file_pkg = "chocolate"
65+ link_pkg = "vanilla"
66+
67+ self.assertEqual(c[file_pkg]['./usr/share/doc/%s/test.c' % (file_pkg,)]['linkto'], None)
68+ self.assertEqual(c[file_pkg]['./usr/share/doc/%s/test.c' % (file_pkg,)]['size'], orig_size)
69+ self.assertEqual(c[file_pkg]['./usr/share/doc/%s/changelog.gz' % (file_pkg,)]['linkto'], None)
70+ self.assertEqual(c[link_pkg]['./usr/share/doc/%s/test.c' % (link_pkg,)]['linkto'], '../%s/test.c' % (file_pkg,))
71+ self.assertEqual(c[link_pkg]['./usr/share/doc/%s/changelog.gz' % (link_pkg,)]['linkto'], '../%s/changelog.gz' % (file_pkg,))
72+
73 def test_doc_symlink_disable(self):
74 '''doc symlinking: Disabling with $NO_DOC_PKG_MANGLE'''
75

Subscribers

People subscribed via source and target branches

to all changes: