tag 596097 patch thanks 2010/9/9 Carsten Hey <cars...@debian.org>: > * David Kalnischkies [2010-09-09 15:25 +0200]: >> 2010/9/9 Carsten Hey <cars...@debian.org>: >> If we (or rather the backport.debian.org ftpmasters, I'm just trying to >> convince you to provide the apt feature that is a prerequisite for this) > > No need to convenience me (as long as you don't want to trick me into > writing the patch ;) )
I am still not completely convinced that i will like this default behavior for backports, but thats not my cup of tea to decide and i can pin it differently anyway… i am a bit more surprised that nobody feels the urgent need to do the work as it was a relatively low-hanging fruit and faster to implement than reading the complete thread… especially as everybody likes it here and on d-release beside the nobody… anyway, here it is, a more or less untested (in terms of real world usage) patch for APT to pin sources with "ButAutomaticUpgrades" with 100. NotAutomatic needs to be present for compatibility anyway so the sense is not completely lost and a bit easier to understand then NotAutomaticButUpgrades -- but a better name can always be suggest (until it is too late of course), maybe someone wants to do at least this… Will be around for comment at least until 0.8.4 migration i guess… > Only upgrading specific repositories like security sounds like a feature > that could be useful for apt's cronjob, if it is not already implemented > there (I think I saw such a "update only security" feature somewhere). I think debsecan can do something similar or so, but to really support it we should make use of tags or alike… anyway, different topic… >> That is a problem in unstable and testing (and therefore CUT) too so >> nothing really new, but it lead my friend to a point to step back from >> regular headless upgrades even in stable and to replacing them by >> irregular "if i have time to fix the maybe incoming problems by new >> major versions" upgrades which normally results in: "I haven't >> upgraded for 6 months now…" I am not sure if that will be any help in >> reducing the amount of spam… > > apt-clone, which creates zfs snapshots before upgrading, could be useful > for him, but this would require a kernel with zfs support. He could > also adapt it to use lvm ;) I have strong hopes for a btrfs integration in APT, but before that btrfs needs to be kind of stable at least… (but different topic again) >> Pinning is as easy as finding the version with the highest number >> attached above or equal to the currently installed version (at least >> pin 100, but likely the pin from the archive this version comes from). >> Exception: x >= 1000 will overrule everything even if below installed >> version. > > This explanation is a lot easier to understand than the man page :) It omits much of the "fun", so yes, easier in some ways, incomplete in all others - but the manpage could still be worded differently i guess ;) (different topic - take 3) >> So, maybe the solution to this thread is even to set a defaultrelease >> somewhere and to drop the notautomatic bit in backports instead of >> introducing a new flag… beside that failing to set the defaultrelease >> will give very bad results to the users… (= a mixed stable/backports >> system) > > The problem with setting DefaultRelease is that there are many ways to > install Debian, only one of those is using the Debian-Installer; besides > this, users should be able to upgrade to newer releases without having > disadvantages like backports not working like they should out of the > box. Yeah, adding backports is a service by the installer, so it could also do the pinning service in theory… Anyway, "problem" solved above so this is void. Bes regards David Kalnischkies P.S.: Now that i understand your idea Julian, i like it, but as you said, abi+1 stuff… :(
=== modified file 'apt-pkg/deb/deblistparser.cc' --- apt-pkg/deb/deblistparser.cc 2010-07-11 16:50:41 +0000 +++ apt-pkg/deb/deblistparser.cc 2010-09-14 16:57:46 +0000 @@ -815,6 +815,12 @@ if (Section.FindFlag("NotAutomatic",FileI->Flags, pkgCache::Flag::NotAutomatic) == false) _error->Warning("Bad NotAutomatic flag"); + if (Section.FindFlag("ButAutomaticUpgrades",FileI->Flags, + pkgCache::Flag::ButAutomaticUpgrades) == false) + _error->Warning("Bad ButAutomaticUpgrades flag"); + // overrule the NotAutomatic setting if needed as they are both present for compatibility + else if ((FileI->Flags & pkgCache::Flag::ButAutomaticUpgrades) == pkgCache::Flag::ButAutomaticUpgrades) + FileI->Flags &= ~pkgCache::Flag::NotAutomatic; return !_error->PendingError(); } === modified file 'apt-pkg/depcache.cc' --- apt-pkg/depcache.cc 2010-08-27 10:05:55 +0000 +++ apt-pkg/depcache.cc 2010-09-14 16:57:46 +0000 @@ -1615,7 +1615,8 @@ /* Stash the highest version of a not-automatic source, we use it if there is nothing better */ - if ((J.File()->Flags & Flag::NotAutomatic) != 0) + if ((J.File()->Flags & Flag::NotAutomatic) != 0 || + (J.File()->Flags & Flag::ButAutomaticUpgrades) != 0) { if (Last.end() == true) Last = I; === modified file 'apt-pkg/pkgcache.cc' --- apt-pkg/pkgcache.cc 2010-08-13 14:42:38 +0000 +++ apt-pkg/pkgcache.cc 2010-09-14 16:57:46 +0000 @@ -731,6 +731,7 @@ { VerFileIterator Files = FileList(); for (; Files.end() == false; Files++) + // Do not check ButAutomaticUpgrades here as it is kind of automatic… if ((Files.File()->Flags & pkgCache::Flag::NotAutomatic) != pkgCache::Flag::NotAutomatic) return true; return false; === modified file 'apt-pkg/pkgcache.h' --- apt-pkg/pkgcache.h 2010-07-08 13:28:53 +0000 +++ apt-pkg/pkgcache.h 2010-09-14 16:57:46 +0000 @@ -146,7 +146,7 @@ struct Flag { enum PkgFlags {Auto=(1<<0),Essential=(1<<3),Important=(1<<4)}; - enum PkgFFlags {NotSource=(1<<0),NotAutomatic=(1<<1)}; + enum PkgFFlags {NotSource=(1<<0),NotAutomatic=(1<<1),ButAutomaticUpgrades=(1<<2)}; }; protected: === modified file 'apt-pkg/policy.cc' --- apt-pkg/policy.cc 2010-06-09 12:20:27 +0000 +++ apt-pkg/policy.cc 2010-09-14 16:57:46 +0000 @@ -16,7 +16,7 @@ 990 = Config file override package files 989 = Start for preference auto-priorities 500 = Default package files - 100 = The status file + 100 = The status file and ButAutomaticUpgrades sources 0 -> 100 = NotAutomatic sources like experimental -inf -> 0 = Never selected @@ -70,9 +70,10 @@ PFPriority[I->ID] = 500; if ((I->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource) PFPriority[I->ID] = 100; - else - if ((I->Flags & pkgCache::Flag::NotAutomatic) == pkgCache::Flag::NotAutomatic) - PFPriority[I->ID] = 1; + else if ((I->Flags & pkgCache::Flag::ButAutomaticUpgrades) == pkgCache::Flag::ButAutomaticUpgrades) + PFPriority[I->ID] = 100; + else if ((I->Flags & pkgCache::Flag::NotAutomatic) == pkgCache::Flag::NotAutomatic) + PFPriority[I->ID] = 1; } // Apply the defaults.. === modified file 'debian/changelog' --- debian/changelog 2010-09-09 17:04:26 +0000 +++ debian/changelog 2010-09-14 16:57:46 +0000 @@ -1,3 +1,14 @@ +apt (0.8.5) UNRELEASED; urgency=low + + [ David Kalnischkies ] + * apt-pkg/policy.cc: + - support 100-pinning in Release file with ButAutomaticUpgrades + as requested by the backports crew (Closes: #596097) + * apt-pkg/deb/deblistparser.cc: + - overrule NotAutomatic in case of ButAutomaticUpgrades + + -- David Kalnischkies <kalnischk...@gmail.com> Tue, 14 Sep 2010 18:56:23 +0200 + apt (0.8.4) UNRELEASED; urgency=low [ Michael vogt ] === added file 'test/integration/Packages-policy-pinning' --- test/integration/Packages-policy-pinning 1970-01-01 00:00:00 +0000 +++ test/integration/Packages-policy-pinning 2010-09-14 16:57:46 +0000 @@ -0,0 +1,12 @@ +Package: oldstuff +Version: 1.0 +Architecture: i386 +Maintainer: Joe Sixpack <j...@example.org> +Installed-Size: 100 +Filename: pool/oldstuff_1.0_i386.deb +Size: 100000 +MD5sum: 311aeeadf78324aaff54c9b4e1f76671 +SHA1: 3c695e028f74d5c544deeddaaa1242desa81088c +SHA256: b46fd1546151c545fe4bfa56a5cc0e7deaef23e2da3e4f129727fd660f28f050 +Description: some old but cool stuff + This package will disappear in the next mirror update === modified file 'test/integration/framework' --- test/integration/framework 2010-09-04 13:28:47 +0000 +++ test/integration/framework 2010-09-14 16:57:46 +0000 @@ -211,7 +211,7 @@ fi local BUILT="$(dpkg-buildpackage -uc -us -a$ARCH 2> /dev/null)" local PKGS="$( echo "$BUILT" | grep '^dpkg-deb: building package' | cut -d'/' -f 2 | sed -e "s#'\.##")" - local SRCS="$( echo "$BUILT" | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._-]*$')" + local SRCS="$( echo "$BUILT" | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')" cd - > /dev/null for PKG in $PKGS; do echo "pool/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist === added file 'test/integration/test-policy-pinning' --- test/integration/test-policy-pinning 1970-01-01 00:00:00 +0000 +++ test/integration/test-policy-pinning 2010-09-14 16:57:46 +0000 @@ -0,0 +1,228 @@ +#!/bin/sh +set -e + +local TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +buildaptarchive +setupflataptarchive + +STATUS=$(readlink -f rootdir/var/lib/dpkg/status) +APTARCHIVE=$(readlink -f aptarchive) + +testequalpolicy() { + local SP="$1" + local AP="$2" + shift 2 + testequal "Package files: + $(echo "$SP" | awk '{ printf("%3s\n",$0) }') ${STATUS} + release a=now + $(echo "$AP" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ Packages + release c= +Pinned packages:" aptcache policy $* +} + +aptget update -qq +testequalpolicy 100 500 +testequalpolicy 990 500 -t now + +sed -i aptarchive/Release -e 1i"NotAutomatic: yes" +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicy 100 1 -o Test=NotAutomatic +testequalpolicy 990 1 -o Test=NotAutomatic -t now + +sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes" +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicy 100 100 -o Test=ButAutomaticUpgrades +testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now + +sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d' +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicy 100 500 -o Test=Automatic +testequalpolicy 990 500 -o Test=Automatic -t now + +buildsimplenativepackage "coolstuff" "all" "1.0" "stable" +buildsimplenativepackage "coolstuff" "all" "2.0~bpo1" "backports" + +setupaptarchive + +testequalpolicycoolstuff() { + local INSTALLED="${1:-(none)}" + local CANDIDATE="${2:-(none)}" + local AB="$3" + local AS="$4" + local PB="$5" + local PINVERSION="$6" + if [ -n "$PINVERSION" ]; then + PINVERSION="Package pin: $PINVERSION + " + fi + local IS="" + local IB="" + local SB="" + local SS="" + [ "$1" = "2.0~bpo1" ] && IB="***" && SB=" + 100 $STATUS" || IB=" " + [ "$1" = "1.0" ] && IS="***" && SS=" + 100 $STATUS" || IS=" " + local BPO1ARCHIVE="" + local BPO2ARCHIVE="" + if [ ! "$7" = "2.0~bpo2" ]; then + BPO1ARCHIVE=" $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ backports/main i386 Packages" + else + BPO2ARCHIVE=" + 2.0~bpo2 $PB + $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ backports/main i386 Packages" + SB="$(echo "$SB" | tail -n 1)" + shift + fi + shift 6 + testequal "coolstuff: + Installed: $INSTALLED + Candidate: $CANDIDATE + ${PINVERSION}Version table:${BPO2ARCHIVE} + $IB 2.0~bpo1 $PB +${BPO1ARCHIVE}$SB + $IS 1.0 $PB + $(echo "$AS" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ stable/main i386 Packages$SS" \ + aptcache policy coolstuff -o Policy=${INSTALLED}-${CANDIDATE}-${AB}-${AS}-${PB} $* +} + +testequalpolicycoolstuff "" "2.0~bpo1" 500 500 0 "" +testequalpolicycoolstuff "" "1.0" 500 990 0 "" -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -t backports +echo "Package: * +Pin: release n=backports +Pin-Priority: 200" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "1.0" 200 500 0 "" -o Test=GlobalPin +testequalpolicycoolstuff "" "1.0" 200 990 0 "" -o Test=GlobalPin -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -o Test=GlobalPin -t backports +echo "Package: * +Pin: release n=backports +Pin-Priority: 600" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "2.0~bpo1" 600 500 0 "" -o Test=GlobalPin +testequalpolicycoolstuff "" "1.0" 600 990 0 "" -o Test=GlobalPin -t stable +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 200" > rootdir/etc/apt/preferences +#FIXME: policy can't differentiate between two sources where one has a package specific pin in place +# testequalpolicycoolstuff "" "1.0" 500 500 200 "2.0~bpo1" -o Test=PackagePin +# testequalpolicycoolstuff "" "1.0" 990 500 200 "2.0~bpo1" -o Test=PackagePin -t backports +testequalpolicycoolstuff "" "1.0" 500 990 200 "2.0~bpo1" -o Test=PackagePin -t stable +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 600" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "2.0~bpo1" 500 500 600 "2.0~bpo1" -o Test=PackagePin +testequalpolicycoolstuff "" "1.0" 500 990 600 "2.0~bpo1" -o Test=PackagePin -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test=PackagePin -t backports + +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: -1" > rootdir/etc/apt/preferences +# testequalpolicycoolstuff "" "1.0" 500 500 -1 "2.0~bpo1" -o Test=PackagePin +# testequalpolicycoolstuff "" "1.0" 990 500 -1 "2.0~bpo1" -o Test=PackagePin -t backports +# testequalpolicycoolstuff "" "1.0" 500 990 -1 "2.0~bpo1" -o Test=PackagePin -t stable + +rm rootdir/etc/apt/preferences +sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes" +signreleasefiles +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicycoolstuff "" "1.0" 1 500 0 "" -o Test=NotAutomatic +testequalpolicycoolstuff "" "1.0" 1 990 0 "" -o Test=NotAutomatic -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -o Test=NotAutomatic -t backports +echo "Package: * +Pin: release n=backports +Pin-Priority: 200" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "1.0" 200 500 0 "" -o Test=NotAutomatic +echo "Package: * +Pin: release n=backports +Pin-Priority: 600" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "2.0~bpo1" 600 500 0 "" -o Test=NotAutomatic +testequalpolicycoolstuff "" "1.0" 600 990 0 "" -o Test=NotAutomatic -t stable +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 200" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "1.0" 1 500 200 "2.0~bpo1" -o Test=NotAutomatic +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 600" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "2.0~bpo1" 1 500 600 "2.0~bpo1" -o Test=NotAutomatic +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test=NotAutomatic -t backports +testequalpolicycoolstuff "" "1.0" 1 990 600 "2.0~bpo1" -o Test=NotAutomatic -t stable + +rm rootdir/etc/apt/preferences +sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes" +signreleasefiles +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicycoolstuff "" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports +echo "Package: * +Pin: release n=backports +Pin-Priority: 200" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "1.0" 200 500 0 "" -o Test=ButAutomaticUpgrades +echo "Package: * +Pin: release n=backports +Pin-Priority: 600" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "2.0~bpo1" 600 500 0 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "" "1.0" 600 990 0 "" -o Test=ButAutomaticUpgrades -t stable +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 200" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "1.0" 100 500 200 "2.0~bpo1" -o Test=ButAutomaticUpgrades +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 600" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "2.0~bpo1" 100 500 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades -t backports +testequalpolicycoolstuff "" "1.0" 100 990 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades -t stable + +rm rootdir/etc/apt/preferences +aptget install coolstuff -qq > /dev/null 2> /dev/null +testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades +aptget dist-upgrade -qq > /dev/null 2> /dev/null +testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "1.0" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable +testequalpolicycoolstuff "1.0" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports + +aptget install coolstuff -t backports -qq > /dev/null 2> /dev/null +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades +aptget dist-upgrade -qq > /dev/null 2> /dev/null +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports + +rm incoming/backports.main.pkglist incoming/backports.main.srclist +buildsimplenativepackage "coolstuff" "all" "2.0~bpo2" "backports" +setupaptarchive + +sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes" +signreleasefiles +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 500 0 "" "2.0~bpo2" -o Test=NotAutomatic +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 990 0 "" "2.0~bpo2" -o Test=NotAutomatic -t stable +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test=NotAutomatic -t backports + +sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes" +signreleasefiles +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 500 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 990 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -t stable +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -t backports