1 # rpmbuild.at: test rpmbuild
3 # Copyright (C) 2007 Ralf Corsépius <corsepiu@fedoraproject.org>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 AT_BANNER([RPM build])
21 # ------------------------------
22 # Check if rpmbuild -ba *.spec works
23 AT_SETUP([rpmbuild -ba *.spec])
27 AS_MKDIR_P(${TOPDIR}/SOURCES)
29 cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
32 -ba "${abs_srcdir}"/data/SPECS/hello.spec
39 # ------------------------------
40 # Check if rpmbuild --rebuild *.src.rpm works
41 AT_SETUP([rpmbuild --rebuild])
47 --rebuild "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
54 # ------------------------------
55 # Check if tar unpacking works
56 AT_SETUP([rpmbuild -tb <tar with bad spec>])
62 -tb "${RPMDATA}/SOURCES/hello-1.0.tar.gz"
66 [error: line 5: Unknown tag: Serial: 1
70 # ------------------------------
71 # Check if tar build works
72 # TODO: test that the rpms are actually created...
73 AT_SETUP([rpmbuild -tb])
79 -ta "${RPMDATA}/SOURCES/hello-2.0.tar.gz"
86 # ------------------------------
87 # %attr/%defattr tests
88 AT_SETUP([rpmbuild %attr and %defattr])
94 -bb --quiet /data/SPECS/attrtest.spec
96 runroot rpm -qp --qf \
97 "\n[%{filemodes:perms} %-8{fileusername} %-8{filegroupname} %{filenames}\n]"\
98 "${TOPDIR}"/RPMS/noarch/attrtest-1.0-1.noarch.rpm
102 drwx------ root root /a/dir
103 -r-------- root root /a/file
104 drwx------ daemon adm /b/dir
105 -r-------- daemon adm /b/file
106 drwxr-x--- root adm /c/dir
107 -rw-r----- daemon root /c/file
108 drwxr-x--x daemon bin /d/dir
109 -rw-r--r-- bin daemon /d/file
110 drwx------ foo bar /e/dir
111 -r-------- foo bar /e/file
112 drwxrwx--- bar foo /f/dir
113 -rw-rw---- bar foo /f/file
114 drwx------ adm foo /g/dir
115 -r-------- bar adm /g/file
116 drwxr-xr-x foo bar /h/dir
117 -rw-r--r-- foo bar /h/file
118 drwxr-x--- adm root /i/dir
119 -rwsr-xr-x root adm /i/file
120 drwxrwxrwx zoot zoot /j/dir
121 --w--w--w- zoot zoot /j/file
126 # ------------------------------
128 AT_SETUP([rpmbuild hardlink])
136 -bb --quiet /data/SPECS/hlinktest.spec
138 runroot rpm -i "${TOPDIR}"/RPMS/noarch/hlinktest-1.0-1.noarch.rpm
140 runroot rpm -q --qf "[[%{filenlinks} %{filenames}\n]]%{longsize}\n" hlinktest
141 runroot rpm -V --nouser --nogroup hlinktest
142 ls -i "${RPMTEST}"/foo/hello* | awk {'print $1'} | sort -u | wc -l