@@ -65,15 +65,6 @@ struct MsgFilter::Private {
65
65
TMsgReplaceList repList;
66
66
TSubstMap fileSubsts;
67
67
68
- const std::string strKrn = " ^[a-zA-Z+]+" ;
69
- const RE reKrn = RE(strKrn + /* convert el8_9 -> el8 */ " |_[0-9]+$" );
70
- const RE reDir = RE(" ^([^:]*/)" );
71
- const RE reFile = RE(" [^/]+$" );
72
- const RE rePath = RE(" ^(?:/builddir/build/BUILD/)?([^/]+)/(.*)(\\ .[ly])?$" );
73
- const RE rePyBuild = RE(" ^((?:/builddir/build/BUILD/)?[^/]+/)build/lib/(.*)$" );
74
- const RE reTmpPath = RE(" ^(/var)?/tmp/(.*)$" );
75
- const RE reTmpCleaner = RE(" (.*)" );
76
-
77
68
void addMsgFilter (
78
69
const std::string &checker,
79
70
const std::string ®exp,
@@ -247,47 +238,56 @@ std::string MsgFilter::filterPath(
247
238
{
248
239
std::string path = origPath;
249
240
241
+ static const RE reDir (" ^([^:]*/)" );
242
+
250
243
TSubstMap &substMap = d->fileSubsts ;
251
244
if (!substMap.empty ()) {
252
- std::string base = regexReplaceWrap (origPath, d->reDir , " " );
253
- std::string dir = regexReplaceWrap (origPath, d->reFile , " " );
245
+ std::string base = regexReplaceWrap (origPath, reDir, " " );
246
+ static const RE reFile (" [^/]+$" );
247
+ std::string dir = regexReplaceWrap (origPath, reFile, " " );
254
248
if (substMap.find (base) != substMap.end ()) {
255
249
const std::string &substWith = substMap[base];
256
250
path = dir + substWith;
257
251
}
258
252
}
259
253
260
254
if (!forceFullPath && d->ignorePath )
261
- return regexReplaceWrap (path, d-> reDir , " " );
255
+ return regexReplaceWrap (path, reDir, " " );
262
256
263
- if (boost::regex_match (path, d->reTmpPath )) {
257
+ static const RE reTmpPath (" ^(/var)?/tmp/(.*)$" );
258
+ if (boost::regex_match (path, reTmpPath)) {
264
259
// filter random numbers in names of temporary generated files
265
- std::string tmpPath = boost::regex_replace (path, d->reTmpCleaner , " /tmp/tmp.c" );
260
+ static const RE reTmpCleaner (" (.*)" );
261
+ std::string tmpPath = boost::regex_replace (path, reTmpCleaner, " /tmp/tmp.c" );
266
262
return tmpPath;
267
263
}
268
264
269
265
// "/usr/src/kernels/4.18.0-552.el8.x86_64+debug/..."
270
266
// -> "/usr/src/kernels/VERSION-RELEASE+debug/..."
271
- const RE reKrnUsrSrc (" ^(/usr/src/kernels/)[^/-]+-[^/-]+((?:\\ +debug)?/.*)$" );
267
+ static const RE reKrnUsrSrc (" ^(/usr/src/kernels/)[^/-]+-[^/-]+((?:\\ +debug)?/.*)$" );
272
268
path = regexReplaceWrap (path, reKrnUsrSrc, " \\ 1VERSION-RELEASE\\ 2" );
273
269
274
270
boost::smatch sm;
275
- if (boost::regex_match (path, sm, d->rePyBuild )) {
271
+ static const RE rePyBuild (" ^((?:/builddir/build/BUILD/)?[^/]+/)build/lib/(.*)$" );
272
+ if (boost::regex_match (path, sm, rePyBuild)) {
276
273
// %{_builddir}/build/lib/setuptools/glob.py ->
277
274
// %{_builddir}/setuptools/glob.py
278
275
path = sm[1 ] + sm[2 ];
279
276
}
280
277
281
- if (!boost::regex_match (path, sm, d->rePath ))
278
+ static const RE rePath (" ^(?:/builddir/build/BUILD/)?([^/]+)/(.*)(\\ .[ly])?$" );
279
+ if (!boost::regex_match (path, sm, rePath))
282
280
// no match
283
281
return path;
284
282
285
283
const std::string nvr = sm[/* NVR */ 1 ];
286
284
path = sm[/* core */ 2 ];
287
285
288
286
// try to kill the multiple version strings in paths (kernel, OpenLDAP, ...)
289
- const std::string ver = boost::regex_replace (nvr, d->reKrn , " " );
290
- const std::string krnPattern = d->strKrn + ver + " [^/]*/" ;
287
+ static const std::string strKrn = " ^[a-zA-Z+]+" ;
288
+ static const RE reKrn (strKrn + /* convert el8_9 -> el8 */ " |_[0-9]+$" );
289
+ const std::string ver = boost::regex_replace (nvr, reKrn, " " );
290
+ const std::string krnPattern = strKrn + ver + " [^/]*/" ;
291
291
292
292
#if DEBUG_SUBST > 2
293
293
std::cerr << " nvr: " << nvr << " \n " ;
0 commit comments