Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37402665
en ru br
Репозитории ALT
S:0.5.15lorg2-alt86
5.1: 0.5.15lorg2-alt33.M50P.1
4.1: 0.5.15lorg2-alt20.M41.1
4.0: 0.5.15lorg2-alt18.M40.1
+updates:0.5.15lorg2-alt18
3.0: 0.5.15cnc6-alt16
www.altlinux.org/Changes

Группа :: Система/Настройка/Пакеты
Пакет: apt

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: apt-0.5.5cnc4.1-alt-PrioComp.patch
Скачать


diff --git a/apt/apt-pkg/algorithms.cc b/apt/apt-pkg/algorithms.cc
index e8abff2..a5bf5ca 100644
--- a/apt/apt-pkg/algorithms.cc
+++ b/apt/apt-pkg/algorithms.cc
@@ -1402,6 +1402,27 @@ bool pkgProblemResolver::RemoveDepends()
    return true;
 }
 									/*}}}*/
+/* Like strcmp, but compares digit sections by number value.
+ * E.g.: tar-1.10 > tar-1.9 > tar-1.1a
+ * (while strcmp gives tar-1.10 < tar-1.9). */
+static int nameCompare(const char* n1, const char* n2)
+{
+   while(*n1 && *n2) {
+      if(isdigit(*n1) && isdigit(*n2)) {
+	 unsigned long long i1, i2;
+	 i1 = strtoull(n1, const_cast<char **>(&n1), 10);
+	 i2 = strtoull(n2, const_cast<char **>(&n2), 10);
+	 if(i1 != i2)
+	    return (i1 > i2) ? 1 : -1;
+      } else if(*n1 != *n2) {
+	 return (*n1 > *n2) ? 1 : -1;
+      } else {
+	 n1++;
+	 n2++;
+      }
+   }
+   return 0;
+}
 
 // PrioSortList - Sort a list of versions by priority			/*{{{*/
 // ---------------------------------------------------------------------
@@ -1423,7 +1444,9 @@ static int PrioComp(const void *A,const void *B)
    
    if (L->Priority != R->Priority)
       return L->Priority - R->Priority;
-   return strcmp(L.ParentPkg().Name(),R.ParentPkg().Name());
+   // PrioComp("gcc2","gcc3") == 1
+   // PrioComp("gcc2", gcc10") == 1
+   return nameCompare(R.ParentPkg().Name(),L.ParentPkg().Name());
 }
 void pkgPrioSortList(pkgCache &Cache,pkgCache::Version **List)
 {
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin