#!/bin/sh
sqlite3 "$REPOCOP_TEST_TMPDIR/tmp.db" <<EOSQL
attach database '$REPOCOP_TEST_DBDIR/rpm.db' as rpm;
CREATE TEMPORARY TABLE SOFILES(PKGID TEXT,SOLINK TEXT,SOLIB TEXT);
INSERT INTO SOFILES select a.pkgid, a.filename, b.filename from rpm_files as a, rpm_files as b where a.pkgid=b.pkgid and (a.filename glob '/usr/lib/lib*' or a.filename glob '/usr/lib64/lib*') and a.filename glob '*.so' and b.filename glob a.filename || '.*' and b.filemode & 61440 = 32768;
-- delete known plugins-not-libs
DELETE FROM SOFILES where PKGID glob 'tomcat-native-*';
DELETE FROM SOFILES where PKGID glob 'hplip-*' AND SOLINK = '/usr/lib64/hpmud.so';
-- https://bugzilla.altlinux.org/show_bug.cgi?id=32280
DELETE FROM SOFILES where PKGID glob 'libgdiplus-*';
.mode tabs
.output $REPOCOP_TEST_TMPDIR/msg
select PKGID,SOLINK,SOLIB from SOFILES;
EOSQL
perl -ne 'chomp;@a=split /\t/;system(qw/repocop-test-info -k/,$a[0], "SharedLibs Policy Draft violation: Shared Lib package should not contain symlink $a[1] but just $a[2]. According to SharedLibs Policy Draft, symlink $a[1] should be placed in a special subpackage named lib<name>-devel. If you have already packaged this symlink in lib<name>-devel, just append \\%exclude $a[1] to \\%files of $a[0]. Otherwise, move the symlink into the subpackage lib<name>-devel. There is a known exception for case the .so file is not a shared lib but a plugin that is never directly linked with. Please report such a case to repocop test.")' $REPOCOP_TEST_TMPDIR/msg
rm $REPOCOP_TEST_TMPDIR/*
