Merge lp:~cjwatson/launchpad/remove-contents-header into lp:launchpad

Proposed by Colin Watson on 2016-11-01
Status: Merged
Merged at revision: 18249
Proposed branch: lp:~cjwatson/launchpad/remove-contents-header
Merge into: lp:launchpad
Diff against target: 139 lines (+2/-70)
4 files modified
cronscripts/publishing/gen-contents/Contents.top (+0/-32)
cronscripts/publishing/gen-contents/apt_conf_header.template (+0/-2)
lib/lp/archivepublisher/scripts/generate_contents_files.py (+2/-22)
lib/lp/archivepublisher/tests/test_generate_contents_files.py (+0/-14)
To merge this branch: bzr merge lp:~cjwatson/launchpad/remove-contents-header
Reviewer Review Type Date Requested Status
William Grant code 2016-11-01 Approve on 2016-11-03
Review via email: mp+309750@code.launchpad.net

Commit message

Remove headers from Contents files.

Description of the change

Primarily machine-readable files are no place for documentation. This follows a change to dak (https://anonscm.debian.org/cgit/mirror/dak.git/commit/?id=33c8477957525ae6b929a5b0e34eb6ea1ff85c89).

To post a comment you must log in.
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'cronscripts/publishing/gen-contents/Contents.top'
2--- cronscripts/publishing/gen-contents/Contents.top 2011-04-18 14:03:06 +0000
3+++ cronscripts/publishing/gen-contents/Contents.top 1970-01-01 00:00:00 +0000
4@@ -1,32 +0,0 @@
5-This file maps each file available in the %(distrotitle)s
6-system to the package from which it originates. It includes packages
7-from the DIST distribution for the ARCH architecture.
8-
9-You can use this list to determine which package contains a specific
10-file, or whether or not a specific file is available. The list is
11-updated weekly, each architecture on a different day.
12-
13-When a file is contained in more than one package, all packages are
14-listed. When a directory is contained in more than one package, only
15-the first is listed.
16-
17-The best way to search quickly for a file is with the Unix `grep'
18-utility, as in `grep <regular expression> CONTENTS':
19-
20- $ grep nose Contents
21- etc/nosendfile net/sendfile
22- usr/X11R6/bin/noseguy x11/xscreensaver
23- usr/X11R6/man/man1/noseguy.1x.gz x11/xscreensaver
24- usr/doc/examples/ucbmpeg/mpeg_encode/nosearch.param graphics/ucbmpeg
25- usr/lib/cfengine/bin/noseyparker admin/cfengine
26-
27-This list contains files in all packages, even though not all of the
28-packages are installed on an actual system at once. If you want to
29-find out which packages on an installed Debian system provide a
30-particular file, you can use `dpkg --search <filename>':
31-
32- $ dpkg --search /usr/bin/dselect
33- dpkg: /usr/bin/dselect
34-
35-
36-FILE LOCATION
37
38=== modified file 'cronscripts/publishing/gen-contents/apt_conf_header.template'
39--- cronscripts/publishing/gen-contents/apt_conf_header.template 2014-01-17 02:03:41 +0000
40+++ cronscripts/publishing/gen-contents/apt_conf_header.template 2016-11-01 12:26:30 +0000
41@@ -15,8 +15,6 @@
42
43 TreeDefault
44 {
45- // Header for Contents file.
46 Contents "$(DIST)/Contents-$(ARCH)";
47- Contents::Header "%(content_archive)s/%(distribution)s-misc/Contents.top";
48 };
49
50
51=== modified file 'lib/lp/archivepublisher/scripts/generate_contents_files.py'
52--- lib/lp/archivepublisher/scripts/generate_contents_files.py 2016-02-05 16:51:12 +0000
53+++ lib/lp/archivepublisher/scripts/generate_contents_files.py 2016-11-01 12:26:30 +0000
54@@ -205,21 +205,6 @@
55 else:
56 self.logger.debug("Did not find overrides; not copying.")
57
58- def writeContentsTop(self, distro_name, distro_title):
59- """Write Contents.top file.
60-
61- This method won't access the database.
62- """
63- output_filename = os.path.join(
64- self.content_archive, '%s-misc' % distro_name, "Contents.top")
65- parameters = {
66- 'distrotitle': distro_title,
67- }
68- output_file = file(output_filename, 'w')
69- text = file(get_template("Contents.top")).read() % parameters
70- output_file.write(text)
71- output_file.close()
72-
73 def runAptFTPArchive(self, distro_name):
74 """Run apt-ftparchive to produce the Contents files.
75
76@@ -233,7 +218,7 @@
77 "apt-contents.conf"),
78 ])
79
80- def generateContentsFiles(self, override_root, distro_name, distro_title):
81+ def generateContentsFiles(self, override_root, distro_name):
82 """Generate Contents files.
83
84 This method may take a long time to run.
85@@ -243,13 +228,10 @@
86 evaluated without accessing the database.
87 :param distro_name: Copy of `self.distribution.name` that can be
88 evaluated without accessing the database.
89- :param distro_title: Copy of `self.distribution.title` that can be
90- evaluated without accessing the database.
91 """
92 self.logger.debug(
93 "Running apt in private tree to generate new contents.")
94 self.copyOverrides(override_root)
95- self.writeContentsTop(distro_name, distro_title)
96 self.runAptFTPArchive(distro_name)
97
98 def updateContentsFile(self, suite, arch):
99@@ -309,14 +291,12 @@
100
101 overrideroot = self.config.overrideroot
102 distro_name = self.distribution.name
103- distro_title = self.distribution.title
104
105 # This takes a while. Ensure that we do it without keeping a
106 # database transaction open.
107 self.txn.commit()
108 with DatabaseBlockedPolicy():
109- self.generateContentsFiles(
110- overrideroot, distro_name, distro_title)
111+ self.generateContentsFiles(overrideroot, distro_name)
112
113 self.updateContentsFiles(suites)
114
115
116=== modified file 'lib/lp/archivepublisher/tests/test_generate_contents_files.py'
117--- lib/lp/archivepublisher/tests/test_generate_contents_files.py 2016-01-13 17:09:34 +0000
118+++ lib/lp/archivepublisher/tests/test_generate_contents_files.py 2016-11-01 12:26:30 +0000
119@@ -257,20 +257,6 @@
120 'Architectures "%s source";' % das.architecturetag,
121 apt_contents_conf)
122
123- def test_writeContentsTop(self):
124- # writeContentsTop writes a Contents.top file based on a
125- # standard template, with the distribution's title interpolated.
126- distro = self.makeDistro()
127- script = self.makeScript(distro)
128- content_archive = script.content_archive
129- script.writeContentsTop(distro.name, distro.title)
130-
131- contents_top = file(
132- "%s/%s-misc/Contents.top" % (content_archive, distro.name)).read()
133-
134- self.assertIn("This file maps", contents_top)
135- self.assertIn(distro.title, contents_top)
136-
137 def test_setUp_places_content_archive_in_distroroot(self):
138 # The contents files are kept in subdirectories of distroroot.
139 script = self.makeScript()