Skip to content

Commit

Permalink
Merge branch 'fix/sizesharing' into 'main'
Browse files Browse the repository at this point in the history
Allow packages from volatile sources  to be reinstalled

See merge request apt-team/apt!177
  • Loading branch information
julian-klode committed Jul 5, 2021
2 parents 690f619 + e6056cb commit b1a384c
Show file tree
Hide file tree
Showing 18 changed files with 173 additions and 43 deletions.
5 changes: 2 additions & 3 deletions apt-pkg/acquire-item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3471,9 +3471,8 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *const Owner, pkgSourceList *const Sourc
}
if (FileSize == 0 && not _config->FindB("Acquire::AllowUnsizedPackages", false))
{
_error->Error("Repository is broken: %s (= %s) has no Size information",
Version.ParentPkg().FullName(false).c_str(),
Version.VerStr());
_error->Error("Repository is broken: %s has no Size information",
Desc.Description.c_str());
return;
}

Expand Down
7 changes: 6 additions & 1 deletion apt-pkg/deb/deblistparser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,13 @@ uint32_t debListParser::VersionHash()
half-configured, triggers-awaited, triggers-pending, installed
*/
bool debListParser::ParseStatus(pkgCache::PkgIterator &,
pkgCache::VerIterator &)
pkgCache::VerIterator &Ver)
{
// the status file has no info about the download size and
// usually this is fine as we will have picked that info up already –
// except if we have volatile sources which are parsed after the status file.
if (Ver->Size == 0)
Ver->Size = Section.FindULL(pkgTagSection::Key::Size);
return true;
}
bool debStatusListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
Expand Down
6 changes: 3 additions & 3 deletions test/integration/Packages-releasefile-verification
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Replaces: libapt-pkg-dev (<< 0.3.7), libapt-pkg-doc (<< 0.3.7)
Provides: libapt-pkg-libc6.9-6-4.8
Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt
Filename: apt.deb
Size: 0
MD5sum: d41d8cd98f00b204e9800998ecf8427e
SHA256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Size: 3
MD5sum: 583f72a833c7dfd63c03edba3776247a
SHA256: 5009a047a11fbd680bb40d2f23cd3fcd626ac2d672c38e16f53bd622c3961534
Description: Advanced front-end for dpkg
This is Debian's next generation front-end for the dpkg package manager.
It provides the apt-get utility and APT dselect method that provides a
Expand Down
6 changes: 3 additions & 3 deletions test/integration/Packages-releasefile-verification-new
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Provides: libapt-pkg4.10
Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt
Conflicts: python-apt (<< 0.7.93.2~)
Filename: apt.deb
Size: 0
MD5sum: d41d8cd98f00b204e9800998ecf8427e
SHA256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Size: 3
MD5sum: 583f72a833c7dfd63c03edba3776247a
SHA256: 5009a047a11fbd680bb40d2f23cd3fcd626ac2d672c38e16f53bd622c3961534
Description: Advanced front-end for dpkg
This is Debian's next generation front-end for the dpkg package manager.
It provides the apt-get utility and APT dselect method that provides a
Expand Down
7 changes: 2 additions & 5 deletions test/integration/framework
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,6 @@ EOF

echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id

# XXX: We really ought to make the packages in the test suite all have Size fields.
# But this needs a lot more changes, so let's keep it simple for stable updates.
echo 'Acquire::AllowUnsizedPackages "true";' >> rootdir/etc/apt/apt.conf.d/temporary-allow-unsized-packages

configcompression '.' 'gz' #'bz2' 'lzma' 'xz'
confighashes 'SHA256' # these are tests, not security best-practices

Expand Down Expand Up @@ -974,14 +970,15 @@ insertpackage() {
Priority: $PRIORITY
Section: $SECTION
Installed-Size: 42
Size: 42
SHA256: 0000000000000000000000000000000000000000000000000000000000000000
Maintainer: Joe Sixpack <joe@example.org>"
test "$arch" = 'none' || echo "Architecture: $arch"
echo "Version: $VERSION
Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb"
test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES"
echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)"
echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)"
echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000"
echo
} >> "${PPATH}/Packages"
done
Expand Down
24 changes: 12 additions & 12 deletions test/integration/test-apt-cli-show
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Priority: optional
Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Download-Size: unknown
Download-Size: 42 B
APT-Manual-Installed: yes
APT-Sources: file:$APTARCHIVE unstable/main all Packages
Description: Some description
Expand All @@ -48,7 +48,7 @@ Priority: optional
Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Download-Size: unknown
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main i386 Packages
Description: Some description
That has multiple lines
Expand All @@ -59,7 +59,7 @@ Priority: optional
Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Download-Size: unknown
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main amd64 Packages
Description: Some description
That has multiple lines
Expand All @@ -70,7 +70,7 @@ Priority: optional
Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 4229 MB
Download-Size: unknown
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main amd64 Packages
Description: Some description
That has multiple lines
Expand All @@ -83,7 +83,7 @@ Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Provides: pkga$(generatelotsofnames)
Download-Size: unknown
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main all Packages
Description: Some description
That has multiple lines
Expand All @@ -95,7 +95,7 @@ Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Provides: foobar, pkga$(generatelotsofnames)
Download-Size: unknown
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main all Packages
Description: Some description
That has multiple lines
Expand All @@ -108,7 +108,7 @@ Priority: optional
Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Download-Size: unknown
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main all Packages
Description: Some description
That has multiple lines
Expand All @@ -121,7 +121,7 @@ Priority: optional
Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Download-Size: unknown
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main all Packages
Description: Some description
That has multiple lines
Expand All @@ -132,7 +132,7 @@ Priority: optional
Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Download-Size: unknown
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main all Packages
Description: Some description
That has multiple lines
Expand All @@ -145,7 +145,7 @@ Priority: optional
Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Download-Size: unknown
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main all Packages
Description: Some description
That has multiple lines
Expand All @@ -158,7 +158,7 @@ Priority: optional
Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Download-Size: unknown
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main all Packages
Description: Some description
That has multiple lines
Expand All @@ -169,7 +169,7 @@ Priority: optional
Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Download-Size: unknown
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main all Packages
Description: Some description
That has multiple lines
Expand Down
3 changes: 3 additions & 0 deletions test/integration/test-bug-604222-new-and-autoremove
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ The following additional packages will be installed:
The following NEW packages will be installed:
dummy-archive libavcodec52 libopenal-dev
0 upgraded, 3 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/126 B of archives.
After this operation, 129 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install dummy-archive --trivial-only
testequal "Reading package lists...
Expand All @@ -75,6 +76,7 @@ The following additional packages will be installed:
The following NEW packages will be installed:
dummy-archive libavcodec52 libopenal-dev
0 upgraded, 3 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/126 B of archives.
After this operation, 129 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install dummy-archive --trivial-only -o APT::Get::HideAutoRemove=small

Expand All @@ -93,6 +95,7 @@ The following additional packages will be installed:
The following NEW packages will be installed:
dummy-archive libavcodec52 libopenal-dev
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/126 B of archives.
After this operation, 129 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation.'

Expand Down
2 changes: 2 additions & 0 deletions test/integration/test-bug-612557-garbage-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The following NEW packages will be installed:
The following packages will be upgraded:
python-uno
1 upgraded, 1 newly installed, 2 to remove and 0 not upgraded.
Need to get 0 B/84 B of archives.
After this operation, 53.2 MB disk space will be freed.
E: Trivial Only specified but this is not a trivial operation.' aptget --trivial-only install python-uno

Expand All @@ -47,6 +48,7 @@ The following NEW packages will be installed:
The following packages will be upgraded:
python-uno
1 upgraded, 1 newly installed, 2 to remove and 0 not upgraded.
Need to get 0 B/84 B of archives.
After this operation, 53.2 MB disk space will be freed.
E: Trivial Only specified but this is not a trivial operation.' aptget --trivial-only install python-uno

Expand Down
2 changes: 2 additions & 0 deletions test/integration/test-bug-613420-new-garbage-dependency
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ The following NEW packages will be installed:
The following packages will be upgraded:
openoffice.org-officebean
1 upgraded, 3 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B/168 B of archives.
After this operation, 126 MB disk space will be freed.
E: Trivial Only specified but this is not a trivial operation." aptget install libreoffice --trivial-only
testequal "Reading package lists...
Expand All @@ -52,5 +53,6 @@ The following NEW packages will be installed:
The following packages will be upgraded:
openoffice.org-officebean
1 upgraded, 3 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B/168 B of archives.
After this operation, 126 MB disk space will be freed.
E: Trivial Only specified but this is not a trivial operation." aptget install libreoffice --trivial-only -o APT::Get::HideAutoRemove=small
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The following NEW packages will be installed:
The following packages will be upgraded:
apt libc6
2 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B/126 B of archives.
After this operation, 0 B of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only

Expand All @@ -42,5 +43,6 @@ The following packages have been kept back:
The following packages will be upgraded:
libc6
1 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/42 B of archives.
After this operation, 0 B of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only -o Test='hold-back-apt'
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ The following packages will be REMOVED:
The following packages will be upgraded:
xserver-xorg-core
1 upgraded, 0 newly installed, 50 to remove and 0 not upgraded.
Need to get 0 B/42 B of archives.
After this operation, 2150 kB disk space will be freed.
E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only
4 changes: 4 additions & 0 deletions test/integration/test-bug-680041-apt-mark-holds-correctly
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Calculating upgrade...
The following packages will be upgraded:
pkgall pkgarch
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/84 B of archives.
After this operation, 0 B of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only

Expand All @@ -37,6 +38,7 @@ The following packages have been kept back:
The following packages will be upgraded:
pkgall
1 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/42 B of archives.
After this operation, 0 B of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only

Expand All @@ -49,6 +51,7 @@ Calculating upgrade...
The following packages will be upgraded:
pkgall pkgarch
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/84 B of archives.
After this operation, 0 B of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only

Expand All @@ -63,6 +66,7 @@ The following packages have been kept back:
The following packages will be upgraded:
pkgarch
1 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/42 B of archives.
After this operation, 0 B of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ setupaptarchive

APTARCHIVE=$(readlink -f ./aptarchive)

testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget upgrade -qq --print-uris
testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget dist-upgrade -qq --print-uris
testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget install apt -qq --print-uris
testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 SHA256:0000000000000000000000000000000000000000000000000000000000000000" aptget download apt -qq --print-uris
testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 42 " aptget upgrade -qq --print-uris
testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 42 " aptget dist-upgrade -qq --print-uris
testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 42 " aptget install apt -qq --print-uris
testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 42 SHA256:0000000000000000000000000000000000000000000000000000000000000000" aptget download apt -qq --print-uris
testsuccessequal "'file:${APTARCHIVE}/apt_2.dsc' apt_2.dsc 9 SHA256:7776436a6d741497f1cd958014e1a05b352224231428152aae39da3c17fd2fd4
'file:${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 12 SHA256:f57f565eabe3fde0ec6e6e0bcc8db1d86fe2b4d6344a380a23520ddbb7728e99" aptget source apt -qq --print-uris
testsuccessequal "'https://metadata.ftp-master.debian.org/changelogs/main/a/apt/apt_2_changelog' apt.changelog" aptget changelog apt -qq --print-uris
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test-explore-or-groups-in-markinstall
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ fi

if $TEST_WITH_APTITUDE; then
OKAYAPTITUDE='0 packages upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
Need to get 0 B of archives. After unpacking 86.0 kB will be used.
Need to get 0 B/84 B of archives. After unpacking 86.0 kB will be used.
Would download/install/remove packages.'
testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-d-level2 -sy
testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-r-level2 -sy
Expand Down
Loading

0 comments on commit b1a384c

Please sign in to comment.