ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Alexey Tourbin <at@altlinux.ru>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] apt virtual packages
Date: Tue, 10 Oct 2006 04:40:28 +0400
Message-ID: <20061010004028.GH23308@localhost.localdomain> (raw)
In-Reply-To: <20061009224152.GC18762@basalt.office.altlinux.org>

[-- Attachment #1: Type: text/plain, Size: 3185 bytes --]

On Tue, Oct 10, 2006 at 02:41:52AM +0400, Dmitry V. Levin wrote:
> > Можно конечно в багзиллу написать или самому
> > в апте ковыряться, но может быть уже кто-то знает?
> 
> Я буду признателен тому, кто решит эту задачу (т.е. зафиксит apt).

Я вроде бы зафиксил, хотя меня гложут сомнения.

--- apt-get.cc-	2006-10-10 03:04:25 +0400
+++ apt-get.cc	2006-10-10 04:30:30 +0400
@@ -1275,14 +1275,18 @@ bool TryToInstall(pkgCache::PkgIterator 
 	    continue;
 	 }
 	 // Is the provides pointing to the candidate version?
-	 if (PrvPkgCandVer == Prv.OwnerVer())
+	 bool good = false;
+	 for (; PrvPkgCandVer.end() == false; ++PrvPkgCandVer)
 	 {
-	    // Yes, it is. This is a good solution.
-	    GoodSolutions.push_back(PrvPkg);
-	    if (instVirtual)
-		break;
-	    continue;
+	    if (PrvPkgCandVer == Prv.OwnerVer())
+	    {
+	       // Yes, it is. This is a good solution.
+	       good = true;
+	       GoodSolutions.push_back(PrvPkg);
+	    }
 	 }
+	 if (good && instVirtual)
+	    break;
       }
       vector<string> GoodSolutionNames;
       unsigned int GoodSolutionsInstalled = 0, GoodSolutionInstallNumber = 0;
End of patch

Вот полностью релевантный кусок кода (исправленный).

  1270           pkgCache::VerIterator PrvPkgCandVer =
  1271                                   Cache[PrvPkg].CandidateVerIter(Cache);
  1272           if (PrvPkgCandVer.end() == true)
  1273           {
  1274              // Packages without a candidate version are not good solutions.
  1275              continue;
  1276           }
  1277           // Is the provides pointing to the candidate version?
  1278           bool good = false;
  1279           for (; PrvPkgCandVer.end() == false; ++PrvPkgCandVer)
  1280           {
  1281              if (PrvPkgCandVer == Prv.OwnerVer())
  1282              {
  1283                 // Yes, it is. This is a good solution.
  1284                 good = true;
  1285                 GoodSolutions.push_back(PrvPkg);
  1286              }
  1287           }
  1288           if (good && instVirtual)
  1289              break;
  1290        }

Здесь PrvPkg -- это реальный пакет, который провайдит виртуальную
зависимость.  Мы проверяем, есть ли у реального пакета "версия".
(Что такое "версия"?  Я плохо понимаю внутренние структуры апта, поэтому
и гложут сомнения.)  Если реальный пакет без версии, тогда он не тянет
на установку через виртуальную зависимость.  Далее, в оригинальном коде
проверяется нечто странное, что я не могу до конца сформулировать.

	if (PrvPkgCandVer == Prv.OwnerVer())

Смысле в том, что версия PrvPkgCandVer, найденная через reverse lookup,
должна совпадать с непосредственной версией Prv.OwnerVer().  Тогда пакет
-- хороший кандидат.  Но PrvPkgCandVer -- это итератор.  Кстати, кажется
Prv.OwnerVer это тоже итератор.  Если в репозитарии оказывается два
пакета с одинаковым именем и версией, то совпадение сразу же не
гарантируется.  Один из этих итераторов нужно "прокрутить" и проверять
условие в цикле, что я и делаю.

Скажите, кто-нибудь понимает внутренние структуры апта?  Муть какая-то.
Где об этом можно что-нибудь прочитать?

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2006-10-10  0:40 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-09 22:32 Alexey Tourbin
2006-10-09 22:41 ` Dmitry V. Levin
2006-10-10  0:40   ` Alexey Tourbin [this message]
2006-10-10 15:39     ` Dmitry V. Levin
2006-10-10 15:52       ` Alexey Tourbin
2006-10-10 22:11         ` Dmitry V. Levin
2006-10-11  0:16           ` Alexey Tourbin
2006-10-12  9:18             ` Serge Pavlovsky
2006-12-07 22:52             ` Dmitry V. Levin
2006-12-08 21:27               ` Alexey Tourbin
2006-12-08 21:43                 ` Dmitry V. Levin
2006-12-08 21:59                   ` Alexey Tourbin
2006-12-08 22:01                 ` Dmitry V. Levin
2006-12-08 22:23                   ` Dmitry V. Levin
2006-12-13  3:35               ` Alexey Tourbin
2006-12-14 23:40               ` Alexey Tourbin
2006-12-14 23:46                 ` Alexey Tourbin
2006-12-14 23:54                   ` Alexey Tourbin
2006-12-15  1:25                 ` Alexey Tourbin
2006-12-15 13:49                   ` Michael Shigorin
2006-12-15 16:52                     ` Alexey Tourbin
2006-12-15 22:27                   ` Dmitry V. Levin
2006-12-15 22:42                     ` Alexey Tourbin
2006-12-16 12:03                       ` Alexey I. Froloff
2006-12-16 20:19                         ` Alexey Tourbin
2006-12-16 21:02                           ` Dmitry V. Levin
2006-12-16 21:08                             ` Alexey Tourbin
2006-12-16 21:26                               ` Dmitry V. Levin
2006-12-16 21:42                                 ` Alexey Tourbin
2006-12-17 13:51                             ` Alexey I. Froloff
2006-12-17 14:12                               ` Alexey Tourbin
2006-12-17 16:47                                 ` [devel] Papadimitriou Alexey Tourbin
2006-12-17 16:58                                 ` [devel] apt virtual packages Alex V. Myltsev
2006-12-17 17:45                                   ` Alexey Tourbin
2006-12-17 17:57                                     ` [devel] [JT] " Alex V. Myltsev
2006-12-17 18:13                                       ` Alexey Tourbin
2006-12-17  9:58                     ` [devel] " Alexey Tourbin
2006-12-17 10:02                       ` Alexey Tourbin
2006-12-17 10:37                         ` Alexey Tourbin
2006-12-17 13:43                   ` [devel] [PATCH] " Alexey Tourbin
2006-12-17 13:46                     ` [devel] gendiff Alexey Tourbin
2006-12-17 14:14                     ` [devel] [PATCH] apt virtual packages Alexey Tourbin
2006-12-17 16:09                       ` Alexey Tourbin
2006-12-17 16:15                         ` Alexey Tourbin
2006-12-17 17:05                           ` Hihin Ruslan
2006-12-17 17:17                             ` Alexey Tourbin
2006-12-17 16:41                         ` Alexey Tourbin
2006-12-17 16:49                           ` [devel] std::sort Alex V. Myltsev
2006-12-17 17:15                             ` Alexey Tourbin
2006-12-17 17:54                               ` [devel] [JT] std::sort Alex V. Myltsev
2006-12-17 18:06                                 ` Alexey Tourbin
2006-12-17 19:42                                 ` Hihin Ruslan
2006-12-17 20:01                                   ` Hihin Ruslan
2006-12-17 20:33                                     ` Hihin Ruslan
2006-12-17 20:18                                   ` Alex V. Myltsev
2006-12-18  7:51                                     ` Hihin Ruslan
2006-12-18 10:39                         ` [devel] [PATCH] apt virtual packages Led
2006-12-18 13:17                           ` Alexey Tourbin
2006-12-17 16:51                       ` Dmitry V. Levin
2006-12-20 17:25                     ` Alexey Tourbin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061010004028.GH23308@localhost.localdomain \
    --to=at@altlinux.ru \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git