/var/lib/pcp/testsuite/common.rpm is in pcp-testsuite 3.8.12ubuntu1.
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 | #
# Common pre-test checking and settings for pmdarpm QA. Handles
# setup for the basic environment needed for all RPM PMDA tests.
#
# Copyright (c) 2013-2014 Red Hat.
#
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
_rpm_support_tests()
{
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 >/dev/null 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 > /dev/null 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 >> seq.full
cat $dir/qaplayer.spec >> $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 >> $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_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 $seq.full
echo "RPM pathname: $rpm_bin_pkg" >> $seq.full
$sudo rpm -i $rpm_bin_pkg >> $seq.full 2>&1
$sudo rpm -qa >> $seq.full 2>&1
fi
fi
}
_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 $seq.full
$sudo rpm -e $rpm_name >> $seq.full 2>&1
fi
fi
}
_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
|