Accepting request 195374 from GNOME:Factory

- Modify gi-find-deps.sh: the js package filter function seems to
  have some issues in transfering variables (we might hit some
  limits: the script works fine when directly invoked). Currently
  we just specify the extracted list from gnome-weather as FILTER. (forwarded request 188165 from Zaitor)

OBS-URL: https://build.opensuse.org/request/show/195374
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gobject-introspection?expand=0&rev=54
This commit is contained in:
Tomáš Chvátal 2013-08-16 10:20:37 +00:00 committed by Git OBS Bridge
commit 1b2d714a45
3 changed files with 87 additions and 1 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Automatically find Provides and Requires for typelib() gobject-introspection bindings.
# can be started with -R (Requires) and -P (Provides)
@ -19,6 +19,11 @@ if [ "$tsymbol" = "$version" ]; then
fi
}
function split_name_version2 {
symbol=$(echo $1 | awk -F: '{print $1}' | sed "s:[' ]::g")
version=$(echo $1 | awk -F: '{print $2}' | sed "s:[' ]::g")
}
function print_req_prov {
echo -n "typelib($symbol)"
if [ ! -z "$version" ]; then
@ -62,6 +67,59 @@ function javascript_requires {
split_name_version $module
print_req_prov
done
# Remember files which contain a pkg.require() call
if pcregrep -M "pkg.require\\(([^;])*" $1 > /dev/null; then
# the file contains a pkg.require(..) list... let's remember th is file for the in-depth scanner
if [ -n "$jspkg" ]; then
jspkg=$1:${jspkg}
else
jspkg=$1
fi
fi
# remember files which contain exlucde filters used against pkg.require()
if pcregrep -M "const RECOGNIZED_MODULE_NAMES =([^;])*" $1 > /dev/null; then
# the file contains RECOGNIZED_MODULE_NAMES list. We remember the file name for the follow up filtering
if [ -n "$jspkgfilt" ]; then
jspkgfilt=$1:${jspkgfilt}
else
jspkgfilt=$1
fi
fi
}
function javascript_pkg_filter {
# For now this is a dummy function based on gnome-weather information
#for file in $jspkgfilt; do
# FILTER=($(pcregrep -M "const RECOGNIZED_MODULE_NAMES =([^;])*" $file | grep -o "'.*'" | sed "s:'::g"))
#done
FILTER=('Lang' 'Mainloop' 'Signals' 'System' 'Params')
}
function javascript_pkg_requires {
# javascript files were found which specify pkg.require('..': '..'[,'..': '']); list
# This is used in some apps in order to have a 'centralized' point to specify all package dependencies.
# once we reach this function, we already know which file(s) contain the pkg.require(..) list.
oldIFS=$IFS
IFS=:
for file in "$jspkg"; do
IFS=$'\n'
PKGS=$(pcregrep -M "pkg.require\\(([^;])*" $file | grep -o "'.*': '.*'")
for pkg in $PKGS; do
split_name_version2 $pkg
found=0
for (( i=0 ; i<${#FILTER[@]} ; i++ )); do
if [ "$symbol" = "${FILTER[$i]}" ]; then
found=1
fi
done
if [ $found -eq 0 ]; then
print_req_prov
fi
done
IFS=:
done
IFS=$oldIFS
}
@ -119,6 +177,14 @@ while read file; do
;;
esac
done
# The pkg filter is a place holder. This should read the filter from the javascript files.
#if [ -n "$jspkgfilt" ]; then
javascript_pkg_filter
#fi
# in case the javascript parser above detected files which specify pkg.require, we enter the more in-depth scanning scheme for those files.
if [ -n "$jspkg" ]; then
javascript_pkg_requires
fi
}
function inList() {

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Thu Aug 15 06:56:37 UTC 2013 - dimstar@opensuse.org
- Modify gi-find-deps.sh: the js package filter function seems to
have some issues in transfering variables (we might hit some
limits: the script works fine when directly invoked). Currently
we just specify the extracted list from gnome-weather as FILTER.
-------------------------------------------------------------------
Fri Aug 9 20:49:53 UTC 2013 - dimstar@opensuse.org
- Enhance gi-find-deps.sh: gnome-weather came up with a nice idea
of specifying all dependencies in a pkg.requires(..) list
(hopefully this counts as standardized). Enhance the scanner to
identify this listing method of dependencies (bnc#811652).
- Add pcre-tools Requires to the main package: gi-find-deps.sh uses
pcregrep for multi line matching.
-------------------------------------------------------------------
Wed Jul 10 18:37:19 UTC 2013 - dimstar@opensuse.org

View File

@ -49,6 +49,8 @@ BuildRequires: pkgconfig(gobject-2.0)
# gi-find-deps makes use of 'file' to identify the types.
Requires: file
Requires: libgirepository-1_0-1 = %{version}
# gi-find-deps uses the enhanced grep variant in order to do multi-line matching (for pkg.requires(..))
Requires: pcre-tools
Requires: python-xml
BuildRoot: %{_tmppath}/%{name}-%{version}-build