Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
mhwd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
30
Issues
30
List
Boards
Labels
Service Desk
Milestones
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
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Applications
mhwd
Commits
0376ee15
Commit
0376ee15
authored
Jul 13, 2020
by
TotallyNotElite
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added basic wildcard (GLOB) support
parent
26f159cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
src/Data.cpp
src/Data.cpp
+15
-8
src/Utils.hpp
src/Utils.hpp
+1
-1
No files found.
src/Data.cpp
View file @
0376ee15
...
...
@@ -25,6 +25,7 @@
#include "Data.hpp"
#include <dirent.h>
#include <fnmatch.h>
#include <algorithm>
#include <fstream>
...
...
@@ -129,42 +130,42 @@ void Data::getAllDevicesOfConfig(const std::vector<std::shared_ptr<Device>>& dev
{
// Check class ids
bool
found
=
std
::
find_if
(
hwdID
->
classIDs
.
begin
(),
hwdID
->
classIDs
.
end
(),
[
i_device
](
const
std
::
string
&
classID
){
return
((
"*"
==
classID
)
||
(
classID
==
(
*
i_device
)
->
classID_
)
);
return
!
fnmatch
(
classID
.
c_str
(),
(
*
i_device
)
->
classID_
.
c_str
(),
FNM_CASEFOLD
);
})
!=
hwdID
->
classIDs
.
end
();
if
(
found
)
{
// Check blacklisted class ids
found
=
std
::
find_if
(
hwdID
->
blacklistedClassIDs
.
begin
(),
hwdID
->
blacklistedClassIDs
.
end
(),
[
i_device
](
const
std
::
string
&
blacklistedClassID
){
return
(
blacklistedClassID
==
(
*
i_device
)
->
classID_
);
return
!
fnmatch
(
blacklistedClassID
.
c_str
(),
(
*
i_device
)
->
classID_
.
c_str
(),
FNM_CASEFOLD
);
})
!=
hwdID
->
blacklistedClassIDs
.
end
();
if
(
!
found
)
{
// Check vendor ids
found
=
std
::
find_if
(
hwdID
->
vendorIDs
.
begin
(),
hwdID
->
vendorIDs
.
end
(),
[
i_device
](
const
std
::
string
&
vendorID
){
return
((
"*"
==
vendorID
)
||
(
vendorID
==
(
*
i_device
)
->
vendorID_
)
);
return
!
fnmatch
(
vendorID
.
c_str
(),
(
*
i_device
)
->
vendorID_
.
c_str
(),
FNM_CASEFOLD
);
})
!=
hwdID
->
vendorIDs
.
end
();
if
(
found
)
{
// Check blacklisted vendor ids
found
=
std
::
find_if
(
hwdID
->
blacklistedVendorIDs
.
begin
(),
hwdID
->
blacklistedVendorIDs
.
end
(),
[
i_device
](
const
std
::
string
&
blacklistedVendorID
){
return
(
blacklistedVendorID
==
(
*
i_device
)
->
vendorID_
);
return
!
fnmatch
(
blacklistedVendorID
.
c_str
(),
(
*
i_device
)
->
vendorID_
.
c_str
(),
FNM_CASEFOLD
);
})
!=
hwdID
->
blacklistedVendorIDs
.
end
();
if
(
!
found
)
{
// Check device ids
found
=
std
::
find_if
(
hwdID
->
deviceIDs
.
begin
(),
hwdID
->
deviceIDs
.
end
(),
[
i_device
](
const
std
::
string
&
deviceID
){
return
((
"*"
==
deviceID
)
||
(
deviceID
==
(
*
i_device
)
->
deviceID_
)
);
return
!
fnmatch
(
deviceID
.
c_str
(),
(
*
i_device
)
->
deviceID_
.
c_str
(),
FNM_CASEFOLD
);
})
!=
hwdID
->
deviceIDs
.
end
();
if
(
found
)
{
// Check blacklisted device ids
found
=
std
::
find_if
(
hwdID
->
blacklistedDeviceIDs
.
begin
(),
hwdID
->
blacklistedDeviceIDs
.
end
(),
[
i_device
](
const
std
::
string
&
blacklistedDeviceID
){
return
(
blacklistedDeviceID
==
(
*
i_device
)
->
deviceID_
);
return
!
fnmatch
(
blacklistedDeviceID
.
c_str
(),
(
*
i_device
)
->
deviceID_
.
c_str
(),
FNM_CASEFOLD
);
})
!=
hwdID
->
blacklistedDeviceIDs
.
end
();
if
(
!
found
)
{
...
...
@@ -281,22 +282,28 @@ std::vector<std::shared_ptr<Config>> Data::getAllLocalConflicts(std::shared_ptr<
installedConfigs
=
installedPCIConfigs
;
}
// Add self to local dependencies vector
dependencies
.
emplace_back
(
config
);
// Loop thru all MHWD config dependencies (not pacman dependencies)
for
(
const
auto
&
dependency
:
dependencies
)
{
// Loop thru all MHWD config conflicts
for
(
const
auto
&
dependencyConflict
:
dependency
->
conflicts_
)
{
// Then loop thru all already installed configs. If there are no configs installed, there can not be a conflict
for
(
auto
&
installedConfig
:
installedConfigs
)
{
if
(
dependencyConflict
==
installedConfig
->
name_
)
// Does one of the installed configs conflict one of the to-be-installed configs?
if
(
!
fnmatch
(
dependencyConflict
.
c_str
(),
installedConfig
->
name_
.
c_str
(),
FNM_CASEFOLD
))
{
// Check if conflicts is already in the conflicts vector
bool
found
=
std
::
find_if
(
conflicts
.
begin
(),
conflicts
.
end
(),
[
&
dependencyConflict
](
const
std
::
shared_ptr
<
Config
>&
conflict
)
{
return
conflict
->
name_
==
dependencyConflict
;
})
!=
conflicts
.
end
();
// If not, add it to the conflicts vector. This will now be shown to the user.
if
(
!
found
)
{
conflicts
.
emplace_back
(
installedConfig
);
...
...
src/Utils.hpp
View file @
0376ee15
...
...
@@ -58,4 +58,4 @@ hash_t hash(char const* str)
};
// End namespace
#endif
/*
CONFIG
_HPP_ */
#endif
/*
MHWDUTILS
_HPP_ */
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