From 2ec067cddbd34e44e3684232258d550ba7124998 Mon Sep 17 00:00:00 2001 From: John McQuah Date: Sat, 2 Dec 2023 14:39:16 +0000 Subject: [PATCH] fix printf when used with --regex strip parentheses when parsing softdeps --- src/package.cpp | 37 ++----------------------------------- src/prtget.cpp | 6 +++--- 2 files changed, 5 insertions(+), 38 deletions(-) diff --git a/src/package.cpp b/src/package.cpp index ce484ac..75f6a8c 100644 --- a/src/package.cpp +++ b/src/package.cpp @@ -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 softDepList = StringHelper::split( softdeps, ',' ); - list::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 deps = StringHelper::split( depends, ',' ); - list::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 - } } } diff --git a/src/prtget.cpp b/src/prtget.cpp index a0643c8..c5f9b8c 100644 --- a/src/prtget.cpp +++ b/src/prtget.cpp @@ -70,8 +70,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 */ @@ -1274,7 +1274,7 @@ void PrtGet::printf() assertExactArgCount(1); initRepo(); - string filter = m_parser->useRegex() ? "." : "*"; + string filter = m_useRegex ? ".*" : "*"; if ( m_parser->hasFilter() ) { filter = m_parser->filter(); }