diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-12-10 16:18:15 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-12-10 16:57:36 +0200 |
commit | 185de185262b2772fa692efc69633f41afc5832a (patch) | |
tree | 6d371860bd091aa8412a1cc57ae8dbc0427c9391 /build | |
parent | 27a17ec74a21eb5c8ca44972e15531244881cc07 (diff) | |
download | librpm-tizen-185de185262b2772fa692efc69633f41afc5832a.tar.gz librpm-tizen-185de185262b2772fa692efc69633f41afc5832a.tar.bz2 librpm-tizen-185de185262b2772fa692efc69633f41afc5832a.zip |
Implement filtering of autogenerated dependencies
- This allows both excluding entire paths from dependency generation
and also excluding individual generated dependencies by regexes
settable from spec or other configuration.
- %__(provides|requires)_exclude regex controls is matched against
generated dependencies, %__(provides|requires)_exclude_from is
matched against the currently processed path, with buildroot
stripped out.
- We'll probably want some "higher level" macros to go with this,
but the mechanism is usable as-is already.
Diffstat (limited to 'build')
-rw-r--r-- | build/rpmfc.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/build/rpmfc.c b/build/rpmfc.c index 2efe0eb49..56bcb1242 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -455,6 +455,8 @@ static int rpmfcHelper(rpmfc fc, unsigned char deptype, const char * nsdep) rpmsenseFlags dsContext; rpmTagVal tagN; int pac; + regex_t *exclude = NULL; + regex_t *exclude_from = NULL; switch (deptype) { default: @@ -478,9 +480,17 @@ static int rpmfcHelper(rpmfc fc, unsigned char deptype, const char * nsdep) break; } + /* If the entire path is filtered out, there's nothing more to do */ + exclude_from = rpmfcAttrReg(depname, "exclude_from"); + if (regMatch(exclude_from, fn+fc->brlen)) + goto exit; + pav = runCmd(nsdep, depname, fc->buildRoot, fn); pac = argvCount(pav); + if (pav) + exclude = rpmfcAttrReg(depname, "exclude"); + for (int i = 0; i < pac; i++) { rpmds ds = NULL; const char *N = pav[i]; @@ -509,17 +519,20 @@ static int rpmfcHelper(rpmfc fc, unsigned char deptype, const char * nsdep) ds = rpmdsSingle(tagN, N, EVR, Flags); - /* Add to package dependencies. */ - (void) rpmdsMerge(depsp, ds); - - /* Add to file dependencies. */ - rpmfcAddFileDep(&fc->ddict, fc->ix, ds, deptype); + /* Add to package and file dependencies unless filtered */ + if (regMatch(exclude, rpmdsDNEVR(ds)+2) == 0) { + (void) rpmdsMerge(depsp, ds); + rpmfcAddFileDep(&fc->ddict, fc->ix, ds, deptype); + } ds = rpmdsFree(ds); } argvFree(pav); +exit: + regFree(exclude); + regFree(exclude_from); return 0; } |