#!/bin/sh
sqlite3 "$REPOCOP_TEST_DBDIR/rpm.db" <<EOSQL
.mode tabs
create temporary table tmp1 (id TEXT);
INSERT INTO tmp1 select distinct pkgid from RPM_SCRIPTS_POSTIN where (POSTINPROG glob '*alternatives-*' or POSTIN glob '*alternatives-update*' or POSTIN glob '*alternatives-helper*') and PKGID not glob 'alternatives-*';
INSERT INTO tmp1 select distinct pkgid from RPM_SCRIPTS_POSTUN where (POSTUNPROG glob '*alternatives-*' or POSTUN glob '*alternatives-update*' or POSTUN glob '*alternatives-helper*') and PKGID not glob 'alternatives-*';
INSERT INTO tmp1 select distinct pkgid from RPM_SCRIPTS_PREIN where (PREINPROG glob '*alternatives-*' or PREIN glob '*alternatives-update*' or PREIN glob '*alternatives-helper*') and PKGID not glob 'alternatives-*';
INSERT INTO tmp1 select distinct pkgid from RPM_SCRIPTS_PREUN where (PREUNPROG glob '*alternatives-*' or PREUN glob '*alternatives-update*' or PREUN glob '*alternatives-helper*') and PKGID not glob 'alternatives-*';
INSERT INTO tmp1 select distinct pkgid from RPM_TRIGGERS where (TRIGGERSCRIPTPROG glob '*alternatives-*' or TRIGGERSCRIPT glob '*alternatives-update*' or TRIGGERSCRIPT glob '*alternatives-helper*') and PKGID not glob 'alternatives-*';
DELETE FROM tmp1 WHERE id IN (select pkgid from RPM_REQUIRES WHERE REQUIRENAME = 'alternatives' AND REQUIREVERSION glob '0.4*' OR REQUIREVERSION glob '0:0.4*');
-- known by force call
DELETE FROM tmp1 WHERE id GLOB 'java-1.*-openjdk-*';
.output $REPOCOP_TEST_TMPDIR/msg1
select distinct id from tmp1;
DROP TABLE tmp1;
EOSQL
for i in `sort -u $REPOCOP_TEST_TMPDIR/msg*`; do repocop-test-warn -k $i 'alternatives-* calls in post/preun and in triggers are deprecated'; done
rm $REPOCOP_TEST_TMPDIR/*
