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

Re: Fwd: "NotAutomatic: yes" does not affect source packages



On Wed, Jun 28, 2023 at 01:50:47PM +0200, David Kalnischkies wrote:
> On Wed, Jun 28, 2023 at 09:04:26AM +0200, Christof Warlich wrote:
> > Can anyone tell why source packages are not treated the same as binary
> > packages for “NotAutomatic: yes” repos? It breaks the expectation that
> > you always get the corresponding sources for a binary package.
> 
> Note that you expectation is incorrect. The man page reads:
> 
> | [apt-get source] will then find and download into the current
> | directory the newest available version of that source package
> 
> So you don't always get the corresponding sources for a binary
> package but the newest, which in your case happens to be the one
> from backports. Works as documented…

So the thing is that this is not true, apt source picks the
right version for binNMUs. The code is there to use the binary
version to find the matching source version, but it's wrong,
and doesn't make sense, the commit below explains that, but
also I think for binNMUs, the binary version may even be
overriding the release tag.

I have not pushed it yet because I wanted to add a test
and then forgot about it.

If we want to commit to always fetching the latest version we'd
have to remove the code bit, but my preference is to make it work
as expected and then change the doc tbh.

From 82ebef1807d79220fe8dd43ef6cf87aa6e3fb430 Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <julian.klode@canonical.com>
Date: Thu, 8 Dec 2022 19:28:41 +0100
Subject: [PATCH] Fix version finding for binary version

When we did apt source foo, and foo is a binary package, we try
to lookup the candidate and use that, but we only set the version
tag when the source version is different from the package version.

So if we have packages:

    foo         Version: 1+foo      Source: foo (= 1)
    foo         Version: 2+foo      Source: foo (= 2)
    bar         Version: 1          Source: bar (= 1)
    bar         Version: 2          Source: bar (= 2)

And we pin the "1" versions higher than 2,

    apt source foo downloads version 1
    apt source bar downloads version 2

This fixes it so that apt source bar also downloads version 1.

Note that we cannot set the VerTag if we have a RelTag, as the
RelTag must take precedence. This can be enhanced so that if there
are multiple versions matching the rel tag, the candidate takes
priority but this is not implemented so far.
---
 apt-private/private-source.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc
index b7168cba9..b3d918756 100644
--- a/apt-private/private-source.cc
+++ b/apt-private/private-source.cc
@@ -215,7 +215,7 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name,
 	 {
 	    if (strcmp(Ver.SourcePkgName(),Ver.ParentPkg().Name()) != 0)
 	       Src = Ver.SourcePkgName();
-	    if (VerTag.empty() == true && strcmp(Ver.SourceVerStr(),Ver.VerStr()) != 0)
+	    if (VerTag.empty() == true && RelTag.empty())
 	       VerTag = Ver.SourceVerStr();
 	 }
       }
-- 
2.40.1



-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en

Attachment: signature.asc
Description: PGP signature


Reply to: