On Tue, May 23, 2017 at 02:01:46PM +0300, Panu Matilainen wrote: > Hmm, I'm getting FAILED on the test: > > --- - 2017-05-23 10:52:13.874228079 +0000 > +++ /home/pmatilai/repos/rpm/tests/rpmtests.dir/at-groups/144/stdout > 2017-05-23 10:52:13.870950157 +0000 > @@ -1,2 +1,2 @@ > -/usr/local/etc/config.file > +/etc/config.file > > ...so probably because of different ./configure options to rpm itself that > are inherited by the macro. %{_bindir}, %{_sysconfdir} etc are best avoided > in the test-suite to avoid these issues.
O right of course. What about the attached which just uses /bin and /etc. The actual path used doesn't really matter for the test and this should work whatever --prefix you happen to configure with. Thanks, Mark
>From 396a52016dfde76a6d3c89b15d998a30341517b5 Mon Sep 17 00:00:00 2001 From: Mark Wielaard <m...@klomp.org> Date: Fri, 19 May 2017 23:11:39 +0200 Subject: [PATCH] rpmbuild: Reset attrFlags in generateBuildIDs. Debuginfo directories and files could be marked as configuration files if the file list ended with a config file. Patch by Panu Matilainen. Testcase by me. https://bugzilla.redhat.com/show_bug.cgi?id=1449732 Signed-off-by: Mark Wielaard <m...@klomp.org> --- build/files.c | 2 ++ tests/Makefile.am | 1 + tests/data/SPECS/hello-config-buildid.spec | 30 ++++++++++++++++++++++++++++ tests/rpmbuildid.at | 32 ++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 tests/data/SPECS/hello-config-buildid.spec diff --git a/build/files.c b/build/files.c index 791bbe2..86c601b 100644 --- a/build/files.c +++ b/build/files.c @@ -1860,6 +1860,8 @@ static int generateBuildIDs(FileList fl) Uses parseForAttr to reset ar, arFlags, and specdFlags. Note that parseForAttr pokes at the attrstr, so we cannot just pass a static string. */ + fl->cur.attrFlags = 0; + fl->def.attrFlags = 0; fl->def.verifyFlags = RPMVERIFY_ALL; fl->cur.verifyFlags = RPMVERIFY_ALL; fl->def.specdFlags |= SPECD_VERIFY; diff --git a/tests/Makefile.am b/tests/Makefile.am index a778af1..8670dcf 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -76,6 +76,7 @@ EXTRA_DIST += data/SRPMS/foo-1.0-1.src.rpm EXTRA_DIST += data/SRPMS/hello-1.0-1.src.rpm EXTRA_DIST += data/SOURCES/hello.c EXTRA_DIST += data/SPECS/hello-attr-buildid.spec +EXTRA_DIST += data/SPECS/hello-config-buildid.spec EXTRA_DIST += data/keys/rpm.org-rsa-2048-test.pub EXTRA_DIST += data/keys/rpm.org-rsa-2048-test.secret diff --git a/tests/data/SPECS/hello-config-buildid.spec b/tests/data/SPECS/hello-config-buildid.spec new file mode 100644 index 0000000..ca2d30d --- /dev/null +++ b/tests/data/SPECS/hello-config-buildid.spec @@ -0,0 +1,30 @@ +Name: test +Version: 1.0 +Release: 1 +Summary: Test + +License: Public Domain +URL: https://fedoraproject.org +Source: hello.c + +%description +%{summary}. + +%prep +%autosetup -c -D -T +cp -a %{S:0} . + +%build +gcc -g hello.c -o hello + +%install +mkdir -p %{buildroot}/bin +install -D -p -m 0755 -t %{buildroot}/bin hello +mkdir -p %{buildroot}/etc +echo "settings" > %{buildroot}/etc/config.file + +%files +%attr(644,root,root) /bin/hello +%config(noreplace) /etc/config.file + +%changelog diff --git a/tests/rpmbuildid.at b/tests/rpmbuildid.at index 88ce226..4fab3d5 100644 --- a/tests/rpmbuildid.at +++ b/tests/rpmbuildid.at @@ -1324,3 +1324,35 @@ run rpm -qp --qf "[[%{filenames} %{filemodes:perms}\n]]" \ ], [ignore]) AT_CLEANUP + +# ------------------------------ +# Check that build-id directories are created with the right attributes +# even if the spec file sets config explicitly. +AT_SETUP([rpmbuild buildid config attrs]) +AT_KEYWORDS([build] [debuginfo] [buildid]) +AT_CHECK([ +rm -rf ${TOPDIR} +AS_MKDIR_P(${TOPDIR}/SOURCES) + +# Setup sources +cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES + +# Build, contains one ELF which should have a buildid. +run rpmbuild \ + --macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \ + --rcfile=${abs_top_builddir}/rpmrc \ + --define="_build_id_links compat" \ + --define "_unique_debug_names 1" \ + --define "_unique_debug_srcs 1" \ + --quiet -ba "${abs_srcdir}"/data/SPECS/hello-config-buildid.spec + +# Should contain one config file. +run rpm -c -qp ${abs_builddir}/testing/build/RPMS/*/test-1.0-1*rpm +# Should not contain config files. +run rpm -c -qp ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1*rpm +], +[0], +[/etc/config.file +], +[ignore]) +AT_CLEANUP -- 2.9.4
_______________________________________________ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint