[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#272557: provide NotAutomatic option



Hi,

looks good, applies cleanly & works, but let me be picky and
ask for some more changes anyhow:


On Fri, Nov 11, 2016 at 12:05:52PM +0000, James Clarke wrote:
> On Wed, Nov 09, 2016 at 02:31:02PM +0100, David Kalnischkies wrote:
>       e.g. <literal>APT::FTPArchive::Release::Origin</literal>. The supported fields
>       are <literal>Origin</literal>, <literal>Label</literal>, <literal>Suite</literal>,
>       <literal>Version</literal>, <literal>Codename</literal>, <literal>Date</literal>,
> +     <literal>NotAutomatic</literal>, <literal>ButAutomaticUpgrades</literal>,
>       <literal>Valid-Until</literal>, <literal>Signed-By</literal>, <literal>Architectures</literal>,
>       <literal>Components</literal> and <literal>Description</literal>.</para></listitem>

add "Acquire-By-Hash" here as your code supports it and the other option
(might) do more (in future), so it shouldn't hurt™.


> +   // Read configuration for string fields, but don't output them
> +   for(map<string,string>::iterator I = Fields.begin();
> +       I != Fields.end();
> +       ++I)

Please use c++11 for loops here, e.g.: for (auto &&I: Fields)

> +   {
> +      string Config = string("APT::FTPArchive::Release::") + I->first;
> +      I->second = _config->Find(Config, I->second.c_str());
                                                    ^^^^^^^^
Unneeded as that parameter can be a std::string instance.

> -      if (Value == "")
> +      if (I->second == "")

as you change that line use .empty() here. (Same difference)

>  # ensure we have it in the Release file
> -testsuccess grep "Acquire-By-Hash: true" aptarchive/dists/unstable/*Release
> +testsuccess grep "Acquire-By-Hash: yes" aptarchive/dists/unstable/*Release

Good find! Thansk deity@ apt is so lax in syntax checking… :)

> +#
> +# main()
> +#

No idea why we ended up with testcases having those strangers,
but lets not add more of those…

> +configcompression 'gz' '.'
> +confighashes 'SHA256' 'SHA512'

Remove those two as well as the testcase has no specific needs.

> +# build one package
> +buildsimplenativepackage 'foo' 'i386' '1' 'unstable'
> +buildaptarchivefromincoming

You aren't using a 'real' package in this test, so we can save some
cpu cycles by just faking a few as needed and play with them:

insertpackage 'unstable' 'foo' 'i386' '1'
insertpackage 'experimental' 'foo' 'i386' '3'
setupaptarchive

# … greps here …

testsuccessequal '<output installing foo in version 1>' apt install foo -s


And while we are at it, even if not strictly needed, lets add a But…
case by sprinkling in a few more lines in the right places (we have to
waste the cpu cycles we saved above somehow after all ;) )

getnotautomaticfromsuite() {
	case "$1" in
	experimental|backports) echo 'yes';;
	esac
}
# FIXME: add support for that in framework
getbutautomaticupgradesfromsuite() {
	case "$1" in
	backports) echo 'yes';;
	esac
}
insertpackage 'backports' 'foo' 'i386' '3~bpo1'

insertinstalledpackage 'foo' 'i386' '2'
testsuccessequal '<output installing foo in version 3~bpo1>' apt install foo -s


Best regards

David Kalnischkies

Attachment: signature.asc
Description: PGP signature


Reply to: