Use basename (3) for the %basename macro
This commit is contained in:
parent
9571e3d9a2
commit
3ad98187cc
|
@ -1301,10 +1301,7 @@ static void doFoo(rpmMacroBuf mb, rpmMacroEntry me, ARGV_t argv, size_t *parsed)
|
|||
|
||||
if (rstreq("basename", me->name)) {
|
||||
buf = xstrdup(argv[1]);
|
||||
if ((b = strrchr(buf, '/')) == NULL)
|
||||
b = buf;
|
||||
else
|
||||
b++;
|
||||
b = basename(buf);
|
||||
} else if (rstreq("dirname", me->name)) {
|
||||
buf = xstrdup(argv[1]);
|
||||
b = dirname(buf);
|
||||
|
|
|
@ -373,6 +373,11 @@ runroot rpm --eval "%dirname /foo"
|
|||
runroot rpm --eval "%dirname /foo/"
|
||||
runroot rpm --eval "%dirname /foo/foobar"
|
||||
runroot rpm --eval "%dirname /foo/foobar/"
|
||||
runroot rpm --eval "%basename /foo/foobar"
|
||||
runroot rpm --eval "%basename /foo/foobar/"
|
||||
runroot rpm --eval "%basename /"
|
||||
runroot rpm --eval "%basename foobar/"
|
||||
runroot rpm --eval "%basename foobar"
|
||||
runroot rpm --define '%xxx /hello/%%%%/world' --eval '%{dirname:%xxx}'
|
||||
runroot rpm --eval "%{uncompress}"
|
||||
runroot rpm --eval "%{uncompress:}"
|
||||
|
@ -403,6 +408,11 @@ runroot rpm --eval "%verbose foo"
|
|||
/
|
||||
/foo
|
||||
/foo
|
||||
foobar
|
||||
foobar
|
||||
/
|
||||
foobar
|
||||
foobar
|
||||
/hello/%%
|
||||
|
||||
bar
|
||||
|
|
Loading…
Reference in New Issue