mirror of
https://abf.rosa.ru/djam/rpm.git
synced 2025-02-23 18:33:04 +00:00
115 lines
3 KiB
Diff
115 lines
3 KiB
Diff
![]() |
--- rpm-5.4.10/build/spec.c.printspec~ 2013-01-23 01:04:32.483889763 +0100
|
||
|
+++ rpm-5.4.10/build/spec.c 2013-01-23 01:12:59.970655457 +0100
|
||
|
@@ -27,6 +27,10 @@ int _spec_debug;
|
||
|
|
||
|
/*@-redecl@*/
|
||
|
extern int specedit;
|
||
|
+
|
||
|
+/*@-redecl@*/
|
||
|
+extern int printspec;
|
||
|
+
|
||
|
/*@=redecl@*/
|
||
|
|
||
|
#define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;}
|
||
|
@@ -489,7 +493,7 @@ static inline /*@only@*/ /*@null@*/ spec
|
||
|
/*@*/
|
||
|
{
|
||
|
speclines sl = NULL;
|
||
|
- if (specedit) {
|
||
|
+ if (specedit || printspec) {
|
||
|
sl = xmalloc(sizeof(*sl));
|
||
|
sl->sl_lines = NULL;
|
||
|
sl->sl_nalloc = 0;
|
||
|
@@ -836,6 +840,34 @@ printNewSpecfile(Spec spec)
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
+ * Print parsed copy of spec file with expanded macros.
|
||
|
+ * @param spec spec file control structure
|
||
|
+ */
|
||
|
+static void
|
||
|
+printParsedSpecfile(Spec spec)
|
||
|
+ /*@globals fileSystem, internalState @*/
|
||
|
+ /*@modifies spec->sl->sl_lines[], spec->packages->header,
|
||
|
+ fileSystem, internalState @*/
|
||
|
+{
|
||
|
+ speclines sl = spec->sl;
|
||
|
+ int i;
|
||
|
+
|
||
|
+ if (sl == NULL)
|
||
|
+ return;
|
||
|
+
|
||
|
+ for (i = 0; i < sl->sl_nlines; i++) {
|
||
|
+ const char * s = sl->sl_lines[i];
|
||
|
+ const char * expandedLine;
|
||
|
+ if (s == NULL)
|
||
|
+ continue;
|
||
|
+ expandedLine = rpmMCExpand(spec->macros, s, NULL);
|
||
|
+ printf("%s", expandedLine);
|
||
|
+ _free(expandedLine);
|
||
|
+ if (strchr(s, '\n') == NULL && s[strlen(s)-1] != '\n')
|
||
|
+ printf("\n");
|
||
|
+ }
|
||
|
+}
|
||
|
+/**
|
||
|
* Add expanded build scriptlet to srpm header.
|
||
|
* @param h srpm header
|
||
|
* @param progTag interpreter tag (0 disables)
|
||
|
@@ -939,6 +971,11 @@ static int _specQuery(rpmts ts, QVA_t qv
|
||
|
goto exit;
|
||
|
}
|
||
|
|
||
|
+ if (printspec) {
|
||
|
+ printParsedSpecfile(spec);
|
||
|
+ goto exit;
|
||
|
+ }
|
||
|
+
|
||
|
switch (qva->qva_source) {
|
||
|
case RPMQV_SPECSRPM:
|
||
|
xx = initSourceHeader(spec, NULL);
|
||
|
--- rpm-5.4.10/lib/librpm.vers.printspec~ 2013-01-23 01:09:47.257299567 +0100
|
||
|
+++ rpm-5.4.10/lib/librpm.vers 2013-01-23 01:10:48.125643410 +0100
|
||
|
@@ -37,6 +37,7 @@ LIBRPM_0
|
||
|
_nosigh;
|
||
|
nplatpat;
|
||
|
platpat;
|
||
|
+ printspec;
|
||
|
_print_pkts;
|
||
|
_psm_debug;
|
||
|
_psm_threads;
|
||
|
--- rpm-5.4.10/lib/poptQV.c.printspec~ 2013-01-23 01:04:46.489658974 +0100
|
||
|
+++ rpm-5.4.10/lib/poptQV.c 2013-01-23 01:07:29.416493474 +0100
|
||
|
@@ -21,6 +21,9 @@ struct rpmQVKArguments_s rpmQVKArgs;
|
||
|
/*@unchecked@*/
|
||
|
int specedit = 0;
|
||
|
|
||
|
+/*@unchecked@*/
|
||
|
+int printspec = 0;
|
||
|
+
|
||
|
#define POPT_QUERYFORMAT -1000
|
||
|
#define POPT_WHATREQUIRES -1001
|
||
|
#define POPT_WHATPROVIDES -1002
|
||
|
@@ -363,6 +366,8 @@ struct poptOption rpmQueryPoptTable[] =
|
||
|
N_("skip %%readme files"), NULL },
|
||
|
#endif
|
||
|
|
||
|
+ { "printspec", '\0', POPT_ARG_VAL, &printspec, -1,
|
||
|
+ N_("print parsed spec file"), NULL },
|
||
|
{ "qf", '\0', POPT_ARG_STRING | POPT_ARGFLAG_DOC_HIDDEN, 0,
|
||
|
POPT_QUERYFORMAT, NULL, NULL },
|
||
|
{ "queryformat", '\0', POPT_ARG_STRING, 0, POPT_QUERYFORMAT,
|
||
|
--- rpm-5.4.10/lib/rpmcli.h.printspec~ 2013-01-23 01:04:53.165920321 +0100
|
||
|
+++ rpm-5.4.10/lib/rpmcli.h 2013-01-23 01:05:20.375518501 +0100
|
||
|
@@ -293,6 +293,11 @@ extern int specedit;
|
||
|
/** \ingroup rpmcli
|
||
|
*/
|
||
|
/*@unchecked@*/
|
||
|
+extern int printspec;
|
||
|
+
|
||
|
+/** \ingroup rpmcli
|
||
|
+ */
|
||
|
+/*@unchecked@*/
|
||
|
extern struct poptOption rpmQueryPoptTable[];
|
||
|
|
||
|
/** \ingroup rpmcli
|