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
f098f8ee
Commit
f098f8ee
authored
Sep 10, 2020
by
LordTermor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch-wildcards' into 'master'
Various changes See merge request
!49
parents
26f159cf
203a062f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
22 deletions
+32
-22
scripts/mhwd
scripts/mhwd
+11
-7
src/Data.cpp
src/Data.cpp
+18
-8
src/Mhwd.cpp
src/Mhwd.cpp
+2
-6
src/Utils.hpp
src/Utils.hpp
+1
-1
No files found.
scripts/mhwd
View file @
f098f8ee
...
...
@@ -305,6 +305,11 @@ if [ "${INSTALL}" == "true" ]; then
echo
"Error: pacman failed!"
exit
1
fi
${
PACMAN
}
-D
--asexplicit
${
PACKAGES
}
if
[
"
$?
"
-ne
"0"
]
;
then
echo
"Error: pacman failed!"
exit
1
fi
fi
# Run postinstall function
...
...
@@ -372,14 +377,13 @@ if [ "${REMOVE}" == "true" ]; then
fi
fi
for
PKG
in
"
${
OPTREMPACKAGES
}
"
do
# Check if package is needed anywhere, otherwise remove packages
# Usage of -Rsu is not enough, since pacman doesn't consider optional dependencies
if
[
"
$(
pacman
-Qi
${
PKG
}
| egrep
"Required By|Optional For"
|
awk
'{ print $4}'
|
grep
-v
'None'
)
"
==
""
]
;
then
PACKAGES
=
"
${
PACKAGES
}
${
PKG
}
"
if
[
"
${
OPTREMPACKAGES
}
"
!=
""
]
;
then
${
PACMAN
}
-D
--asdeps
${
OPTREMPACKAGES
}
if
[
"
$?
"
-ne
"0"
]
;
then
echo
"Error: pacman failed!"
exit
1
fi
done
fi
# Check if packages are installed
MHWD_CHECK_PKGS
...
...
src/Data.cpp
View file @
f098f8ee
...
...
@@ -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,31 @@ 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_
)
// Skip yourself
if
(
installedConfig
->
name_
==
config
->
name_
)
continue
;
// 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/Mhwd.cpp
View file @
f098f8ee
...
...
@@ -62,12 +62,8 @@ bool Mhwd::performTransaction(std::shared_ptr<Config> config, MHWD::TRANSACTIONT
// Print dependencies
else
if
(
!
transaction
.
dependencyConfigs_
.
empty
())
{
consoleWriter_
.
printStatus
(
"Dependencies to install:"
+
gatherConfigContent
(
transaction
.
dependencyConfigs_
)
+
"
\n
Proceed with installation? [Y/n]"
);
std
::
string
input
;
std
::
getline
(
std
::
cin
,
input
);
return
proceedWithInstallation
(
input
);
consoleWriter_
.
printStatus
(
"Dependencies to install: "
+
gatherConfigContent
(
transaction
.
dependencyConfigs_
));
}
}
else
if
(
MHWD
::
TRANSACTIONTYPE
::
REMOVE
==
transactionType
)
...
...
src/Utils.hpp
View file @
f098f8ee
...
...
@@ -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