diff -urN rpm-5.4.10-orig/configure.ac rpm-5.4.10-patched/configure.ac --- rpm-5.4.10-orig/configure.ac 2016-10-13 19:51:48.630996187 +1000 +++ rpm-5.4.10-patched/configure.ac 2016-10-13 21:31:19.476242608 +1000 @@ -2572,7 +2572,7 @@ macros/macros macros/macros.rpmbuild macros/cmake macros/gstreamer macros/java macros/kernel macros/libtool macros/mandriva macros/suse macros/fedora macros/mono macros/perl macros/pkgconfig macros/php - macros/python macros/ruby macros/selinux macros/tcl + macros/python macros/ruby macros/selinux macros/tcl macros/qml doc/Makefile doc/manual/Makefile doc/fr/Makefile doc/ja/Makefile doc/ko/Makefile doc/pl/Makefile doc/ru/Makefile doc/sk/Makefile diff -urN rpm-5.4.10-orig/lib/rpmfc.c rpm-5.4.10-patched/lib/rpmfc.c --- rpm-5.4.10-orig/lib/rpmfc.c 2016-10-13 19:51:48.806996194 +1000 +++ rpm-5.4.10-patched/lib/rpmfc.c 2016-10-13 22:14:04.696348477 +1000 @@ -647,6 +647,7 @@ { "libtool library ", RPMFC_LIBTOOL|RPMFC_INCLUDE }, { "pkgconfig ", RPMFC_PKGCONFIG|RPMFC_INCLUDE }, + { "qml ", RPMFC_QML|RPMFC_INCLUDE }, { "Bourne ", RPMFC_BOURNE|RPMFC_INCLUDE }, { "Bourne-Again ", RPMFC_BOURNE|RPMFC_INCLUDE }, @@ -953,6 +954,10 @@ #endif xx = rpmfcHelper(fc, 'R', "pkgconfig"); } else + if (fc->fcolor->vals[fc->ix] & RPMFC_QML) { + xx = rpmfcHelper(fc, 'P', "qml"); +// xx = rpmfcHelper(fc, 'R', "qml"); + } else if (fc->fcolor->vals[fc->ix] & RPMFC_BOURNE) { #ifdef NOTYET xx = rpmfcHelper(fc, 'P', "executable"); @@ -1147,7 +1152,7 @@ /*@unchecked@*/ static struct rpmfcApplyTbl_s rpmfcApplyTable[] = { { rpmfcELF, RPMFC_ELF }, - { rpmfcSCRIPT, (RPMFC_SCRIPT|RPMFC_FONT|RPMFC_HASKELL|RPMFC_RUBY|RPMFC_PERL|RPMFC_PYTHON|RPMFC_LIBTOOL|RPMFC_PKGCONFIG|RPMFC_BOURNE|RPMFC_JAVA|RPMFC_PHP|RPMFC_MONO|RPMFC_TYPELIB|RPMFC_NODEJS) }, + { rpmfcSCRIPT, (RPMFC_SCRIPT|RPMFC_FONT|RPMFC_HASKELL|RPMFC_RUBY|RPMFC_PERL|RPMFC_PYTHON|RPMFC_LIBTOOL|RPMFC_PKGCONFIG|RPMFC_QML|RPMFC_BOURNE|RPMFC_JAVA|RPMFC_PHP|RPMFC_MONO|RPMFC_TYPELIB|RPMFC_NODEJS) }, #if defined(RPM_VENDOR_MANDRIVA) { rpmfcSYMLINK, RPMFC_SYMLINK }, #endif @@ -1455,6 +1460,14 @@ else if (_suffix(s, ".pc")) ftype = "pkgconfig file"; + /* XXX all files with extension ".qml" are qml for now. */ + else if (_suffix(s, ".qml")) + ftype = "qml file"; + + /* XXX all files named "qmldir" are qml for now. */ + else if (_suffix(s, "qmldir")) + ftype = "qml file"; + /* XXX all files with extension ".php" are PHP for now. */ else if (_suffix(s, ".php")) ftype = "PHP script text"; diff -urN rpm-5.4.10-orig/lib/rpmfc.h rpm-5.4.10-patched/lib/rpmfc.h --- rpm-5.4.10-orig/lib/rpmfc.h 2016-10-13 19:51:48.806996194 +1000 +++ rpm-5.4.10-patched/lib/rpmfc.h 2016-10-13 21:31:19.498242609 +1000 @@ -24,7 +24,7 @@ #define RPMFC_ELF (RPMFC_ELF32|RPMFC_ELF64|RPMFC_ELFMIPSN32) /* (1 << 3) leaks into package headers, reserved */ - /* bit 4 unused */ + RPMFC_QML = (1 << 4), RPMFC_TYPELIB = (1 << 5), RPMFC_HASKELL = (1 << 6), RPMFC_RUBY = (1 << 7), diff -urN rpm-5.4.10-orig/macros/macros rpm-5.4.10-patched/macros/macros --- rpm-5.4.10-orig/macros/macros 2016-10-13 19:51:48.798996194 +1000 +++ rpm-5.4.10-patched/macros/macros 2016-10-13 21:31:19.500242609 +1000 @@ -1061,6 +1061,10 @@ #%%{load:%{_usrlibrpm}/macros.d/pkgconfig} #------------------------------------------------------------------------ +# qml(...) configuration. +#%%{load:%{_usrlibrpm}/macros.d/qml} + +#------------------------------------------------------------------------ # mono(...) configuration. #%%{load:%{_usrlibrpm}/macros.d/mono} diff -urN rpm-5.4.10-orig/macros/macros.in rpm-5.4.10-patched/macros/macros.in --- rpm-5.4.10-orig/macros/macros.in 2016-10-13 19:51:48.647996188 +1000 +++ rpm-5.4.10-patched/macros/macros.in 2016-10-13 21:31:19.509242609 +1000 @@ -1065,6 +1065,10 @@ %{load:%{_usrlibrpm}/macros.d/pkgconfig} #------------------------------------------------------------------------ +# qml(...) configuration. +%{load:%{_usrlibrpm}/macros.d/qml} + +#------------------------------------------------------------------------ # mono(...) configuration. %{load:%{_usrlibrpm}/macros.d/mono} diff -urN rpm-5.4.10-orig/macros/qml rpm-5.4.10-patched/macros/qml --- rpm-5.4.10-orig/macros/qml 1970-01-01 10:00:00.000000000 +1000 +++ rpm-5.4.10-patched/macros/qml 2016-10-13 21:31:19.513242610 +1000 @@ -0,0 +1,11 @@ +# QML specific macro definitions. +# To make use of these macros insert the following line into your spec file: +# %{load:%{_usrlibrpm}/macros.d/qml} +# + +# Path to scripts to autogenerate QML package dependencies, +# +# Note: Used iff _use_internal_dependency_generator is non-zero. The +# helpers are also used by %{_rpmhome}/rpmdeps {--provides|--requires}. +%__qml_provides %{_rpmhome}/qmldeps.sh --provides +%__qml_requires %{_rpmhome}/qmldeps.sh --requires diff -urN rpm-5.4.10-orig/macros/qml.in rpm-5.4.10-patched/macros/qml.in --- rpm-5.4.10-orig/macros/qml.in 1970-01-01 10:00:00.000000000 +1000 +++ rpm-5.4.10-patched/macros/qml.in 2016-10-13 21:31:19.515242610 +1000 @@ -0,0 +1,11 @@ +# QML specific macro definitions. +# To make use of these macros insert the following line into your spec file: +# %{load:%{_usrlibrpm}/macros.d/qml} +# + +# Path to scripts to autogenerate QML package dependencies, +# +# Note: Used iff _use_internal_dependency_generator is non-zero. The +# helpers are also used by %{_rpmhome}/rpmdeps {--provides|--requires}. +%__qml_provides %{_rpmhome}/qmldeps.sh --provides +%__qml_requires %{_rpmhome}/qmldeps.sh --requires diff -urN rpm-5.4.10-orig/Makefile.am rpm-5.4.10-patched/Makefile.am --- rpm-5.4.10-orig/Makefile.am 2012-03-17 11:24:19.000000000 +1100 +++ rpm-5.4.10-patched/Makefile.am 2016-10-13 21:31:19.515242610 +1000 @@ -118,7 +118,7 @@ pkgcfg_DATA = \ macros/cmake macros/gstreamer macros/java macros/kernel macros/libtool \ macros/mandriva macros/mono macros/perl macros/pkgconfig macros/php \ - macros/python macros/ruby macros/selinux macros/tcl + macros/python macros/ruby macros/selinux macros/tcl macros/qml noinst_HEADERS = build.h debug.h system.h diff -urN rpm-5.4.10-orig/scripts/Makefile.am rpm-5.4.10-patched/scripts/Makefile.am --- rpm-5.4.10-orig/scripts/Makefile.am 2016-10-13 19:51:47.745996150 +1000 +++ rpm-5.4.10-patched/scripts/Makefile.am 2016-10-13 21:31:19.519242610 +1000 @@ -67,7 +67,8 @@ rpm.daily rpm.log rpm.xinetd \ rubygems.rb \ tgpg u_pkg.sh \ - vcheck vpkg-provides.sh vpkg-provides2.sh + vcheck vpkg-provides.sh vpkg-provides2.sh \ + qmldeps.sh pkglibbindir = @USRLIBRPM@/bin diff -urN rpm-5.4.10-orig/scripts/qmldeps.sh rpm-5.4.10-patched/scripts/qmldeps.sh --- rpm-5.4.10-orig/scripts/qmldeps.sh 1970-01-01 10:00:00.000000000 +1000 +++ rpm-5.4.10-patched/scripts/qmldeps.sh 2016-10-13 22:13:24.485346817 +1000 @@ -0,0 +1,88 @@ +#!/bin/bash +# Copyright (C) 2012 Jolla Oy +# Contact: Bernd Wachter +# Modified by Andrey Bondrov +# +# Try to locate module information for automatic provide generation from +# qmldir files as well as information about imported modules for automatic +# require generation from qml files. +# +# TODO: +# - figure out if type handling needs special attention in regard to versioning +# - stuff like Sailfish.Silica.theme currently can't get autodetected +# - implement requires generation +# - check if the regex include all valid characters allowed in module definitions +# - fine tune the regex -- they're currently not perfect, just "good enough" +# +# A note about versioning: +# A module package should provide the module in the version of the highest file +# included in the package. A package using a module should require the module +# in a version >= the one used for the import. + +[ $# -ge 1 ] || { + cat > /dev/null + exit 0 +} + +# grep blows up with C/POSIX locale, so make sure we're using a working locale +if [ -z "$LANG" ] || [ "$LANG" = "C" ] || [ "$LANG" = "POSIX" ] ; then + export LANG=en_US.UTF-8 +fi + +case $1 in +-P|--provides) + while read file; do + case "$file" in + */qmldir) + if head -1 "$file" | grep -iq '^module\s*' 2>/dev/null; then + provides="`head -1 ${file} | sed -r 's/^module\s+//'`" + version="`grep -i -E -o '^[a-z]*\s+[0-9.]*\s+[a-z0-9]*.qml' ${file} | awk '{print $2}' | sort -r | uniq | head -1`" + if [ -z "$version" ]; then +# echo "qmldeps: WARNING: no version number found, package version will be used." >&2 + echo "qml($provides)" + else + echo "qml($provides) = $version" + fi + else + echo "qmldeps: no valid module definition found in $file" >&2 + fi + ;; + esac + done + ;; +-R|--requires) + while read file; do + case "$file" in + *.qml) + # this first part is some hack to avoid depending on own provides + # for modules + qmldir=`echo ${file}|sed 's,/[^/]*$,,'` + qmldir_noprivate=`echo ${file}|sed 's,private/[^/]*$,,'` + if [ -f $qmldir/qmldir ]; then + module=`head -1 $qmldir/qmldir | sed -r 's/^.*\s+//'` + elif [ -f $qmldir_noprivate/qmldir ]; then + module=`head -1 $qmldir_noprivate/qmldir | sed -r 's/^.*\s+//'` + fi + IFS=$'\n' + imports=`grep -i -E -o '^\s*import\s+[a-z0-9.]*\s+[0-9.]*' ${file} | sed -r -e 's/^\s*import\s*//' | sort | uniq` + if [ -z "$imports" ]; then + echo "qmldeps: no imports found in $file. Probably should not happen." >&2 + fi + for i in $imports; do + import=`echo $i | awk '{ print $1 }'` + import_version=`echo $i | awk '{ print $2 }'` + if [ $import = "$module" ]; then + echo "qmldeps: skipping provide for own module '$module' in $file" >&2 + elif echo $import | grep -q '\.private$'; then + echo "qmldeps: skipping private import '$import' in $file" >&2 + else + # remove the >&2 to enable requires generation as well + echo "qml($import) >= $import_version" + fi + done + ;; + esac + done + ;; +esac +exit 0