summaryrefslogtreecommitdiff
path: root/build/parseList.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2019-04-24 12:32:00 +0300
committerPanu Matilainen <pmatilai@redhat.com>2019-05-14 16:15:57 +0300
commit8da6654e3afb5d9d3c7b0db2f0689b0ef097f175 (patch)
tree4754e30e800ea2387a846f622b1fa17df9eebf4e /build/parseList.c
parent3c284aac631e516221a6ec3860ada1584052ecac (diff)
downloadrpm-8da6654e3afb5d9d3c7b0db2f0689b0ef097f175.tar.gz
Add support for %patchlist and %sourcelist spec sections
This introduces two new spec sections, %patchlist and %sourcelist, which can be used for adding patches and sources by just listing their names instead of all the tedious Patch[n]: etc boilerplate, you can just copy-paste file names into the list, the entries are always autonumbered, eg: Patch0: popt-1.16-pkgconfig.patch Patch1: popt-1.16-execfail.patch Patch2: popt-1.16-man-page.patch ... can now be replaced with %patchlist popt-1.16-pkgconfig.patch popt-1.16-execfail.patch popt-1.16-man-page.patch Typical packages have far fewer sources than patches, so %sourcelist is not as immediately useful but added anyway for symmetry and because its so easy. As of this commit, there can be multiple instances of both kinds of lists because there's no technical reason to limit it, new lists just add on the existing entries.
Diffstat (limited to 'build/parseList.c')
-rw-r--r--build/parseList.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/build/parseList.c b/build/parseList.c
new file mode 100644
index 000000000..c382cbc6b
--- /dev/null
+++ b/build/parseList.c
@@ -0,0 +1,32 @@
+/** \ingroup rpmbuild
+ * \file build/parseBuildInstallClean.c
+ * Parse %build/%install/%clean section from spec file.
+ */
+#include "system.h"
+
+#include <rpm/rpmlog.h>
+#include "build/rpmbuild_internal.h"
+#include "debug.h"
+
+
+int parseList(rpmSpec spec, const char *name, rpmTagVal tag)
+{
+ int res = PART_ERROR;
+ ARGV_t lst = NULL;
+
+ /* There are no options to %patchlist and %sourcelist */
+ if ((res = parseLines(spec, (STRIP_TRAILINGSPACE | STRIP_COMMENTS),
+ &lst, NULL)) == PART_ERROR) {
+ goto exit;
+ }
+
+ for (ARGV_const_t l = lst; l && *l; l++) {
+ if (rstreq(*l, ""))
+ continue;
+ addSource(spec, 0, *l, tag);
+ }
+
+exit:
+ argvFree(lst);
+ return res;
+}