Answering my own email, in case someone is curious: On 25.02.2017 14:22, Mario Emmenlauer wrote: > > I found some packages that specify "depends" inside a function in > the PKGBUILD. If I saw this correctly, those depends are currently > not being resolved from the ci system. The problem seems to be > that sourcing the PKGBUILD does not resolve variables in functions > (which makes perfect sense). However I could not find an easy way > to actually resolve them. Does anyone know a way how they could be > resolved, or how the PKGBUILD could be modified in such a way that > it becomes possible to detect all dependencies for a package? > > My motivation is to build a dependency graph for all packages in > order to trigger a build of the full cascade whenever a package > is modified.
With sourcing alone I could not resolve the depends inside functions in the PKGBUILD. A relatively complex but working solution was to use a first check with grep, to see if the depends are inside functions or in the main section. If they are inside functions, then use perl to extract all depends-sections from the file, then source the PKGBUILD to resolve variables in the depends. Its not a super nice solution, but works pretty ok. In summary it looks something like this (pseudo-code): # get the file contents, remove comments, and concatenate it into # a single big string (to remove line breaks): FILE=$(cat PKGBUILD|perl -pe 's@#.*@@g'|tr '\n' ' ') # iteratively extract the depends=(.*) blocks. This required a loop # over the multiple occurrences of depends=... in the file: PROPERTYVALUES=... # export the variables from the PKGBUILD: set -o allexport # use envsubst from 'gettext' to resolve the variables in the string: export MINGW_PACKAGE_PREFIX="mingw-w64" source PKGBUILD PROPERTYVALUES=$(echo "${PROPERTYVALUES}"|envsubst) # turn off exporting variables: set +o allexport Cheers, Mario Emmenlauer -- BioDataAnalysis GmbH, Mario Emmenlauer Tel. Buero: +49-89-74677203 Balanstr. 43 mailto: memmenlauer * biodataanalysis.de D-81669 München http://www.biodataanalysis.de/ ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Msys2-users mailing list Msys2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/msys2-users