APT

Merge lp:~pitti/apt/compressed-indexes into lp:~mvo/apt/debian-sid

Proposed by Martin Pitt
Status: Merged
Merged at revision: 2035
Proposed branch: lp:~pitti/apt/compressed-indexes
Merge into: lp:~mvo/apt/debian-sid
Diff against target: 171 lines (+65/-12)
7 files modified
apt-pkg/contrib/fileutl.cc (+20/-1)
apt-pkg/deb/debindexfile.cc (+13/-9)
apt-pkg/deb/debsystem.cc (+2/-2)
debian/apt.cron.daily (+7/-0)
debian/changelog (+20/-0)
doc/examples/configure-index (+1/-0)
test/integration/framework (+2/-0)
To merge this branch: bzr merge lp:~pitti/apt/compressed-indexes
Reviewer Review Type Date Requested Status
Ubuntu Core Development Team Pending
Review via email: mp+38319@code.launchpad.net

Description of the change

This fixes the "apt-get update/install cache building progress goes beyond 100%" bug.

To post a comment you must log in.
lp:~pitti/apt/compressed-indexes updated
2033. By Michael Vogt

tests/integration/test-*: remove a bunch of "local" that are used outside funtions (bash complains)

2034. By Michael Vogt

test/integration/framework: set proper dir::state::status

2035. By Michael Vogt

* apt-pkg/deb/debindexfile.cc:
  - Use FileFd::Size() instead of stat()ing the sources/binary/translations
    indexes directly, so that we have transparent handling of gzipped
    indexes.
* apt-pkg/contrib/fileutl.cc:
  - Fix FileFd::Size() for gzipped files to give the size of the
    uncompressed data. This fixes cache building progress going way
    over 100%.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'apt-pkg/contrib/fileutl.cc'
2--- apt-pkg/contrib/fileutl.cc 2010-09-06 12:10:26 +0000
3+++ apt-pkg/contrib/fileutl.cc 2010-10-13 12:35:53 +0000
4@@ -915,8 +915,27 @@
5 /* */
6 unsigned long FileFd::Size()
7 {
8- //TODO: For gz, do we need the actual file size here or the uncompressed length?
9 struct stat Buf;
10+ long size;
11+ off_t orig_pos;
12+
13+ if (gz)
14+ {
15+ /* unfortunately zlib.h doesn't provide a gzsize(), so we have to do
16+ * this ourselves; the original (uncompressed) file size is the last 32
17+ * bits of the file */
18+ orig_pos = lseek(iFd, 0, SEEK_CUR);
19+ if (lseek(iFd, -4, SEEK_END) < 0)
20+ return _error->Errno("lseek","Unable to seek to end of gzipped file");
21+ if (read(iFd, &size, 4) != 4)
22+ return _error->Errno("read","Unable to read original size of gzipped file");
23+ size &= 0xFFFFFFFF;
24+
25+ if (lseek(iFd, orig_pos, SEEK_SET) < 0)
26+ return _error->Errno("lseek","Unable to seek in gzipped file");
27+ return size;
28+ }
29+
30 if (fstat(iFd,&Buf) != 0)
31 return _error->Errno("fstat","Unable to determine the file size");
32 return Buf.st_size;
33
34=== modified file 'apt-pkg/deb/debindexfile.cc'
35--- apt-pkg/deb/debindexfile.cc 2010-07-11 16:50:41 +0000
36+++ apt-pkg/deb/debindexfile.cc 2010-10-13 12:35:53 +0000
37@@ -149,10 +149,11 @@
38 /* */
39 unsigned long debSourcesIndex::Size() const
40 {
41- struct stat S;
42- if (stat(IndexFile("Sources").c_str(),&S) != 0)
43+ FileFd f = FileFd (IndexFile("Sources"), FileFd::ReadOnlyGzip);
44+
45+ if (f.Failed())
46 return 0;
47- return S.st_size;
48+ return f.Size();
49 }
50 /*}}}*/
51
52@@ -268,10 +269,11 @@
53 /* This is really only used for progress reporting. */
54 unsigned long debPackagesIndex::Size() const
55 {
56- struct stat S;
57- if (stat(IndexFile("Packages").c_str(),&S) != 0)
58+ FileFd f = FileFd (IndexFile("Packages"), FileFd::ReadOnlyGzip);
59+
60+ if (f.Failed())
61 return 0;
62- return S.st_size;
63+ return f.Size();
64 }
65 /*}}}*/
66 // PackagesIndex::Merge - Load the index file into a cache /*{{{*/
67@@ -458,10 +460,12 @@
68 /* This is really only used for progress reporting. */
69 unsigned long debTranslationsIndex::Size() const
70 {
71- struct stat S;
72- if (stat(IndexFile(Language).c_str(),&S) != 0)
73+ FileFd f = FileFd (IndexFile(Language), FileFd::ReadOnlyGzip);
74+
75+ if (f.Failed())
76 return 0;
77- return S.st_size;
78+
79+ return f.Size();
80 }
81 /*}}}*/
82 // TranslationsIndex::Merge - Load the index file into a cache /*{{{*/
83
84=== modified file 'apt-pkg/deb/debsystem.cc'
85--- apt-pkg/deb/debsystem.cc 2010-08-18 22:31:55 +0000
86+++ apt-pkg/deb/debsystem.cc 2010-10-13 12:35:53 +0000
87@@ -164,8 +164,8 @@
88 /* These really should be jammed into a generic 'Local Database' engine
89 which is yet to be determined. The functions in pkgcachegen should
90 be the only users of these */
91- Cnf.CndSet("Dir::State::extended_states", Cnf.FindDir("Dir::State").append("extended_states"));
92- Cnf.CndSet("Dir::State::status", Cnf.FindDir("Dir", "/").append("var/lib/dpkg/status"));
93+ Cnf.CndSet("Dir::State::extended_states", "extended_states");
94+ Cnf.CndSet("Dir::State::status","/var/lib/dpkg/status");
95 Cnf.CndSet("Dir::Bin::dpkg","/usr/bin/dpkg");
96
97 if (StatusFile) {
98
99=== modified file 'debian/apt.cron.daily'
100--- debian/apt.cron.daily 2010-09-15 11:24:51 +0000
101+++ debian/apt.cron.daily 2010-10-13 12:35:53 +0000
102@@ -417,6 +417,13 @@
103 # mirrors at the same time
104 random_sleep
105
106+# include default system language so that "apt-get update" will
107+# fetch the right translated package descriptions
108+if [ -r /etc/default/locale ]; then
109+ . /etc/default/locale
110+ export LANG LANGUAGE LC_MESSAGES LC_ALL
111+fi
112+
113 # update package lists
114 UPDATED=0
115 UPDATE_STAMP=/var/lib/apt/periodic/update-stamp
116
117=== modified file 'debian/changelog'
118--- debian/changelog 2010-10-06 20:35:27 +0000
119+++ debian/changelog 2010-10-13 12:35:53 +0000
120@@ -5,6 +5,26 @@
121 * Another typo fixed in French ("Anfin"). Thanks to bubulle
122 * Wrong translation for "showauto" fixed. Thanks to Raphaƫl Hertzog
123 Closes: #599265
124+
125+ [ Michael Vogt ]
126+ * debian/apt.cron.daily:
127+ - source /etc/default/locale (if available) so that the
128+ apt-get update cron job fetches the right translated package
129+ descriptions
130+ * fix test failure on amd64
131+ * apt-pkg/deb/debsystem.cc:
132+ - fix issues with dir::state::status and dir::state::extended_states
133+ when alternative rootdirs are used
134+
135+ [ Martin Pitt ]
136+ * apt-pkg/deb/debindexfile.cc:
137+ - Use FileFd::Size() instead of stat()ing the sources/binary/translations
138+ indexes directly, so that we have transparent handling of gzipped
139+ indexes.
140+ * apt-pkg/contrib/fileutl.cc:
141+ - Fix FileFd::Size() for gzipped files to give the size of the
142+ uncompressed data. This fixes cache building progress going way
143+ over 100%.
144
145 -- Christian Perrier <bubulle@debian.org> Tue, 05 Oct 2010 05:35:58 +0200
146
147
148=== modified file 'doc/examples/configure-index'
149--- doc/examples/configure-index 2010-07-09 15:00:28 +0000
150+++ doc/examples/configure-index 2010-10-13 12:35:53 +0000
151@@ -433,6 +433,7 @@
152 Acquire::Http "false"; // Show http command traffic
153 Acquire::Https "false"; // Show https debug
154 Acquire::gpgv "false"; // Show the gpgv traffic
155+ Acquire::cdrom "false"; // Show cdrom debug output
156 aptcdrom "false"; // Show found package files
157 IdentCdrom "false";
158 acquire::netrc "false"; // netrc parser
159
160=== modified file 'test/integration/framework'
161--- test/integration/framework 2010-09-29 17:55:04 +0000
162+++ test/integration/framework 2010-10-13 12:35:53 +0000
163@@ -64,6 +64,8 @@
164 msgdebug "Executing: ${CCMD}$*${CDEBUG} "
165 if [ -f ./aptconfig.conf ]; then
166 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
167+ elif [ -f ../aptconfig.conf ]; then
168+ APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
169 else
170 LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
171 fi

Subscribers

People subscribed via source and target branches

to all changes: