2013-08-13 14:41:22 +02:00
|
|
|
#!/bin/bash
|
2011-04-27 16:45:13 +02:00
|
|
|
|
|
|
|
# Automatically find Provides and Requires for typelib() gobject-introspection bindings.
|
|
|
|
# can be started with -R (Requires) and -P (Provides)
|
|
|
|
|
|
|
|
# Copyright 2011 by Dominique Leuenberger, Amsterdam, Netherlands (dimstar [at] opensuse.org)
|
|
|
|
# This file is released under the GPLv2 or later.
|
|
|
|
|
|
|
|
function split_name_version {
|
|
|
|
base=$1
|
2011-05-31 10:01:33 +02:00
|
|
|
tsymbol=${base%-*}
|
|
|
|
# Sometimes we get a Requires on Gdk.Settings.foo, bebause you can directly use imports.gi.Gdk.Settings.Foo in Javascript.
|
Accepting request 158549 from GNOME:Next
- Simplify gi-find-deps.sh to make it easier to add other 64bit
architectures. Include aarch64 in the list.
- Update to version 1.35.8:
+ Bugs fixed: bgo#660698, bgo#687522, bgo#691873, bgo#692084,
bgo#693040, bgo#693096, bgo#693097, bgo#693098, bgo#693598,
bgo#693742, bgo#693838, bgo#693876, bgo#693939.
- Update to version 1.35.4:
+ Update glib annotations.
+ Various mallardwriter improvements and fixes
+ Bugs fixed: bgo#690514, bgo#686388, bgo#656312, bgo#691030,
bgo#690850, bgo#690851, bgo#691524, bgo#678401, bgo#684059,
bgo#682355.
- Eliminate lines which contain "from gi.repository import Foo"
(incl. quotes) as possible matches... this phrase is commonly
used in multiline documentation blobs (like for example in
python-gobject >= 3.7.3).
- Modify gi-find-deps.sh: in case of python scripts, do not add
python-gobject Requires: we do not know if the scripts is meant
for python3, which would require python3-gobject.
- Update to version 1.35.3:
+ scanner: Deprecate using identifier prefixes in GINames.
+ giscanner: Don't prefer identifier prefixes over namespaces in
deps.
+ Build system enhancements / fixes.
+ Update glib annotations.
OBS-URL: https://build.opensuse.org/request/show/158549
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gobject-introspection?expand=0&rev=116
2013-03-13 23:42:28 +01:00
|
|
|
# We know that the symbol in this case is called Gdk, so we cut everything after the . away.
|
2011-05-31 10:01:33 +02:00
|
|
|
symbol=$(echo $tsymbol | awk -F. '{print $1}')
|
2011-04-27 16:45:13 +02:00
|
|
|
version=${base#*-}
|
|
|
|
# In case there is no '-' in the filename, then the split above 'fails' and version == symbol (thus: no version specified)
|
2011-05-31 10:01:33 +02:00
|
|
|
if [ "$tsymbol" = "$version" ]; then
|
2011-04-27 16:45:13 +02:00
|
|
|
unset version
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-08-13 14:41:22 +02:00
|
|
|
function split_name_version2 {
|
|
|
|
symbol=$(echo $1 | awk -F: '{print $1}' | sed "s:[' ]::g")
|
|
|
|
version=$(echo $1 | awk -F: '{print $2}' | sed "s:[' ]::g")
|
|
|
|
}
|
|
|
|
|
2011-04-27 16:45:13 +02:00
|
|
|
function print_req_prov {
|
2011-08-17 21:52:54 +02:00
|
|
|
echo -n "typelib($symbol)"
|
2011-04-27 16:45:13 +02:00
|
|
|
if [ ! -z "$version" ]; then
|
|
|
|
echo " = ${version}"
|
|
|
|
else
|
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function find_provides {
|
|
|
|
while read file; do
|
|
|
|
case $file in
|
2011-05-27 10:40:53 +02:00
|
|
|
*.typelib)
|
2011-04-27 16:45:13 +02:00
|
|
|
split_name_version $(basename $file | sed 's,.typelib$,,')
|
|
|
|
print_req_prov
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2012-11-14 16:43:43 +01:00
|
|
|
function python_requires {
|
Accepting request 158549 from GNOME:Next
- Simplify gi-find-deps.sh to make it easier to add other 64bit
architectures. Include aarch64 in the list.
- Update to version 1.35.8:
+ Bugs fixed: bgo#660698, bgo#687522, bgo#691873, bgo#692084,
bgo#693040, bgo#693096, bgo#693097, bgo#693098, bgo#693598,
bgo#693742, bgo#693838, bgo#693876, bgo#693939.
- Update to version 1.35.4:
+ Update glib annotations.
+ Various mallardwriter improvements and fixes
+ Bugs fixed: bgo#690514, bgo#686388, bgo#656312, bgo#691030,
bgo#690850, bgo#690851, bgo#691524, bgo#678401, bgo#684059,
bgo#682355.
- Eliminate lines which contain "from gi.repository import Foo"
(incl. quotes) as possible matches... this phrase is commonly
used in multiline documentation blobs (like for example in
python-gobject >= 3.7.3).
- Modify gi-find-deps.sh: in case of python scripts, do not add
python-gobject Requires: we do not know if the scripts is meant
for python3, which would require python3-gobject.
- Update to version 1.35.3:
+ scanner: Deprecate using identifier prefixes in GINames.
+ giscanner: Don't prefer identifier prefixes over namespaces in
deps.
+ Build system enhancements / fixes.
+ Update glib annotations.
OBS-URL: https://build.opensuse.org/request/show/158549
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gobject-introspection?expand=0&rev=116
2013-03-13 23:42:28 +01:00
|
|
|
for module in $(grep -h -P "from gi\.repository import (\w+)" $1 | sed -e 's:#.*::' -e 's:raise ImportError.*::' -e 's:.*"from gi.repository import Foo".*::' | sed -e 's,from gi.repository import,,' -r -e 's:\s+$::g' -e 's:\s+as\s+\w+::g' -e 's:,: :g'); do
|
2012-11-14 16:43:43 +01:00
|
|
|
split_name_version $module
|
|
|
|
print_req_prov
|
Accepting request 158549 from GNOME:Next
- Simplify gi-find-deps.sh to make it easier to add other 64bit
architectures. Include aarch64 in the list.
- Update to version 1.35.8:
+ Bugs fixed: bgo#660698, bgo#687522, bgo#691873, bgo#692084,
bgo#693040, bgo#693096, bgo#693097, bgo#693098, bgo#693598,
bgo#693742, bgo#693838, bgo#693876, bgo#693939.
- Update to version 1.35.4:
+ Update glib annotations.
+ Various mallardwriter improvements and fixes
+ Bugs fixed: bgo#690514, bgo#686388, bgo#656312, bgo#691030,
bgo#690850, bgo#690851, bgo#691524, bgo#678401, bgo#684059,
bgo#682355.
- Eliminate lines which contain "from gi.repository import Foo"
(incl. quotes) as possible matches... this phrase is commonly
used in multiline documentation blobs (like for example in
python-gobject >= 3.7.3).
- Modify gi-find-deps.sh: in case of python scripts, do not add
python-gobject Requires: we do not know if the scripts is meant
for python3, which would require python3-gobject.
- Update to version 1.35.3:
+ scanner: Deprecate using identifier prefixes in GINames.
+ giscanner: Don't prefer identifier prefixes over namespaces in
deps.
+ Build system enhancements / fixes.
+ Update glib annotations.
OBS-URL: https://build.opensuse.org/request/show/158549
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gobject-introspection?expand=0&rev=116
2013-03-13 23:42:28 +01:00
|
|
|
# Temporarly disabled... this is not true if the python code is written for python3... And there seems no real 'way' to identify this.
|
|
|
|
# echo "python-gobject >= 2.21.4"
|
2012-11-14 16:43:43 +01:00
|
|
|
done
|
2013-08-16 12:48:57 +02:00
|
|
|
for module in $(grep -h -P -o ".*(gi\.require_version\(['\"][^'\"]+['\"],\s*['\"][^'\"]+['\"]\))" $1 | sed -e 's:#.*::' -e 's:.*gi.require_version::' -e "s:[()\"' ]::g" -e 's:,:-:'); do
|
2012-11-14 16:43:43 +01:00
|
|
|
split_name_version $module
|
|
|
|
print_req_prov
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function javascript_requires {
|
2013-01-23 17:34:14 +01:00
|
|
|
for module in $(grep -h -P -o "imports\.gi\.([^\s'\";]+)" $1 | grep -v "imports\.gi\.version" | sed -r -e 's,\s+$,,g' -e 's,imports.gi.,,'); do
|
2012-11-14 16:43:43 +01:00
|
|
|
split_name_version $module
|
|
|
|
print_req_prov
|
|
|
|
done
|
2013-01-23 17:34:14 +01:00
|
|
|
for module in $(grep -h -P -o "imports\.gi\.versions.([^\s'\";]+)\s*=\s*['\"].+['\"]" $1 | \
|
2012-11-14 16:43:43 +01:00
|
|
|
sed -e 's:imports.gi.versions.::' -e "s:['\"]::g" -e 's:=:-:' -e 's: ::g'); do
|
|
|
|
split_name_version $module
|
|
|
|
print_req_prov
|
|
|
|
done
|
2013-08-13 14:41:22 +02:00
|
|
|
# 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 {
|
2013-08-15 18:20:14 +02:00
|
|
|
# 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')
|
2013-08-13 14:41:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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=:
|
2013-08-15 18:20:14 +02:00
|
|
|
for file in "$jspkg"; do
|
2013-08-13 14:41:22 +02:00
|
|
|
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
|
2012-11-14 16:43:43 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function typelib_requires {
|
|
|
|
split_name_version $(basename $1 | sed 's,.typelib$,,')
|
|
|
|
oldIFS=$IFS
|
|
|
|
IFS=$'\n'
|
|
|
|
for req in $(g-ir-dep-tool $symbol $version); do
|
|
|
|
case $req in
|
|
|
|
typelib:*)
|
|
|
|
module=${req#typelib: }
|
|
|
|
split_name_version $module
|
|
|
|
print_req_prov
|
|
|
|
;;
|
|
|
|
shlib:*)
|
|
|
|
echo "${req#shlib: }${shlib_64}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
IFS=$oldIFS
|
|
|
|
}
|
|
|
|
|
2011-04-27 16:45:13 +02:00
|
|
|
function find_requires {
|
|
|
|
# Currently, we detect:
|
|
|
|
# - in python:
|
|
|
|
# . from gi.repository import foo [Unversioned requirement of 'foo']
|
|
|
|
# . from gi.repository import foo-1.0 [versioned requirement]
|
2012-10-17 22:21:34 +02:00
|
|
|
# . gi.require_version('Gtk', '3.0') (To specify a version.. there is still an import needed)
|
2011-04-27 16:49:19 +02:00
|
|
|
# . And we do not stumble over:
|
|
|
|
# from gi.repository import foo as _bar
|
|
|
|
# from gi.repository import foo, bar
|
2011-04-27 16:45:13 +02:00
|
|
|
# - in JS:
|
|
|
|
# . imports.gi.foo; [unversioned requirement of 'foo']
|
|
|
|
# . imports.gi.goo-1.0; [versioned requirement]
|
2012-10-17 22:21:34 +02:00
|
|
|
# . imports.gi.versions.Gtk = '3.0';
|
2011-04-27 16:45:13 +02:00
|
|
|
# . The imports can be listed on one line, and we catch them.
|
|
|
|
|
|
|
|
while read file; do
|
|
|
|
case $file in
|
|
|
|
*.js)
|
2012-11-14 16:43:43 +01:00
|
|
|
javascript_requires "$file"
|
2011-04-27 16:45:13 +02:00
|
|
|
;;
|
2012-11-14 16:43:43 +01:00
|
|
|
*.py)
|
|
|
|
python_requires "$file"
|
2011-04-27 16:45:13 +02:00
|
|
|
;;
|
2012-11-14 16:43:43 +01:00
|
|
|
*.typelib)
|
|
|
|
typelib_requires "$file"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
case $(file -b $file) in
|
|
|
|
Python\ script*)
|
|
|
|
python_requires "$file"
|
|
|
|
;;
|
|
|
|
esac
|
2011-12-12 16:44:10 +01:00
|
|
|
;;
|
2011-04-27 16:45:13 +02:00
|
|
|
esac
|
|
|
|
done
|
2013-08-13 14:41:22 +02:00
|
|
|
# The pkg filter is a place holder. This should read the filter from the javascript files.
|
2013-08-15 18:20:14 +02:00
|
|
|
#if [ -n "$jspkgfilt" ]; then
|
|
|
|
javascript_pkg_filter
|
|
|
|
#fi
|
2013-08-13 14:41:22 +02:00
|
|
|
# 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
|
2011-04-27 16:45:13 +02:00
|
|
|
}
|
|
|
|
|
Accepting request 158549 from GNOME:Next
- Simplify gi-find-deps.sh to make it easier to add other 64bit
architectures. Include aarch64 in the list.
- Update to version 1.35.8:
+ Bugs fixed: bgo#660698, bgo#687522, bgo#691873, bgo#692084,
bgo#693040, bgo#693096, bgo#693097, bgo#693098, bgo#693598,
bgo#693742, bgo#693838, bgo#693876, bgo#693939.
- Update to version 1.35.4:
+ Update glib annotations.
+ Various mallardwriter improvements and fixes
+ Bugs fixed: bgo#690514, bgo#686388, bgo#656312, bgo#691030,
bgo#690850, bgo#690851, bgo#691524, bgo#678401, bgo#684059,
bgo#682355.
- Eliminate lines which contain "from gi.repository import Foo"
(incl. quotes) as possible matches... this phrase is commonly
used in multiline documentation blobs (like for example in
python-gobject >= 3.7.3).
- Modify gi-find-deps.sh: in case of python scripts, do not add
python-gobject Requires: we do not know if the scripts is meant
for python3, which would require python3-gobject.
- Update to version 1.35.3:
+ scanner: Deprecate using identifier prefixes in GINames.
+ giscanner: Don't prefer identifier prefixes over namespaces in
deps.
+ Build system enhancements / fixes.
+ Update glib annotations.
OBS-URL: https://build.opensuse.org/request/show/158549
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gobject-introspection?expand=0&rev=116
2013-03-13 23:42:28 +01:00
|
|
|
function inList() {
|
|
|
|
for word in $1; do
|
|
|
|
[[ "$word" = "$2" ]] && return 0
|
|
|
|
done
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
x64bitarch="x86_64 ppc64 s390x ia64 aarch64"
|
|
|
|
|
2011-12-23 16:19:31 +01:00
|
|
|
for path in \
|
|
|
|
$(for tlpath in \
|
2012-02-08 13:54:04 +01:00
|
|
|
$(find ${RPM_BUILD_ROOT}/usr/lib64 ${RPM_BUILD_ROOT}/usr/lib /usr/lib64 /usr/lib -name '*.typelib' 2>/dev/null); do
|
2011-12-23 16:19:31 +01:00
|
|
|
dirname $tlpath; done | uniq ); do
|
|
|
|
export GI_TYPELIB_PATH=$GI_TYPELIB_PATH:$path
|
|
|
|
done
|
2011-12-12 16:44:10 +01:00
|
|
|
|
Accepting request 158549 from GNOME:Next
- Simplify gi-find-deps.sh to make it easier to add other 64bit
architectures. Include aarch64 in the list.
- Update to version 1.35.8:
+ Bugs fixed: bgo#660698, bgo#687522, bgo#691873, bgo#692084,
bgo#693040, bgo#693096, bgo#693097, bgo#693098, bgo#693598,
bgo#693742, bgo#693838, bgo#693876, bgo#693939.
- Update to version 1.35.4:
+ Update glib annotations.
+ Various mallardwriter improvements and fixes
+ Bugs fixed: bgo#690514, bgo#686388, bgo#656312, bgo#691030,
bgo#690850, bgo#690851, bgo#691524, bgo#678401, bgo#684059,
bgo#682355.
- Eliminate lines which contain "from gi.repository import Foo"
(incl. quotes) as possible matches... this phrase is commonly
used in multiline documentation blobs (like for example in
python-gobject >= 3.7.3).
- Modify gi-find-deps.sh: in case of python scripts, do not add
python-gobject Requires: we do not know if the scripts is meant
for python3, which would require python3-gobject.
- Update to version 1.35.3:
+ scanner: Deprecate using identifier prefixes in GINames.
+ giscanner: Don't prefer identifier prefixes over namespaces in
deps.
+ Build system enhancements / fixes.
+ Update glib annotations.
OBS-URL: https://build.opensuse.org/request/show/158549
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gobject-introspection?expand=0&rev=116
2013-03-13 23:42:28 +01:00
|
|
|
if inList "$x64bitarch" "${HOSTTYPE}"; then
|
2011-12-12 16:44:10 +01:00
|
|
|
shlib_64="()(64bit)"
|
|
|
|
fi
|
2011-04-27 16:45:13 +02:00
|
|
|
case $1 in
|
|
|
|
-P)
|
|
|
|
find_provides
|
|
|
|
;;
|
|
|
|
-R)
|
|
|
|
find_requires
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|