Skip to content

Commit 4a879f0

Browse files
committed
Add support for autobuild buildrequires
1 parent 52ed0fb commit 4a879f0

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

build/parseSpec.c

+9
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,15 @@ static rpmRC parseAutobuild(rpmSpec spec)
949949
for (struct autosect_s *as = autosectList; !rc && as->name; as++) {
950950
rc = parseAutosect(spec, autobuild, as->name, as->sb);
951951
}
952+
953+
char *br = rpmExpand("%{?autobuild_", autobuild, "_buildrequires}",
954+
NULL);
955+
if (!rc && *br) {
956+
/* Spec isn't passed because this data doesn't originate from it */
957+
rc = parseRCPOT(NULL, spec->sourcePackage, br,
958+
RPMTAG_BUILDREQUIRES, 0, 0, addReqProvPkg, NULL);
959+
}
960+
free(br);
952961
}
953962
free(autobuild);
954963
return rc;

macros.in

+1
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,7 @@ end
13581358
}
13591359

13601360
# example autobuild macros for autotools
1361+
%autobuild_autotools_buildrequires() make
13611362
%autobuild_autotools_prep() %autosetup -p1
13621363
%autobuild_autotools_conf() %configure
13631364
%autobuild_autotools_build() %make_build

tests/rpmbuild.at

+9-1
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,21 @@ AT_SETUP([rpmbuild -b autobuild])
4848
AT_KEYWORDS([build])
4949
RPMDB_INIT
5050
RPMTEST_CHECK([
51-
runroot rpmbuild -bb --quiet /data/SPECS/amhello.spec
51+
runroot rpmbuild -bb --nodeps --quiet /data/SPECS/amhello.spec
5252
runroot rpm -q /build/RPMS/x86_64/amhello-1.0-1.x86_64.rpm
5353
],
5454
[0],
5555
[amhello-1.0-1.x86_64
5656
],
5757
[])
58+
59+
RPMTEST_CHECK([
60+
runroot rpmspec -q --srpm --buildrequires /data/SPECS/amhello.spec | grep -v ^Reading
61+
],
62+
[0],
63+
[make
64+
],
65+
[])
5866
RPMTEST_CLEANUP
5967

6068
AT_SETUP([rpmbuild -b steps])

0 commit comments

Comments
 (0)