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
|
# rpmmacro.at: test rpm macros
#
AT_BANNER([RPM macros])
# ------------------------------
AT_SETUP([simple rpm --eval])
AT_CHECK([
run rpm --define "this that" --eval '%{this}'
],
[0],
[that
])
AT_CLEANUP
AT_SETUP([simple true conditional rpm --eval])
AT_CHECK([
run rpm --define "this that" --eval '%{?this}'
],
[0],
[that
])
AT_CLEANUP
AT_SETUP([simple false conditional rpm --eval])
AT_CHECK([
run rpm --define "this that" --eval '%{?that}'
],
[0],
[
])
AT_CLEANUP
AT_SETUP([uncompress macro])
AT_CHECK([
(cd ${RPMDATA}/SOURCES/ &&
run rpm \
--define "__gzip /my/bin/gzip" \
--eval "%{uncompress:hello-2.0.tar.gz}"
)
],
[0],
[/my/bin/gzip -dc hello-2.0.tar.gz
])
AT_CLEANUP
AT_SETUP([basename macro])
AT_CHECK([
(cd ${RPMDATA}/SOURCES/ &&
run rpm \
--eval "%{basename:${RPMDATA}/SOURCES/hello-2.0.tar.gz}"
)
],
[0],
[hello-2.0.tar.gz
])
AT_CLEANUP
AT_SETUP([suffix macro])
AT_CHECK([
(cd ${RPMDATA}/SOURCES/ &&
run rpm \
--eval "%{suffix:${RPMDATA}/SOURCES/hello-2.0.tar.gz}"
)
],
[0],
[gz
])
AT_CLEANUP
AT_SETUP([url2path macro])
AT_CHECK([
(cd ${RPMDATA}/SOURCES/ &&
run rpm \
--eval "%{url2path:http://hello.org/releases/hello-2.0.tar.gz}"
)
],
[0],
[/releases/hello-2.0.tar.gz
])
AT_CLEANUP
AT_SETUP([shell expansion])
AT_CHECK([
(cd ${RPMDATA}/SOURCES/ &&
run rpm \
--eval "%(echo foo)"
)
],
[0],
[foo
])
AT_CLEANUP
AT_SETUP([simple lua --eval])
AT_CHECK([
run rpm --eval '%{lua:print(5*5)}'
],
[0],
[25
])
AT_CLEANUP
AT_SETUP([lua rpm extensions])
AT_CHECK([
run rpm --eval '%{lua: rpm.define("foo bar") print(rpm.expand("%{foo}"))}'
],
[0],
[bar
])
AT_CLEANUP
AT_SETUP([lua posix extensions])
AT_CHECK([
run rpm \
--eval '%{lua: posix.putenv("LUATEST=ok") print(posix.getenv("LUATEST"))}'
],
[0],
[ok
])
AT_CLEANUP
|