# rpmquery.at: test rpmquery # # Copyright (C) 2007 Ralf Corsépius # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # ------------------------------ AT_SETUP([rpmquery --qf -p *.i386.rpm]) AT_CHECK([ rpmquery \ --rcfile=${RPMRC} \ --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" \ -p "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm ], [0], [hello-1.0-1.i386 ], [ignore]) AT_CLEANUP # ------------------------------ AT_SETUP([rpmquery --qf -p *.src.rpm]) AT_CHECK([ rpmquery \ --rcfile=${RPMRC} \ --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" \ -p "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm ], [0], [hello-1.0-1.i386 ], [ignore]) AT_CLEANUP # ------------------------------ AT_SETUP([rpmquery -ql -p *.src.rpm]) AT_CHECK([ rpmquery \ --rcfile=${RPMRC} \ -ql \ -p "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm ], [0], [hello-1.0.tar.gz hello.spec ], [ignore]) AT_CLEANUP # ------------------------------ AT_SETUP([rpmquery -ql -p *.i386.rpm]) AT_CHECK([ rpmquery \ --rcfile=${RPMRC} \ -ql \ -p "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm ], [0], [/usr/local/bin/hello /usr/share/doc/hello-1.0 /usr/share/doc/hello-1.0/FAQ ], [ignore]) AT_CLEANUP # ------------------------------ # Try to check "scripts" # * Gets rpmpopt-$(VERSION) involved AT_SETUP([rpm -q --scripts -p *.i386.rpm]) AT_CHECK([ rpm \ --rcfile=${RPMRC} \ -q --scripts \ -p "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm ], [0], [preinstall program: /bin/sh postinstall program: /bin/sh preuninstall program: /bin/sh postuninstall program: /bin/sh ], [ignore]) AT_CLEANUP # ------------------------------ # install a package into a local rpmdb # * Shall only work with relocation # * Use --ignorearch because we don't know the arch AT_SETUP([rpm -qil hello]) AT_CHECK([ RPM_INIT_DB ], [0],[ignore],[ignore]) AT_CHECK([ rpm --rcfile=${RPMRC} \ --root="${abs_builddir}"/testing \ --nodeps --ignorearch --relocate=/usr="${abs_builddir}"/testing/check \ -i "${abs_srcdir}"/data/RPMS/hello-1.0-1.ppc64.rpm ], [0], [ignore], [ignore]) AT_CHECK([ rpm --rcfile=${RPMRC} \ --root="${abs_builddir}"/testing \ -q hello ], [0], [hello-1.0-1.ppc64 ], [ignore]) cat > expout << _ATEOF ${abs_builddir}/testing/check/local/bin/hello ${abs_builddir}/testing/check/share/doc/hello-1.0 ${abs_builddir}/testing/check/share/doc/hello-1.0/FAQ _ATEOF AT_CHECK([ rpm --rcfile=${RPMRC} \ --root="${abs_builddir}"/testing \ -ql hello ], [0], [expout], [ignore]) AT_CLEANUP