summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/rpmfc.c19
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/data/SPECS/shebang.spec23
-rw-r--r--tests/rpmbuild.at36
4 files changed, 72 insertions, 7 deletions
diff --git a/build/rpmfc.c b/build/rpmfc.c
index abfee8332..77fdc72c4 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -958,10 +958,11 @@ static const struct applyDep_s applyDepTable[] = {
{ 0, 0, NULL },
};
-static void applyAttr(rpmfc fc, int aix, const char *aname,
+static int applyAttr(rpmfc fc, int aix, const char *aname,
const struct exclreg_s *excl,
const struct applyDep_s *dep)
{
+ int rc = 0;
int n, *ixs;
if (fattrHashGetEntry(fc->fahash, aix, &ixs, &n, NULL)) {
@@ -970,17 +971,21 @@ static void applyAttr(rpmfc fc, int aix, const char *aname,
mname, "_opts}}", NULL);
if (!rstreq(cmd, "")) {
char *ns = rpmfcAttrMacro(aname, "namespace", NULL);
- for (int i = 0; i < n; i++)
- rpmfcHelper(fc, ixs[i], excl, dep->type, dep->tag, ns, cmd);
+ for (int i = 0; i < n; i++) {
+ if (rpmfcHelper(fc, ixs[i], excl, dep->type, dep->tag, ns, cmd))
+ rc = 1;
+ }
free(ns);
}
free(cmd);
free(mname);
}
+ return rc;
}
static rpmRC rpmfcApplyInternal(rpmfc fc)
{
+ rpmRC rc = RPMRC_OK;
rpmds ds, * dsp;
int previx;
unsigned int val;
@@ -1001,8 +1006,10 @@ static rpmRC rpmfcApplyInternal(rpmfc fc)
if (skip & dep->type)
continue;
exclInit(dep->name, &excl);
- for (rpmfcAttr *attr = fc->atypes; attr && *attr; attr++, aix++)
- applyAttr(fc, aix, (*attr)->name, &excl, dep);
+ for (rpmfcAttr *attr = fc->atypes; attr && *attr; attr++, aix++) {
+ if (applyAttr(fc, aix, (*attr)->name, &excl, dep))
+ rc = RPMRC_FAIL;
+ }
exclFini(&excl);
}
/* No more additions after this, freeze pool to minimize memory use */
@@ -1038,7 +1045,7 @@ static rpmRC rpmfcApplyInternal(rpmfc fc)
fc->fddictn->vals[ix]++;
}
- return RPMRC_OK;
+ return rc;
}
static int initAttrs(rpmfc fc)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 38121eda1..10f095bce 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -70,6 +70,7 @@ EXTRA_DIST += data/SPECS/mini.spec
EXTRA_DIST += data/SPECS/scripts.spec
EXTRA_DIST += data/SPECS/scriptfail.spec
EXTRA_DIST += data/SPECS/selfconflict.spec
+EXTRA_DIST += data/SPECS/shebang.spec
EXTRA_DIST += data/SPECS/replacetest.spec
EXTRA_DIST += data/SPECS/triggers.spec
EXTRA_DIST += data/SPECS/filetriggers.spec
diff --git a/tests/data/SPECS/shebang.spec b/tests/data/SPECS/shebang.spec
new file mode 100644
index 000000000..fb99ed62d
--- /dev/null
+++ b/tests/data/SPECS/shebang.spec
@@ -0,0 +1,23 @@
+Name: shebang
+Version: 0.1
+Release: 1
+Summary: Testing shebang dependency generation
+Group: Testing
+License: GPL
+BuildArch: noarch
+
+%description
+%{summary}
+
+%install
+mkdir -p %{buildroot}/bin
+cat << EOF > %{buildroot}/bin/shebang
+#!/bin/blabla
+echo shebang
+EOF
+
+chmod a+x %{buildroot}/bin/shebang
+
+%files
+%defattr(-,root,root,-)
+/bin/shebang
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index eefa26428..baf556677 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -386,7 +386,7 @@ runroot rpmbuild -bb --quiet \
])
AT_CLEANUP
-AT_SETUP([Dependency generation])
+AT_SETUP([Dependency generation 1])
AT_KEYWORDS([build])
AT_CHECK([
@@ -427,6 +427,40 @@ Fileprovides:
[])
AT_CLEANUP
+AT_SETUP([Dependency generation 2])
+AT_KEYWORDS([build])
+AT_CHECK([
+
+runroot rpmbuild -bb --quiet \
+ /data/SPECS/shebang.spec
+runroot rpm -qp --requires /build/RPMS/noarch/shebang-0.1-1.noarch.rpm|grep -v ^rpmlib
+],
+[0],
+[/bin/blabla
+],
+[])
+AT_CLEANUP
+
+AT_SETUP([Dependency generation 3])
+AT_KEYWORDS([build])
+AT_CHECK([
+
+cat << EOF > "${RPMTEST}"/tmp/bad.req
+#!/bin/sh
+echo 'bad = *'
+EOF
+chmod a+x "${RPMTEST}"/tmp/bad.req
+
+runroot rpmbuild -bb --quiet \
+ --define "__script_requires /tmp/bad.req" \
+ /data/SPECS/shebang.spec
+],
+[1],
+[],
+[error: Illegal char '*' (0x2a) in: *
+ Illegal char '*' (0x2a) in: *
+])
+AT_CLEANUP
# ------------------------------
# Test spec query functionality