fix printf when used with --regex

strip parentheses when parsing softdeps
This commit is contained in:
John McQuah 2023-12-02 14:46:00 +00:00
parent bfb5cde112
commit a2626355ac
2 changed files with 5 additions and 38 deletions

View File

@ -213,50 +213,17 @@ void Package::load() const
StringHelper::replaceAll( softdeps, " ", "," );
StringHelper::replaceAll( softdeps, ",,", "," );
StringHelper::replaceAll( softdeps, "(", "" );
StringHelper::replaceAll( softdeps, ")", "" );
// TODO: decide which one to use
#if 0
// remove commented out packages
list<string> softDepList = StringHelper::split( softdeps, ',' );
list<string>::iterator it = deps.begin();
for ( ; it != softDepList.end(); ++it ) {
if ( (*it)[0] == '#' ) {
cerr << "Commented dep: " << *it << endl;
} else {
if ( it != softDepsList.begin() ) {
m_data->optionals += ",";
}
m_data->optionals += *it;
}
}
#else
m_data->optionals = softdeps;
#endif
} else if ( startsWithNoCase( line, "dep" ) ) {
string depends = stripWhiteSpace( getValue( line, ':' ) );
StringHelper::replaceAll( depends, " ", "," );
StringHelper::replaceAll( depends, ",,", "," );
// TODO: decide which one to use
#if 0
// remove commented out packages
list<string> deps = StringHelper::split( depends, ',' );
list<string>::iterator it = deps.begin();
for ( ; it != deps.end(); ++it ) {
if ( (*it)[0] == '#' ) {
cerr << "Commented dep: " << *it << endl;
} else {
if ( it != deps.begin() ) {
m_data->depends += ",";
}
m_data->depends += *it;
}
}
#else
m_data->depends = depends;
#endif
}
}
}

View File

@ -67,8 +67,8 @@ PrtGet::PrtGet( const ArgParser* parser )
m_pkgDB = new PkgDB(m_parser->installRoot());
readConfig();
m_useRegex = m_config->useRegex() || m_parser->useRegex();
m_followSoftdeps = m_config->followSoftdeps() || m_parser->followSoftdeps();
m_useRegex = ( m_config->useRegex() || m_parser->useRegex() );
m_followSoftdeps = ( m_config->followSoftdeps() || m_parser->followSoftdeps() );
}
/*! destruct PrtGet object */
@ -1132,7 +1132,7 @@ void PrtGet::printf() {
assertExactArgCount(1);
initRepo();
string filter = m_parser->useRegex() ? "." : "*";
string filter = m_useRegex ? ".*" : "*";
if ( m_parser->hasFilter() ) {
filter = m_parser->filter();
}