/var/lib/pcp/testsuite/common.rpm is in pcp-testsuite 4.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | #
# Copyright (c) 2013-2014 Red Hat.
#
# Common pre-test checking and settings for pmdarpm QA. Handles
# setup for the basic environment needed for all RPM PMDA tests.
#
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
_rpm_support_tests()
{
[ -f /etc/slackware-version ] && _notrun "No don't exercise rpm bits on Slackware"
which rpmbuild >/dev/null 2>&1 || _notrun "No rpmbuild binary found"
test -x "$PCP_PMDAS_DIR/rpm/pmdarpm" || _notrun "pmdarpm not installed"
}
_rpm_pmda_prepare()
{
_prepare_pmda_install rpm
cd $PCP_PMDAS_DIR/rpm
$sudo ./Install </dev/null >> $here/$seq.full 2>&1
cd $here
}
_rpm_pmda_restore()
{
_restore_pmda_install rpm
cd $here
}
_remove_rpm_pmda()
{
cd $PCP_PMDAS_DIR/rpm
$sudo ./Remove < /dev/null >> $here/$seq.full 2>&1
cd $here
}
#
# Build a spec file and source tarball for a test RPM.
# Sample specfile based on the Maximum RPM book example
# cos I'm too lame to come up with my own lame example.
#
# If successful sets variables on return for later use:
# $rpm_{bin,dbg,src}_pkg $rpm_spec $rpm_name
#
_rpm_package_prepare()
{
echo "Preparing RPM package"
dir=$tmp.build.dir
mkdir -p $dir
tgz=qaplayer-1.0.tgz
tar=$dir/$tgz
usr=`id -u -n`
grp=`id -g -n`
# prepare the spec file
cat >$dir/qaplayer.spec <<End-of-file
Summary: A QA player app that rocks!
Name: qaplayer
Version: 1.0
Release: 1
License: GPL
BuildArch: noarch
Group: Applications/Sound
Source: $tgz
URL: http://www.gnomovision.com/qaplayer/qaplayer.html
Distribution: WSS Linux
Vendor: White Socks Software, Inc.
Packager: Santa Claus <sclaus@northpole.com>
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-$usr
%description
It slices! It dices! It's a QA player app that
can't be beat. By using the resonant frequency
of the QA itself, it is able to simulate 20X
oversampling. This leads to sound quality that
cannot be equaled with more mundane software...
%prep
%setup
%clean
rm -Rf \$RPM_BUILD_ROOT
%build
%install
mkdir -p \$RPM_BUILD_ROOT/%{_localstatedir}/qaplayer
%files
%defattr(-,$usr,$grp)
%dir %{_localstatedir}/qaplayer
End-of-file
echo file: $dir/qaplayer.spec >> $here/$seq.full
cat $dir/qaplayer.spec >> $here/$seq.full
# prepare a source tarball
mkdir qaplayer-1.0 2>/dev/null
ln $seq qaplayer-1.0/$seq 2>/dev/null
tar czf $dir/qaplayer-1.0.tgz qaplayer-1.0/$seq
rm -fr qaplayer-1.0
# prepare an installable RPM
rpmbuild -ba \
--define "_topdir $dir" \
--define '_builddir %{_topdir}' \
--define '_sourcedir %{_topdir}' \
--define '_rpmdir %{_topdir}' \
--define '_srcrpmdir %{_topdir}' \
--define '_specdir %{_topdir}' \
--define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.noarch.rpm' \
$dir/qaplayer.spec >> $here/$seq.full 2>&1
rpm_dbg_pkg=$dir/qaplayer-debuginfo-1.0-1.noarch.rpm
rpm_bin_pkg=$dir/qaplayer-1.0-1.noarch.rpm
rpm_src_pkg=$dir/qaplayer-1.0-1.src.rpm
rpm_spec=$dir/qaplayer.spec
rpm_name=qaplayer
rpm_inst=qaplayer-1.0-1.noarch
}
_rpm_prepare_check()
{
if [ "X$rpm_name" = "X" -o "X$rpm_inst" = "X" ]
then
echo "QA test bug - _rpm_package_prepare not yet done?"
exit 1
fi
}
_rpm_package_install()
{
if [ "X$rpm_name" != "X" ]
then
rpm -q $rpm_name >/dev/null 2>&1
if [ $? -eq 0 ]
then
echo "$rpm_name already installed!?!"
else
echo "Installing $rpm_name" | tee -a $here/$seq.full
echo "RPM pathname: $rpm_bin_pkg" >> $here/$seq.full
echo "count before from rpm(1): `$sudo rpm -qa | wc -l | sed -e 's/ *//g'`" >> $seq.full
$sudo rpm -i $rpm_bin_pkg >> $here/$seq.full 2>&1
$sudo rpm -qa >> $seq.full 2>&1
echo "count after from rpm(1): `$sudo rpm -qa | wc -l | sed -e 's/ *//g'`" >> $seq.full
fi
fi
}
_rpm_package_install_await()
{
countdown=300 # 30 seconds
_rpm_prepare_check
while [ $countdown -gt 0 ]
do
pminfo -f rpm.arch | grep -q "or \"$rpm_inst\"]" && return 0
pmsleep 0.1
countdown=`expr $countdown - 1`
done
echo "rpm_package_install_await gave up awaiting $rpm_inst install!"
exit 1
}
_rpm_package_remove()
{
if [ "X$rpm_name" != "X" ]
then
if rpm -q $rpm_name >/dev/null 2>&1
then
echo "Removing $rpm_name" | tee -a $here/$seq.full
$sudo rpm -e $rpm_name >> $here/$seq.full 2>&1
fi
fi
}
_rpm_package_remove_await()
{
countdown=150 # 15 seconds
_rpm_prepare_check
while [ $countdown -gt 0 ]
do
pminfo -f rpm.arch | grep -q "or \"$rpm_inst\"]" || return 0
pmsleep 0.1
countdown=`expr $countdown - 1`
done
echo "rpm_package_remove_await gave up awaiting $rpm_name removal!"
exit 1
}
_rpm_cleanup()
{
$remove_on_cleanup && _remove_rpm_pmda
# replace the pmcd setup with original
_rpm_pmda_restore
# remove any newly installed RPM
_rpm_package_remove
$sudo rm -fr $tmp.*.dir
$sudo rm -f $tmp.*
exit $status
}
remove_on_cleanup=true
pminfo rpm >/dev/null 2>&1 && remove_on_cleanup=false
|