Commit 6a4e9444 authored by Sam Thursfield's avatar Sam Thursfield

Merge branch 'sam/reconfigure-extractor-fix' into 'master'

build: Remove old extract rules from build tree when configuration changes

See merge request !71
parents 8f5c35cc d7cdc758
......@@ -393,7 +393,7 @@ tracker_extract_rules_dir = join_paths(get_option('prefix'), get_option('datadir
tracker_miner_services_dir = join_paths(get_option('prefix'), get_option('datadir'), 'tracker/miners')
tracker_writeback_modules_dir = join_paths(get_option('prefix'), get_option('libdir'), 'tracker-miners-@0@/writeback-modules'.format(tracker_api_version))
tracker_uninstalled_extract_rules_dir = join_paths(meson.current_build_dir(), 'src', 'tracker-extract')
tracker_uninstalled_extract_rules_dir = join_paths(meson.current_build_dir(), 'src', 'tracker-extract', 'uninstalled-rules')
tracker_uninstalled_writeback_modules_dir = join_paths(meson.current_build_dir(), 'src', 'tracker-writeback')
gsettings_schema_dir = join_paths(get_option('prefix'), get_option('datadir'), 'glib-2.0', 'schemas')
......
......@@ -114,6 +114,7 @@ if libgxps.found()
modules += [['extract-xps', 'tracker-extract-xps.c', ['10-xps.rule'], [libgxps, tracker_miners_common_dep]]]
endif
enabled_rule_files = []
foreach module : modules
name = module[0]
......@@ -130,13 +131,7 @@ foreach module : modules
install_data(rules, install_dir: tracker_extract_rules_dir)
# Populate tracker_uninstalled_extract_rules_dir with the enabled .rule files.
foreach rule: rules
configure_file(
input: rule,
output: rule,
copy: true)
endforeach
enabled_rule_files += rules
endforeach
tracker_extract_priority_dbus = gnome.gdbus_codegen(
......@@ -206,3 +201,13 @@ if install_systemd_user_services
install: true,
install_dir: systemd_user_services_dir)
endif
# Populate a directory inside the build tree with the extract rules that are
# enabled in this build configuration.
setup_extract_rules = join_paths(meson.current_source_dir(), 'setup-extract-rules.sh')
result = run_command(setup_extract_rules, meson.current_source_dir(), tracker_uninstalled_extract_rules_dir, enabled_rule_files)
if result.returncode() != 0
output = result.stdout().strip()
errortxt = result.stderr().strip()
error('Failed to run @0@.\n@1@\n@2@'.format(setup_extract_rules, errortxt, output))
endif
#!/bin/sh
# Create a directory of enabled extract rules inside the build tree, for
# use when running tracker-extract from the build tree.
set -ex
if [ "$#" -lt 2 ]; then
echo >&2 "Usage: $0 SOURCE_DIR TARGET_DIR [RULE1 RULE2...]"
exit 1;
fi
source_dir=$1
target_dir=$2
shift
shift
if [ ! -d ${target_dir} ]; then
mkdir -p ${target_dir}
fi
# Start from a clean directory, this is very important when we
# reconfigure an existing build tree.
rm -f ${target_dir}/*.rule
while [ -n "$1" ]; do
rule="$1"
cp ${source_dir}/${rule} ${target_dir}
shift
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment