Skip to content

Commit 9a1d042

Browse files
committed
- BugFix: 'yaourt' and 'pacaur' no longer honor "-a" option when
querying outdated foreign packages; - Refactored getForeignRepositoryToolName method.
1 parent f7dbf97 commit 9a1d042

File tree

10 files changed

+108
-88
lines changed

10 files changed

+108
-88
lines changed

CHANGELOG

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
0.9.0
1+
0.9.0 (dev)
22
Added an options dialog to Octopi and Notifier.
33
Added slovenian translation (thanks to the translation crew).
44
Added "Install Reason" field at Info tab.
@@ -19,6 +19,8 @@
1919
was reporting false newer packages.
2020
BugFix: System upgrade button was not disabled while synching packages in notifier.
2121
BugFix: searchlineedit font fix.
22+
BugFix: 'yaourt' and 'pacaur' no longer honor "-a" option when querying outdated
23+
foreign packages.
2224

2325
0.8.1
2426
BugFix: Updated CHAKRA RSS site (thanks to s8321414).

src/mainwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ MainWindow::MainWindow(QWidget *parent) :
5454
QMainWindow(parent), ui(new Ui::MainWindow), m_packageModel(new PackageModel(m_packageRepo))
5555
{
5656
m_hasAURTool =
57-
UnixCommand::hasTheExecutable(StrConstants::getForeignRepositoryToolName()) && !UnixCommand::isRootRunning();
57+
UnixCommand::hasTheExecutable(Package::getForeignRepositoryToolName()) && !UnixCommand::isRootRunning();
5858

5959
m_packageRepo.registerDependency(*m_packageModel);
6060
m_foundFilesInPkgFileList = new QList<QModelIndex>();

src/mainwindow_refresh.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ void MainWindow::showToolButtonAUR()
10741074
void MainWindow::refreshToolBar()
10751075
{
10761076
m_hasAURTool =
1077-
UnixCommand::hasTheExecutable(StrConstants::getForeignRepositoryToolName()) && !UnixCommand::isRootRunning();
1077+
UnixCommand::hasTheExecutable(Package::getForeignRepositoryToolName()) && !UnixCommand::isRootRunning();
10781078

10791079
if (m_hasAURTool)
10801080
{
@@ -1266,7 +1266,7 @@ void MainWindow::refreshTabInfo(bool clearContents, bool neverQuit)
12661266
{
12671267
PackageInfoData kcp;
12681268

1269-
if (StrConstants::getForeignRepositoryToolName() == "kcp")
1269+
if (Package::getForeignRepositoryToolName() == "kcp")
12701270
{
12711271
QEventLoop el;
12721272
QFuture<PackageInfoData> f;
@@ -1286,15 +1286,15 @@ void MainWindow::refreshTabInfo(bool clearContents, bool neverQuit)
12861286
html += "<a id=\"" + anchorBegin + "\"></a>";
12871287
html += "<h2>" + pkgName + "</h2>";
12881288

1289-
if (StrConstants::getForeignRepositoryToolName() != "kcp")
1289+
if (Package::getForeignRepositoryToolName() != "kcp")
12901290
{
12911291
html += "<a style=\"font-size:16px;\">" + pkgDescription + "</a>";
12921292
html += "<table border=\"0\">";
12931293
html += "<tr><th width=\"20%\"></th><th width=\"80%\"></th></tr>";
12941294
html += "<tr><td>" + version + "</td><td>" + package->version + "</td></tr>";
12951295

1296-
if (StrConstants::getForeignRepositoryToolName() == "yaourt" ||
1297-
StrConstants::getForeignRepositoryToolName() == "pacaur")
1296+
if (Package::getForeignRepositoryToolName() == "yaourt" ||
1297+
Package::getForeignRepositoryToolName() == "pacaur")
12981298
{
12991299
QString url = Package::getAURUrl(pkgName);
13001300
if (!url.isEmpty() && !url.contains("(null)"))
@@ -1303,7 +1303,7 @@ void MainWindow::refreshTabInfo(bool clearContents, bool neverQuit)
13031303
}
13041304
}
13051305
}
1306-
else if (StrConstants::getForeignRepositoryToolName() == "kcp")
1306+
else if (Package::getForeignRepositoryToolName() == "kcp")
13071307
{
13081308
html += "<a style=\"font-size:16px;\">" + kcp.description + "</a>";
13091309
html += "<table border=\"0\">";

src/mainwindow_transaction.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,20 +1194,20 @@ void MainWindow::doInstallAURPackage()
11941194
}
11951195
if (package->repository != StrConstants::getForeignRepositoryName()) {
11961196
std::cerr << "Octopi could not install selection using " <<
1197-
StrConstants::getForeignRepositoryToolName().toLatin1().data() << std::endl;
1197+
Package::getForeignRepositoryToolName().toLatin1().data() << std::endl;
11981198
return;
11991199
}
12001200

1201-
if (StrConstants::getForeignRepositoryToolName() != "pacaur" &&
1202-
StrConstants::getForeignRepositoryToolName() != "kcp")
1201+
if (Package::getForeignRepositoryToolName() != "pacaur" &&
1202+
Package::getForeignRepositoryToolName() != "kcp")
12031203
listOfTargets += StrConstants::getForeignRepositoryTargetPrefix() + package->name + " ";
12041204
else
12051205
listOfTargets += package->name + " ";
12061206
}
12071207

12081208
if (listOfTargets.isEmpty()) {
12091209
std::cerr << "Octopi could not install selection using " <<
1210-
StrConstants::getForeignRepositoryToolName().toLatin1().data() << std::endl;
1210+
Package::getForeignRepositoryToolName().toLatin1().data() << std::endl;
12111211
return;
12121212
}
12131213

@@ -1603,7 +1603,7 @@ void MainWindow::toggleSystemActions(const bool value)
16031603
m_actionMenuMirrorCheck->setEnabled(value);
16041604
}
16051605

1606-
if (isAURGroupSelected() && StrConstants::getForeignRepositoryToolName() == "kcp")
1606+
if (isAURGroupSelected() && Package::getForeignRepositoryToolName() == "kcp")
16071607
{
16081608
ui->actionSyncPackages->setEnabled(true);
16091609
}
@@ -1722,7 +1722,7 @@ void MainWindow::pacmanProcessFinished(int exitCode, QProcess::ExitStatus exitSt
17221722
{
17231723
metaBuildPackageList();
17241724
}
1725-
else if (StrConstants::getForeignRepositoryToolName() == "kcp")
1725+
else if (Package::getForeignRepositoryToolName() == "kcp")
17261726
{
17271727
metaBuildPackageList();
17281728
delete m_pacmanExec;

src/package.cpp

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,9 @@ QStringList *Package::getOutdatedAURStringList()
332332
{
333333
QStringList * res = new QStringList();
334334

335-
if (StrConstants::getForeignRepositoryToolName() != "yaourt" &&
336-
StrConstants::getForeignRepositoryToolName() != "pacaur" &&
337-
StrConstants::getForeignRepositoryToolName() != "kcp")
335+
if (getForeignRepositoryToolName() != "yaourt" &&
336+
getForeignRepositoryToolName() != "pacaur" &&
337+
getForeignRepositoryToolName() != "kcp")
338338
return res;
339339

340340
QString outPkgList = UnixCommand::getOutdatedAURPackageList();
@@ -345,8 +345,8 @@ QStringList *Package::getOutdatedAURStringList()
345345
{
346346
QStringList parts = packageTuple.split(' ', QString::SkipEmptyParts);
347347
{
348-
if (StrConstants::getForeignRepositoryToolName() == "yaourt" ||
349-
StrConstants::getForeignRepositoryToolName() == "kcp")
348+
if (getForeignRepositoryToolName() == "yaourt" ||
349+
getForeignRepositoryToolName() == "kcp")
350350
{
351351
QString pkgName;
352352
pkgName = parts[0];
@@ -355,7 +355,13 @@ QStringList *Package::getOutdatedAURStringList()
355355
pkgName = pkgName.remove("[1;36m");
356356
pkgName = pkgName.remove("[1;32m");
357357
pkgName = pkgName.remove("[m");
358-
pkgName = pkgName.remove("[1m");
358+
pkgName = pkgName.remove("[1m");
359+
360+
if (getForeignRepositoryToolName() == "yaourt")
361+
{
362+
if (!pkgName.startsWith(StrConstants::getForeignRepositoryTargetPrefix()))
363+
continue;
364+
}
359365

360366
if (pkgName.contains(StrConstants::getForeignRepositoryTargetPrefix(), Qt::CaseInsensitive))
361367
{
@@ -367,11 +373,14 @@ QStringList *Package::getOutdatedAURStringList()
367373
}
368374
}
369375
}
370-
else if (StrConstants::getForeignRepositoryToolName() == "pacaur")
376+
else if (getForeignRepositoryToolName() == "pacaur")
371377
{
372378
QString pkgName;
373379
if (parts.count() >= 2)
374380
{
381+
if (parts[1] != StrConstants::getForeignRepositoryTargetPrefix())
382+
continue;
383+
375384
pkgName = parts[2];
376385
pkgName = pkgName.remove("\033");
377386
pkgName = pkgName.remove("[1;31m");
@@ -381,7 +390,7 @@ QStringList *Package::getOutdatedAURStringList()
381390
pkgName = pkgName.remove("[1;39m");
382391
pkgName = pkgName.remove("[m");
383392
pkgName = pkgName.remove("[0m");
384-
pkgName = pkgName.remove("[1m");
393+
pkgName = pkgName.remove("[1m");
385394

386395
//Let's ignore the "IgnorePkg" list of packages...
387396
if (!ignorePkgList.contains(pkgName))
@@ -711,7 +720,7 @@ QString Package::getAURUrl(const QString &pkgName)
711720
{
712721
QString url="";
713722

714-
if (StrConstants::getForeignRepositoryToolName() != "kcp")
723+
if (getForeignRepositoryToolName() != "kcp")
715724
{
716725
QString pkgInfo = UnixCommand::getAURUrl(pkgName);
717726
url = getURL(pkgInfo);
@@ -793,7 +802,7 @@ QList<PackageListData> * Package::getAURPackageList(const QString& searchString)
793802
pkgVotes = 0;
794803

795804
//Chakra does not have popularity support in CCR
796-
QString aurTool = StrConstants::getForeignRepositoryToolName();
805+
QString aurTool = getForeignRepositoryToolName();
797806

798807
if (aurTool != "chaser" && aurTool != "pacaur" && strVotes.count() > 0)
799808
{
@@ -1508,9 +1517,9 @@ QHash<QString, QString> Package::getAUROutdatedPackagesNameVersion()
15081517
QHash<QString, QString> hash;
15091518

15101519
if(UnixCommand::getLinuxDistro() == ectn_CHAKRA ||
1511-
(StrConstants::getForeignRepositoryToolName() != "yaourt" &&
1512-
StrConstants::getForeignRepositoryToolName() != "pacaur" &&
1513-
StrConstants::getForeignRepositoryToolName() != "kcp"))
1520+
(getForeignRepositoryToolName() != "yaourt" &&
1521+
getForeignRepositoryToolName() != "pacaur" &&
1522+
getForeignRepositoryToolName() != "kcp"))
15141523
{
15151524
return hash;
15161525
}
@@ -1519,8 +1528,8 @@ QHash<QString, QString> Package::getAUROutdatedPackagesNameVersion()
15191528
QStringList listOfPkgs = res.split("\n", QString::SkipEmptyParts);
15201529
QStringList ignorePkgList = UnixCommand::getIgnorePkgsFromPacmanConf();
15211530

1522-
if ((StrConstants::getForeignRepositoryToolName() == "yaourt") ||
1523-
(StrConstants::getForeignRepositoryToolName() == "kcp"))
1531+
if ((getForeignRepositoryToolName() == "yaourt") ||
1532+
(getForeignRepositoryToolName() == "kcp"))
15241533
{
15251534
foreach (QString line, listOfPkgs)
15261535
{
@@ -1537,16 +1546,19 @@ QHash<QString, QString> Package::getAUROutdatedPackagesNameVersion()
15371546
QStringList nameVersion = line.split(" ", QString::SkipEmptyParts);
15381547
QString pkgName = nameVersion.at(0);
15391548

1540-
if (StrConstants::getForeignRepositoryToolName() == "kcp")
1549+
if (getForeignRepositoryToolName() == "kcp")
15411550
{
15421551
//Let's ignore the "IgnorePkg" list of packages...
15431552
if (!ignorePkgList.contains(pkgName))
15441553
{
15451554
hash.insert(pkgName, nameVersion.at(1));
15461555
}
15471556
}
1548-
else
1557+
else //It's yaourt!
15491558
{
1559+
if (!pkgName.startsWith(StrConstants::getForeignRepositoryTargetPrefix()))
1560+
continue;
1561+
15501562
//Let's ignore the "IgnorePkg" list of packages...
15511563
if (!ignorePkgList.contains(pkgName))
15521564
{
@@ -1559,7 +1571,7 @@ QHash<QString, QString> Package::getAUROutdatedPackagesNameVersion()
15591571
}
15601572
}
15611573
}
1562-
else if (StrConstants::getForeignRepositoryToolName() == "pacaur")
1574+
else if (getForeignRepositoryToolName() == "pacaur")
15631575
{
15641576
foreach (QString line, listOfPkgs)
15651577
{
@@ -1574,6 +1586,10 @@ QHash<QString, QString> Package::getAUROutdatedPackagesNameVersion()
15741586
line = line.remove("[1m");
15751587

15761588
QStringList sl = line.split(" ", QString::SkipEmptyParts);
1589+
1590+
if (sl[1] != StrConstants::getForeignRepositoryTargetPrefix())
1591+
continue;
1592+
15771593
if (sl.count() >= 6)
15781594
{
15791595
hash.insert(sl.at(2), sl.at(5));
@@ -1701,3 +1717,25 @@ bool Package::hasPacmanDatabase()
17011717

17021718
return answer;
17031719
}
1720+
1721+
QString Package::getForeignRepositoryToolName()
1722+
{
1723+
static bool first=true;
1724+
static QString ret;
1725+
1726+
if (first)
1727+
{
1728+
if( UnixCommand::getLinuxDistro() == ectn_CHAKRA )
1729+
ret = QLatin1String( "chaser" );
1730+
else if (UnixCommand::getLinuxDistro() == ectn_KAOS)
1731+
ret = QLatin1String( "kcp" );
1732+
else if (UnixCommand::hasTheExecutable("pacaur"))
1733+
ret = QLatin1String( "pacaur" );
1734+
else
1735+
ret = QLatin1String( "yaourt" );
1736+
1737+
first = false;
1738+
}
1739+
1740+
return ret;
1741+
}

src/package.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ class Package{
182182
static QString parseSearchString( QString searchStr, bool exactMatch = false );
183183

184184
static bool hasPacmanDatabase();
185+
186+
static QString getForeignRepositoryToolName();
185187
};
186188

187189
#endif

src/pacmanexec.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -880,13 +880,13 @@ void PacmanExec::doAURUpgrade(const QString &listOfPackages)
880880
{
881881
m_lastCommandList.clear();
882882

883-
if (StrConstants::getForeignRepositoryToolName() == "pacaur")
883+
if (Package::getForeignRepositoryToolName() == "pacaur")
884884
{
885-
m_lastCommandList.append(StrConstants::getForeignRepositoryToolName() + " -Sa " + listOfPackages + ";");
885+
m_lastCommandList.append(Package::getForeignRepositoryToolName() + " -Sa " + listOfPackages + ";");
886886
}
887-
else if (StrConstants::getForeignRepositoryToolName() == "yaourt")
887+
else if (Package::getForeignRepositoryToolName() == "yaourt")
888888
{
889-
m_lastCommandList.append(StrConstants::getForeignRepositoryToolName() + " -S " + listOfPackages + ";");
889+
m_lastCommandList.append(Package::getForeignRepositoryToolName() + " -S " + listOfPackages + ";");
890890
}
891891

892892
m_lastCommandList.append("echo -e;");
@@ -904,13 +904,13 @@ void PacmanExec::doAURInstall(const QString &listOfPackages)
904904
m_lastCommandList.clear();
905905

906906
if (UnixCommand::getLinuxDistro() == ectn_KAOS)
907-
m_lastCommandList.append(StrConstants::getForeignRepositoryToolName() + " -i " + listOfPackages + ";");
908-
else if (StrConstants::getForeignRepositoryToolName() == "pacaur")
909-
m_lastCommandList.append(StrConstants::getForeignRepositoryToolName() + " -Sa " + listOfPackages + ";");
910-
else if (StrConstants::getForeignRepositoryToolName() == "yaourt")
911-
m_lastCommandList.append(StrConstants::getForeignRepositoryToolName() + " -S " + listOfPackages + ";");
912-
else if (StrConstants::getForeignRepositoryToolName() == "chaser")
913-
m_lastCommandList.append(StrConstants::getForeignRepositoryToolName() + " install " + listOfPackages + ";");
907+
m_lastCommandList.append(Package::getForeignRepositoryToolName() + " -i " + listOfPackages + ";");
908+
else if (Package::getForeignRepositoryToolName() == "pacaur")
909+
m_lastCommandList.append(Package::getForeignRepositoryToolName() + " -Sa " + listOfPackages + ";");
910+
else if (Package::getForeignRepositoryToolName() == "yaourt")
911+
m_lastCommandList.append(Package::getForeignRepositoryToolName() + " -S " + listOfPackages + ";");
912+
else if (Package::getForeignRepositoryToolName() == "chaser")
913+
m_lastCommandList.append(Package::getForeignRepositoryToolName() + " install " + listOfPackages + ";");
914914

915915
m_lastCommandList.append("echo -e;");
916916
m_lastCommandList.append("read -n 1 -p \"" + StrConstants::getPressAnyKey() + "\"");
@@ -926,26 +926,26 @@ void PacmanExec::doAURRemove(const QString &listOfPackages)
926926
{
927927
m_lastCommandList.clear();
928928

929-
if (StrConstants::getForeignRepositoryToolName() == "chaser" ||
930-
StrConstants::getForeignRepositoryToolName() == "kcp")
929+
if (Package::getForeignRepositoryToolName() == "chaser" ||
930+
Package::getForeignRepositoryToolName() == "kcp")
931931
{
932932
m_lastCommandList.append("pacman -R " + listOfPackages + ";");
933933
}
934934
else
935935
{
936-
m_lastCommandList.append(StrConstants::getForeignRepositoryToolName() +
936+
m_lastCommandList.append(Package::getForeignRepositoryToolName() +
937937
" -R " + listOfPackages + ";");
938938
}
939939

940940
m_lastCommandList.append("echo -e;");
941941
m_lastCommandList.append("read -n 1 -p \"" + StrConstants::getPressAnyKey() + "\"");
942942

943-
if (StrConstants::getForeignRepositoryToolName() == "kcp")
943+
if (Package::getForeignRepositoryToolName() == "kcp")
944944
m_commandExecuting = ectn_REMOVE_KCP_PKG;
945945
else
946946
m_commandExecuting = ectn_RUN_IN_TERMINAL;
947947

948-
if (StrConstants::getForeignRepositoryToolName() != "yaourt" && StrConstants::getForeignRepositoryToolName() != "pacaur")
948+
if (Package::getForeignRepositoryToolName() != "yaourt" && Package::getForeignRepositoryToolName() != "pacaur")
949949
m_unixCommand->runCommandInTerminal(m_lastCommandList);
950950
else
951951
m_unixCommand->runCommandInTerminalAsNormalUser(m_lastCommandList);

0 commit comments

Comments
 (0)