Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Akabei core library
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
2
Merge Requests
2
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chakra
Akabei
Akabei core library
Commits
be30e11c
Commit
be30e11c
authored
Mar 06, 2016
by
Fabian Kosmale
Committed by
Fabian Kosmale
Mar 10, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix clazy warning: container-anti-pattern
parent
5ef63eab
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
45 additions
and
23 deletions
+45
-23
lib/akabeibackend.cpp
lib/akabeibackend.cpp
+2
-1
lib/akabeierror.cpp
lib/akabeierror.cpp
+4
-2
lib/akabeipackage.cpp
lib/akabeipackage.cpp
+2
-1
lib/akabeirunnerrunnable_p.cpp
lib/akabeirunnerrunnable_p.cpp
+12
-4
lib/akabeivalidatorrunnable_p.cpp
lib/akabeivalidatorrunnable_p.cpp
+5
-2
lib/libarchive++/archivehandler.cpp
lib/libarchive++/archivehandler.cpp
+2
-3
lib/libarchive++/polkitarchivehandler.cpp
lib/libarchive++/polkitarchivehandler.cpp
+3
-1
lib/operations/akabeipolkitreinstalloperation.cpp
lib/operations/akabeipolkitreinstalloperation.cpp
+2
-1
lib/operations/akabeipolkitremoveoperation.cpp
lib/operations/akabeipolkitremoveoperation.cpp
+3
-3
lib/operations/akabeipolkitreplaceoperation.cpp
lib/operations/akabeipolkitreplaceoperation.cpp
+2
-1
lib/operations/akabeipolkitupgradeoperation.cpp
lib/operations/akabeipolkitupgradeoperation.cpp
+2
-1
tools/akabei-create-db/databaseworker.cpp
tools/akabei-create-db/databaseworker.cpp
+2
-1
tools/polkit-helper/archivehandlerhelper.cpp
tools/polkit-helper/archivehandlerhelper.cpp
+2
-1
tools/polkit-helper/sqlitehelper.cpp
tools/polkit-helper/sqlitehelper.cpp
+2
-1
No files found.
lib/akabeibackend.cpp
View file @
be30e11c
...
...
@@ -85,7 +85,8 @@ struct ConcurrentOrphanQuery
allPackages
[
pkg
->
name
()
]
=
pkg
;
}
foreach
(
Package
*
pkg
,
allPackages
.
values
())
{
for
(
auto
it
=
allPackages
.
constBegin
()
,
end
=
allPackages
.
constEnd
();
it
!=
end
;
++
it
)
{
auto
pkg
=
it
.
value
();
if
(
pkg
->
installReason
()
==
Package
::
ExplicitlyInstalledReason
)
{
Package
::
List
stack
;
...
...
lib/akabeierror.cpp
View file @
be30e11c
...
...
@@ -118,9 +118,11 @@ void ErrorQueue::appendError(const Error& error)
QWriteLocker
locker
(
d
->
mutex
);
d
->
errorQueue
.
enqueue
(
error
);
foreach
(
ErrorHandler
*
registeredHandler
,
d
->
errorSlots
.
values
(
error
.
type
()
))
{
for
(
auto
it
=
d
->
errorSlots
.
constFind
(
error
.
type
()
),
end
=
d
->
errorSlots
.
constEnd
();
it
!=
end
&&
it
.
key
()
==
error
.
type
();
++
it
)
{
ErrorHandler
*
registeredHandler
=
it
.
value
();
QMetaObject
::
invokeMethod
(
registeredHandler
->
receiver
(),
registeredHandler
->
slot
(),
Qt
::
QueuedConnection
);
}
}
void
ErrorQueue
::
appendErrors
(
const
Error
::
List
&
errors
)
...
...
@@ -245,4 +247,4 @@ Error::Type Error::type() const
return
d
->
type
;
}
}
\ No newline at end of file
}
lib/akabeipackage.cpp
View file @
be30e11c
...
...
@@ -903,7 +903,8 @@ Delta* Package::retrieveDeltaFrom(const Version &version)
locker
.
unlock
();
retrieveDeltas
();
locker
.
relock
();
foreach
(
Delta
*
del
,
d
->
deltaCache
.
values
())
{
for
(
auto
it
=
d
->
deltaCache
.
constBegin
(),
end
=
d
->
deltaCache
.
constEnd
();
it
!=
end
;
++
it
)
{
Delta
*
del
=
it
.
value
();
if
(
Version
(
del
->
versionFrom
())
==
version
)
return
del
;
}
...
...
lib/akabeirunnerrunnable_p.cpp
View file @
be30e11c
...
...
@@ -122,9 +122,12 @@ void RunnerWorker::processNextPhase()
break
;
case
Operation
::
Phase5
:
//Now we need to move all ops back to the main app thread
foreach
(
QList
<
Operation
*>
ops
,
m_operations
.
values
())
{
foreach
(
Operation
*
op
,
ops
)
for
(
auto
it
=
m_operations
.
constBegin
(),
end
=
m_operations
.
constEnd
();
it
!=
end
;
++
it
)
{
const
auto
ops
=
it
.
value
();
for
(
auto
it2
=
ops
.
constBegin
(),
end2
=
ops
.
constEnd
();
it2
!=
end2
;
++
it2
)
{
Operation
*
op
=
*
it2
;
op
->
moveToThread
(
QCoreApplication
::
instance
()
->
thread
());
}
}
// If we're here, we're successfully over.
emit
runFinished
(
true
);
...
...
@@ -234,10 +237,15 @@ void RunnerRunnable::run()
//Don't parent, otherwise we break thread-affinity!!!
m_worker
=
new
RunnerWorker
(
m_operations
);
m_worker
->
moveToThread
(
m_thread
);
foreach
(
QList
<
Operation
*>
ops
,
m_operations
.
values
())
{
foreach
(
Operation
*
op
,
ops
)
for
(
auto
it
=
m_operations
.
constBegin
(),
end
=
m_operations
.
constEnd
();
it
!=
end
;
++
it
)
{
const
auto
ops
=
it
.
value
();
for
(
auto
it2
=
ops
.
constBegin
(),
end2
=
ops
.
constEnd
();
it2
!=
end2
;
++
it2
)
{
Operation
*
op
=
*
it2
;
op
->
moveToThread
(
m_thread
);
}
}
emit
ready
();
QTimer
::
singleShot
(
0
,
m_worker
,
SLOT
(
run
()));
m_thread
->
start
();
...
...
lib/akabeivalidatorrunnable_p.cpp
View file @
be30e11c
...
...
@@ -142,10 +142,12 @@ void ValidatorWorker::processNextPhase()
break
;
case
Operation
::
Phase5
:
//Now we need to move all ops back to the main app thread
foreach
(
QList
<
Operation
*>
ops
,
m_operations
.
values
())
{
for
(
auto
it
=
m_operations
.
constBegin
(),
end
=
m_operations
.
constEnd
();
it
!=
end
;
++
it
)
{
const
auto
ops
=
it
.
value
();
foreach
(
Operation
*
op
,
ops
)
op
->
moveToThread
(
QCoreApplication
::
instance
()
->
thread
());
}
// If we're here, we're successfully over.
emit
validationFinished
(
true
,
m_operations
);
return
;
...
...
@@ -467,7 +469,8 @@ void ValidatorRunnable::run()
//Don't use a parent here, otherwise we break thread affinity!!!
m_worker
=
new
ValidatorWorker
(
m_operations
);
m_worker
->
moveToThread
(
m_thread
);
foreach
(
QList
<
Operation
*>
ops
,
m_operations
.
values
())
{
for
(
auto
it
=
m_operations
.
constBegin
(),
end
=
m_operations
.
constEnd
();
it
!=
end
;
++
it
)
{
const
auto
ops
=
it
.
value
();
foreach
(
Operation
*
op
,
ops
)
op
->
moveToThread
(
m_thread
);
}
...
...
lib/libarchive++/archivehandler.cpp
View file @
be30e11c
...
...
@@ -193,11 +193,10 @@ size_t ArchiveHandler::getEntrySize(QString const& fileName) const
size_t
ArchiveHandler
::
totalEntrySize
()
const
{
size_t
total
=
0
;
foreach
(
const
QString
&
file
,
entries
.
keys
())
{
for
(
auto
it
=
entries
.
constBegin
(),
end
=
entries
.
constEnd
();
it
!=
end
;
++
it
)
{
const
auto
&
file
=
it
.
key
();
total
+=
entries
[
file
]
->
getFileSize
();
}
return
total
;
}
...
...
lib/libarchive++/polkitarchivehandler.cpp
View file @
be30e11c
...
...
@@ -86,8 +86,10 @@ bool PolKitArchiveHandler::write(const QString& filename, const QHash<QString, Q
iface
.
setProperty
(
"filename"
,
filename
);
QVariantMap
map
;
foreach
(
const
QString
&
k
,
files
.
keys
())
for
(
auto
it
=
files
.
constBegin
(),
end
=
files
.
constEnd
();
it
!=
end
;
++
it
)
{
const
auto
&
k
=
it
.
key
();
map
.
insert
(
k
,
files
[
k
]);
}
QDBusMessage
mes
=
iface
.
call
(
"write"
,
map
);
return
!
mes
.
arguments
().
isEmpty
()
&&
mes
.
arguments
().
first
().
toBool
();
}
else
{
...
...
lib/operations/akabeipolkitreinstalloperation.cpp
View file @
be30e11c
...
...
@@ -78,7 +78,8 @@ void PolkitReInstallOperation::run()
QStringList
files
=
d
->
localPackage
->
retrieveFiles
();
QMap
<
QString
,
QString
>
backup
=
d
->
package
->
backupFiles
();
foreach
(
const
QString
&
b
,
backup
.
keys
())
{
for
(
auto
it
=
backup
.
constBegin
(),
end
=
backup
.
constEnd
();
it
!=
end
;
++
it
)
{
const
auto
&
b
=
it
.
key
();
if
(
b
.
isEmpty
()
||
backup
[
b
].
isEmpty
())
continue
;
files
.
removeAll
(
b
);
...
...
lib/operations/akabeipolkitremoveoperation.cpp
View file @
be30e11c
...
...
@@ -60,9 +60,9 @@ void PolkitRemoveOperation::run()
// Remove all files
if
(
!
(
processingOptions
().
testFlag
(
Akabei
::
DatabaseOnly
)))
{
QStringList
files
=
d
->
package
->
retrieveFiles
();
QMap
<
QString
,
QString
>
backup
=
d
->
package
->
backupFiles
();
foreach
(
const
QString
&
b
,
backup
.
keys
())
{
QMap
<
QString
,
QString
>
backup
=
d
->
package
->
backupFiles
();
for
(
auto
it
=
backup
.
constBegin
(),
end
=
backup
.
constEnd
();
it
!=
end
;
++
it
)
{
const
auto
&
b
=
it
.
key
();
if
(
processingOptions
().
testFlag
(
Akabei
::
RemoveConfigs
)
||
b
.
isEmpty
()
||
backup
[
b
].
isEmpty
())
continue
;
files
.
removeAll
(
b
);
...
...
lib/operations/akabeipolkitreplaceoperation.cpp
View file @
be30e11c
...
...
@@ -99,7 +99,8 @@ void PolkitReplaceOperation::run()
Package
*
replacedpkg
=
d
->
replaces
[
i
];
QMap
<
QString
,
QString
>
backup
=
replacedpkg
->
backupFiles
();
foreach
(
const
QString
&
b
,
backup
.
keys
())
{
for
(
auto
it
=
backup
.
constBegin
(),
end
=
backup
.
constEnd
();
it
!=
end
;
++
it
)
{
const
auto
&
b
=
it
.
key
();
if
(
b
.
isEmpty
()
||
backup
[
b
].
isEmpty
())
continue
;
files
.
removeAll
(
b
);
...
...
lib/operations/akabeipolkitupgradeoperation.cpp
View file @
be30e11c
...
...
@@ -83,7 +83,8 @@ void PolkitUpgradeOperation::run()
QStringList
files
=
d
->
from
->
retrieveFiles
();
QMap
<
QString
,
QString
>
backup
=
d
->
to
->
backupFiles
();
foreach
(
const
QString
&
b
,
backup
.
keys
())
{
for
(
auto
it
=
backup
.
constBegin
(),
end
=
backup
.
constEnd
();
it
!=
end
;
++
it
)
{
const
auto
&
b
=
it
.
key
();
if
(
b
.
isEmpty
()
||
backup
[
b
].
isEmpty
())
continue
;
files
.
removeAll
(
b
);
...
...
tools/akabei-create-db/databaseworker.cpp
View file @
be30e11c
...
...
@@ -360,7 +360,8 @@ bool DatabaseWorker::add(const QStringList& targets, const QHash< QString, Akabe
}
QList
<
Akabei
::
Hook
*>
realHooks
;
foreach
(
const
QString
&
h
,
hookPaths
.
keys
())
{
for
(
auto
it
=
hookPaths
.
constBegin
(),
end
=
hookPaths
.
constEnd
();
it
!=
end
;
++
it
)
{
const
auto
&
h
=
it
.
key
();
Akabei
::
Hook
*
hook
=
Akabei
::
Backend
::
instance
()
->
loadHookFromFile
(
hookPaths
[
h
],
hooks
[
h
]);
if
(
hook
)
{
realHooks
<<
hook
;
...
...
tools/polkit-helper/archivehandlerhelper.cpp
View file @
be30e11c
...
...
@@ -266,7 +266,8 @@ bool ArchiveHandlerHelper::write(const QVariantMap& files)
if
(
auth
==
PolkitQt1
::
Authority
::
Yes
&&
CHECK_PID
)
{
qDebug
()
<<
"Auth gained to do the task"
;
QHash
<
QString
,
QString
>
hash
;
//FIXME: Optimize, aka make a method in archivehandler to take a qvariantmap
foreach
(
QString
key
,
files
.
keys
())
{
for
(
auto
it
=
files
.
constBegin
(),
end
=
files
.
constEnd
();
it
!=
end
;
++
it
)
{
auto
key
=
it
.
key
();
hash
.
insert
(
key
,
files
[
key
].
toString
());
}
return
ArchiveHandler
::
write
(
m_filename
,
hash
);
...
...
tools/polkit-helper/sqlitehelper.cpp
View file @
be30e11c
...
...
@@ -103,7 +103,8 @@ void SQLiteHelper::query(const QString &query, const QVariantMap &bindings)
if
(
auth
==
PolkitQt1
::
Authority
::
Yes
&&
CHECK_PID
)
{
try
{
QVariantMap
result
;
foreach
(
const
QString
&
k
,
bindings
.
keys
())
{
for
(
auto
it
=
bindings
.
constBegin
(),
end
=
bindings
.
constEnd
();
it
!=
end
;
++
it
)
{
const
auto
&
k
=
it
.
key
();
QDBusArgument
arg
=
bindings
.
value
(
k
).
value
<
QDBusArgument
>
();
QList
<
QVariant
>
entries
;
arg
>>
entries
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment