Re: [Rpm-maint] [rpm-software-management/rpm] Couple fixes for debuginfo subpackages (#286)

2017-07-28 Thread Igor Gnatenko
@Conan-Kudo doesn't matter, it is referenced from one of commits.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/286#issuecomment-318807088___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Adding an LMDB backend to RPM (#281)

2017-07-28 Thread Jeff Johnson
For completeness, here is the same measurement with RPM+NDB:
```
$ /usr/bin/time ./rpm -qa --ndb > /dev/null
3.25user 0.13system 0:03.38elapsed 100%CPU (0avgtext+0avgdata 17664maxresident)k
0inputs+0outputs (0major+8164minor)pagefaults 0swaps
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/281#issuecomment-318805181___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Couple fixes for debuginfo subpackages (#286)

2017-07-28 Thread ニール・ゴンパ
@ignatenkobrain The PR looks okay to me, but put a `Fixes: #280` on the second 
line of your PR message so that when this is merged, it will close that issue 
automatically.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/286#issuecomment-318785137___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [PATCH 1/2] Test split debuginfo packages with excluded files.

2017-07-28 Thread Mark Wielaard
If split debuginfo code doesn't know about excluded files it fails:

error: Installed (but unpackaged) file(s) found:
   /usr/lib/debug/bin/hello3-1.0-1.x86_64.debug

Signed-off-by: Mark Wielaard 
---
 tests/Makefile.am  |  1 +
 tests/data/SPECS/test-subpackages-exclude.spec | 42 
 tests/rpmbuild.at  | 66 ++
 3 files changed, 109 insertions(+)
 create mode 100644 tests/data/SPECS/test-subpackages-exclude.spec

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7b69ba0..687992f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -65,6 +65,7 @@ EXTRA_DIST += data/SPECS/prefixtest.spec
 EXTRA_DIST += data/SPECS/testdoc.spec
 EXTRA_DIST += data/SPECS/sigpipe.spec
 EXTRA_DIST += data/SPECS/test-subpackages.spec
+EXTRA_DIST += data/SPECS/test-subpackages-exclude.spec
 EXTRA_DIST += data/SOURCES/hello-1.0-modernize.patch
 EXTRA_DIST += data/SOURCES/hello-1.0.tar.gz
 EXTRA_DIST += data/SOURCES/hello-2.0.tar.gz
diff --git a/tests/data/SPECS/test-subpackages-exclude.spec 
b/tests/data/SPECS/test-subpackages-exclude.spec
new file mode 100644
index 000..e93b10b
--- /dev/null
+++ b/tests/data/SPECS/test-subpackages-exclude.spec
@@ -0,0 +1,42 @@
+Name:   test
+Version:1.0
+Release:1
+Summary:Test
+
+License:Public Domain
+URL:https://fedoraproject.org
+Source: hello.c
+
+%description
+%{summary}.
+
+%package test2
+Summary: Test2.
+%description test2
+
+%prep
+%autosetup -c -D -T
+cp -a %{S:0} .
+
+%build
+gcc -g hello.c -o hello
+cp hello.c hello2.c
+gcc -g hello2.c -o hello2
+cp hello.c hello3.c
+gcc -g hello3.c -o hello3
+
+%install
+mkdir -p %{buildroot}/bin
+install -D -p -m 0755 -t %{buildroot}/bin hello
+install -D -p -m 0755 -t %{buildroot}/bin hello2
+# Install it, but then exclude it...
+install -D -p -m 0755 -t %{buildroot}/bin hello3
+
+%files
+/bin/hello
+
+%files test2
+/bin/hello2
+%exclude /bin/hello3
+
+%changelog
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index e2008da..cbe653d 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -1166,3 +1166,69 @@ hello3 debug exists
 ],
 [ignore])
 AT_CLEANUP
+
+# --
+# Check that defining _debuginfo_subpackages works with excluded files.
+AT_SETUP([rpmbuild debuginfo subpackages multiple excluded])
+AT_KEYWORDS([build] [debuginfo] [debugsubpackage] [debugsource])
+AT_CHECK([
+rm -rf ${TOPDIR}
+AS_MKDIR_P(${TOPDIR}/SOURCES)
+
+# Setup sources
+cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
+
+run rpmbuild --quiet \
+  
--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 "_unique_debug_names 1" \
+  --define "_unique_debug_srcs 1" \
+  --define "_debugsource_packages 1" \
+  --define "_debuginfo_subpackages 1" \
+  -ba "${abs_srcdir}"/data/SPECS/test-subpackages-exclude.spec
+
+# Check that there are 2 debuginfo packages.
+ls ${abs_builddir}/testing/build/RPMS/*/*debuginfo*rpm | wc --lines
+
+# First contains hello.debug
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-1.0-1.*.rpm \
+  | cpio -diu --quiet
+# Extract the debug name from the exe (.gnu_debuglink section, first string)
+debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
+
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1.*.rpm \
+  | cpio -diu --quiet
+if test -f ./usr/lib/debug/bin/$debug_name; then
+  echo "hello debug exists"
+else
+  echo "No hello: $debug_name"
+fi
+
+# Second contains hello2.debug but NOT hello3.debug
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-1.0-1.*.rpm \
+  | cpio -diu --quiet
+# Extract the debug name from the exe (.gnu_debuglink section, first string)
+debug_name=$(readelf -p .gnu_debuglink ./bin/hello2 | grep hello | cut -c13-)
+
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-debuginfo-1.0-1.*.rpm 
\
+  | cpio -diu --quiet
+if test -f ./usr/lib/debug/bin/$debug_name; then
+  echo "hello2 debug exists"
+else
+  echo "No hello2: $debug_name"
+fi
+
+if test -f ./usr/lib/debug/bin/hello3*; then
+  echo "hello3 debug exists"
+else
+  echo "No hello3 debug"
+fi
+],
+[0],
+[2
+hello debug exists
+hello2 debug exists
+No hello3 debug
+],
+[ignore])
+AT_CLEANUP
-- 
1.8.3.1

___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [PATCH 2/2] Test split debuginfo packages with RemovePathPostfixes.

2017-07-28 Thread Mark Wielaard
If split debuginfo code doesn't know about RemovePathPostfixes it fails:

error: Installed (but unpackaged) file(s) found:
   /usr/lib/debug/bin/hello.foobar-1.0-1.x86_64.debug

Signed-off-by: Mark Wielaard 
---
 tests/Makefile.am  |  1 +
 .../data/SPECS/test-subpackages-pathpostfixes.spec | 39 
 tests/rpmbuild.at  | 71 ++
 3 files changed, 111 insertions(+)
 create mode 100644 tests/data/SPECS/test-subpackages-pathpostfixes.spec

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 687992f..03cdea9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -66,6 +66,7 @@ EXTRA_DIST += data/SPECS/testdoc.spec
 EXTRA_DIST += data/SPECS/sigpipe.spec
 EXTRA_DIST += data/SPECS/test-subpackages.spec
 EXTRA_DIST += data/SPECS/test-subpackages-exclude.spec
+EXTRA_DIST += data/SPECS/test-subpackages-pathpostfixes.spec
 EXTRA_DIST += data/SOURCES/hello-1.0-modernize.patch
 EXTRA_DIST += data/SOURCES/hello-1.0.tar.gz
 EXTRA_DIST += data/SOURCES/hello-2.0.tar.gz
diff --git a/tests/data/SPECS/test-subpackages-pathpostfixes.spec 
b/tests/data/SPECS/test-subpackages-pathpostfixes.spec
new file mode 100644
index 000..19b3b9e
--- /dev/null
+++ b/tests/data/SPECS/test-subpackages-pathpostfixes.spec
@@ -0,0 +1,39 @@
+Name:   test
+Version:1.0
+Release:1
+Summary:Test
+
+License:Public Domain
+URL:https://fedoraproject.org
+Source: hello.c
+
+%description
+%{summary}.
+
+%package test2
+RemovePathPostfixes: .foobar
+Summary: Test2.
+%description test2
+
+%prep
+%autosetup -c -D -T
+cp -a %{S:0} .
+
+%build
+gcc -g hello.c -o hello
+cp hello.c hello2.c
+gcc -g hello2.c -o hello.foobar
+
+%install
+mkdir -p %{buildroot}/bin
+install -D -p -m 0755 -t %{buildroot}/bin hello
+# Install as hello.foobar, but we want the postfix removed in the package...
+install -D -p -m 0755 -t %{buildroot}/bin hello.foobar
+
+%files
+/bin/hello
+
+%files test2
+/bin/hello.foobar
+
+%changelog
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index cbe653d..7864477 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -1232,3 +1232,74 @@ No hello3 debug
 ],
 [ignore])
 AT_CLEANUP
+
+# --
+# Check that defining _debuginfo_subpackages works with RemovePathPostfixes.
+AT_SETUP([rpmbuild debuginfo subpackages multiple excluded])
+AT_KEYWORDS([build] [debuginfo] [debugsubpackage] [debugsource])
+AT_CHECK([
+rm -rf ${TOPDIR}
+AS_MKDIR_P(${TOPDIR}/SOURCES)
+
+# Setup sources
+cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
+
+run rpmbuild --quiet \
+  
--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 "_unique_debug_names 1" \
+  --define "_unique_debug_srcs 1" \
+  --define "_debugsource_packages 1" \
+  --define "_debuginfo_subpackages 1" \
+  -ba "${abs_srcdir}"/data/SPECS/test-subpackages-pathpostfixes.spec
+
+# Check that there are 2 debuginfo packages.
+ls ${abs_builddir}/testing/build/RPMS/*/*debuginfo*rpm | wc --lines
+
+# First contains hello.debug
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-1.0-1.*.rpm \
+  | cpio -diu --quiet
+# Extract the debug name from the exe (.gnu_debuglink section, first string)
+debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
+
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1.*.rpm \
+  | cpio -diu --quiet
+if test -f ./usr/lib/debug/bin/$debug_name; then
+  echo "hello debug exists"
+else
+  echo "No hello: $debug_name"
+fi
+
+# remove it, we are going to check the other debuginfo package.
+rm ./bin/hello
+rm ./usr/lib/debug/bin/$debug_name
+orig_debugname=$debugname
+
+# Second contains hello.foobar.debug but NOT hello.debug
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-1.0-1.*.rpm \
+  | cpio -diu --quiet
+# Extract the debug name from the exe (.gnu_debuglink section, first string)
+debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
+
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-debuginfo-1.0-1.*.rpm 
\
+  | cpio -diu --quiet
+if test -f ./usr/lib/debug/bin/$debug_name; then
+  echo "hello.foobar debug exists"
+else
+  echo "No hello2: $debug_name"
+fi
+
+if test -f ./usr/lib/debug/bin/$orig_debugname; then
+  echo "$orig_debugname exists"
+else
+  echo "No hello.debug"
+fi
+],
+[0],
+[2
+hello debug exists
+hello.foobar debug exists
+No hello.debug
+],
+[ignore])
+AT_CLEANUP
-- 
1.8.3.1

___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Adding an LMDB backend to RPM (#281)

2017-07-28 Thread Jeff Johnson
One last comparison: RPM5 uses BerkeleyDB too, but with different tunables than 
RPM4.

Here's essentially the same measurement as the previous comment:
```
1.15user 0.87system 0:02.11elapsed 96%CPU (0avgtext+0avgdata 584900maxresident)k
240inputs+390776outputs (7major+355303minor)pagefaults 0swaps
```

I add this comment to squelch BerkeleyDB haters from taking my measurements and 
claiming

```"LMDB is Newer! Better! Faster! than BDB."```

I suspect the tunable that makes a huge difference is mmapsize (RPM5 sets this 
to 256Mb).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/281#issuecomment-318755057___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [PATCH] Add rpmbuild debuginfo subpackages tests.

2017-07-28 Thread Dmitry V. Levin
On Fri, Jul 28, 2017 at 09:55:24PM +0200, Mark Wielaard wrote:
> This adds various tests for making sure multiple subpackages are build
> correctly. Without debuginfo subpackages, with subpackages, subpackages
> with unique debug file and source dir paths and with separate debugsources.
[...]
> +# Check that there are is just one debuginfo packages.

I'm not really reviewing this, but when reading this comment,
I'm not quite sure how many packages are expected. ;)


-- 
ldv


signature.asc
Description: PGP signature
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Adding an LMDB backend to RPM (#281)

2017-07-28 Thread Jeff Johnson
In order to run queries as non-root, there are three minor changes:

1) lock.mdb (an 8Kb file) needs to be 0666, other perms as expected.

2) don't bother retrying mdb_env_open(): I added this line to display errors as 
well:
```
rpmlog(RPMLOG_ERR, "lmdb: %s(%s/lock.mdb): %s\n", __FUNCTION__, dbhome, 
mdb_strerror(rc));
```

3) this 1-liner needs to be added in mdb_dbi_open() to create a RDONLY txn:
```
unsigned tflags = access(dbhome, W_OK) ? MDB_RDONLY : 0;
```

With those changes (and an /etc/popt alias to hide the goopy cmdline)
```
rpm alias   --lmdb -D '_db_backend lmdb' --dbpath=/var/lib/lmdb
```

I see the following timings on whatever I happen to have installed on CentOS7:

```
$ /usr/bin/time ./rpm -qa > /dev/null
3.25user 0.13system 0:03.38elapsed 100%CPU (0avgtext+0avgdata 22820maxresident)k
0inputs+0outputs (0major+9477minor)pagefuls 0swaps

$ /usr/bin/time ./rpm --lmdb -qa > /dev/null
2.19user 0.07system 0:02.26elapsed 100%CPU (0avgtext+0avgdata 
166940maxresident)k
0inputs+8outputs (0major+47059minor)pagefuls 0swaps

```

Much simpler (and more reliable) than what BDB does to read as non-root.

However, I expect that something similar could be done with BDB and permissions 
on the environment if anyone really cared.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/281#issuecomment-318749846___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [PATCH] Add rpmbuild debuginfo subpackages tests.

2017-07-28 Thread Mark Wielaard
This adds various tests for making sure multiple subpackages are build
correctly. Without debuginfo subpackages, with subpackages, subpackages
with unique debug file and source dir paths and with separate debugsources.

Signed-off-by: Mark Wielaard 
---
 tests/Makefile.am  |   1 +
 tests/data/SPECS/test-subpackages.spec |  47 ++
 tests/rpmbuild.at  | 266 +
 3 files changed, 314 insertions(+)
 create mode 100644 tests/data/SPECS/test-subpackages.spec

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 09239ba..7b69ba0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -64,6 +64,7 @@ EXTRA_DIST += data/SPECS/filetriggers.spec
 EXTRA_DIST += data/SPECS/prefixtest.spec
 EXTRA_DIST += data/SPECS/testdoc.spec
 EXTRA_DIST += data/SPECS/sigpipe.spec
+EXTRA_DIST += data/SPECS/test-subpackages.spec
 EXTRA_DIST += data/SOURCES/hello-1.0-modernize.patch
 EXTRA_DIST += data/SOURCES/hello-1.0.tar.gz
 EXTRA_DIST += data/SOURCES/hello-2.0.tar.gz
diff --git a/tests/data/SPECS/test-subpackages.spec 
b/tests/data/SPECS/test-subpackages.spec
new file mode 100644
index 000..8306600
--- /dev/null
+++ b/tests/data/SPECS/test-subpackages.spec
@@ -0,0 +1,47 @@
+Name:   test
+Version:1.0
+Release:1
+Summary:Test
+
+License:Public Domain
+URL:https://fedoraproject.org
+Source: hello.c
+
+%description
+%{summary}.
+
+%package test2
+Summary: Test2.
+%description test2
+
+%package test3
+Summary: Test3.
+%description test3
+
+%prep
+%autosetup -c -D -T
+cp -a %{S:0} .
+
+%build
+gcc -g hello.c -o hello
+cp hello.c hello2.c
+gcc -g hello2.c -o hello2
+cp hello.c hello3.c
+gcc -g hello3.c -o hello3
+
+%install
+mkdir -p %{buildroot}/bin
+install -D -p -m 0755 -t %{buildroot}/bin hello
+install -D -p -m 0755 -t %{buildroot}/bin hello2
+install -D -p -m 0755 -t %{buildroot}/bin hello3
+
+%files
+/bin/hello
+
+%files test2
+/bin/hello2
+
+%files test3
+/bin/hello3
+
+%changelog
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index 3f41652..e2008da 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -900,3 +900,269 @@ ls ./usr/src/debug/test-1.0*/
 ],
 [ignore])
 AT_CLEANUP
+
+# --
+# Check that undefining _debuginfo_subpackages creates one single -debuginfo.
+AT_SETUP([rpmbuild debuginfo subpackages single])
+AT_KEYWORDS([build] [debuginfo] [debugsubpackage])
+AT_CHECK([
+rm -rf ${TOPDIR}
+AS_MKDIR_P(${TOPDIR}/SOURCES)
+
+# Setup sources
+cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
+
+run rpmbuild --quiet \
+  
--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 \
+  --undefine "_unique_debug_names" \
+  --undefine "_unique_debug_srcs" \
+  --undefine "_debugsource_packages" \
+  --undefine "_debuginfo_subpackages" \
+  -ba "${abs_srcdir}"/data/SPECS/test-subpackages.spec
+
+# Check that there are is just one debuginfo packages.
+ls ${abs_builddir}/testing/build/RPMS/*/*debuginfo*rpm | wc --lines
+
+# Which contains hello.debug
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-1.0-1.*.rpm \
+  | cpio -diu --quiet
+# Extract the debug name from the exe (.gnu_debuglink section, first string)
+debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
+
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1.*.rpm \
+  | cpio -diu --quiet
+if test -f ./usr/lib/debug/bin/$debug_name; then
+  echo "hello debug exists"
+else
+  echo "No hello: $debug_name"
+fi
+],
+[0],
+[1
+hello debug exists
+],
+[ignore])
+AT_CLEANUP
+
+# --
+# Check that defining _debuginfo_subpackages creates multiple -debuginfos.
+AT_SETUP([rpmbuild debuginfo subpackages multiple])
+AT_KEYWORDS([build] [debuginfo] [debugsubpackage])
+AT_CHECK([
+rm -rf ${TOPDIR}
+AS_MKDIR_P(${TOPDIR}/SOURCES)
+
+# Setup sources
+cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
+
+run rpmbuild --quiet \
+  
--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 \
+  --undefine "_unique_debug_names" \
+  --undefine "_unique_debug_srcs" \
+  --undefine "_debugsource_packages" \
+  --define "_debuginfo_subpackages 1" \
+  -ba "${abs_srcdir}"/data/SPECS/test-subpackages.spec
+
+# Check that there are 3 debuginfo packages.
+ls ${abs_builddir}/testing/build/RPMS/*/*debuginfo*rpm | wc --lines
+
+# First contains hello.debug
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-1.0-1.*.rpm \
+  | cpio -diu --quiet
+# Extract the debug name from the exe (.gnu_debuglink section, first string)
+debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
+
+rpm2cpio 

Re: [Rpm-maint] [rpm-software-management/rpm] exclude respective debug files for files which are excluded (#286)

2017-07-28 Thread Igor Gnatenko
@ignatenkobrain pushed 3 commits.

e56ebda  fixup! exclude respective debug files for files which are excluded
3b6043d  store mapping for renamed files
7299900  reference proper debug files whenever RemovePathPostfixes is used


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/286/files/03089484495100c8f7bca35db791fc1e9eb5ea95..7299900452de82168c7c068ce58cfd5ab87bae28
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [PATCH] Add two testcases for generating debugsource packages.

2017-07-28 Thread Florian Festi
Thanks! Pushed.

Florian

On 07/28/2017 02:11 PM, Mark Wielaard wrote:
> These tests define _debugsource_packages and check a debugsource package
> is created that contains the source of the program created.
> 
> Without the fix to make sure that debugsourcefiles.list is generated in
> the build dir the second testcase will fail with:
> error: Could not open %files file
> 
> Signed-off-by: Mark Wielaard 
> ---
>  tests/Makefile.am  |  1 +
>  tests/data/SPECS/hello-cd.spec | 29 
>  tests/rpmbuild.at  | 62 
> ++
>  3 files changed, 92 insertions(+)
>  create mode 100644 tests/data/SPECS/hello-cd.spec
> 
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index b962e4a..09239ba 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -78,6 +78,7 @@ 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/SPECS/hello-cd.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-cd.spec b/tests/data/SPECS/hello-cd.spec
> new file mode 100644
> index 000..ab1e300
> --- /dev/null
> +++ b/tests/data/SPECS/hello-cd.spec
> @@ -0,0 +1,29 @@
> +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
> +# Pretend we need to do something in /tmp
> +cd /tmp
> +
> +%files
> +%attr(644,root,root) /bin/hello
> +
> +%changelog
> diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
> index 3200fb2..3f41652 100644
> --- a/tests/rpmbuild.at
> +++ b/tests/rpmbuild.at
> @@ -838,3 +838,65 @@ hello-1.0
>  ],
>  [ignore])
>  AT_CLEANUP
> +
> +# --
> +# Check that defining _debugsource_packages creates -debugsource package
> +AT_SETUP([rpmbuild debugsource])
> +AT_KEYWORDS([build] [debuginfo] [debugsource])
> +AT_CHECK([
> +rm -rf ${TOPDIR}
> +AS_MKDIR_P(${TOPDIR}/SOURCES)
> +
> +# Build a package that has some debuginfo
> +cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz 
> "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
> +
> +run rpmbuild --quiet \
> +  
> --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 "_debugsource_packages 1" \
> +  -ba "${abs_srcdir}"/data/SPECS/hello2.spec
> +
> +# Unpack the debuginfo rpms so we can check the sources are there.
> +rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-debugsource-1.0-1.*.rpm 
> \
> +  | cpio -diu --quiet
> +
> +# Check that hello.c is there.
> +ls ./usr/src/debug/hello2-1.0*/
> +],
> +[0],
> +[hello.c
> +],
> +[ignore])
> +AT_CLEANUP
> +
> +# --
> +# Check that defining _debugsource_packages creates -debugsource package
> +# even if %install changes the working directory (debugsourcefiles.list
> +# should be in expected build dir).
> +AT_SETUP([rpmbuild debugsource debugsourcefiles.list path])
> +AT_KEYWORDS([build] [debuginfo] [debugsource])
> +AT_CHECK([
> +rm -rf ${TOPDIR}
> +AS_MKDIR_P(${TOPDIR}/SOURCES)
> +
> +# Setup sources
> +cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
> +
> +run rpmbuild --quiet \
> +  
> --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 "_debugsource_packages 1" \
> +  -ba "${abs_srcdir}"/data/SPECS/hello-cd.spec
> +
> +# Unpack the debuginfo rpms so we can check the sources are there.
> +rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-debugsource-1.0-1.*.rpm \
> +  | cpio -diu --quiet
> +
> +# Check that hello.c is there.
> +ls ./usr/src/debug/test-1.0*/
> +],
> +[0],
> +[hello.c
> +],
> +[ignore])
> +AT_CLEANUP
> 


-- 

Red Hat GmbH, http://www.de.redhat.com/, Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Paul Argiry, Charles Cachera, Michael Cunningham,
Michael O'Neill
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [PATCH] Warn and create empty debugsource package if there are no sources.

2017-07-28 Thread Mark Wielaard
Signed-off-by: Mark Wielaard 
---
 scripts/find-debuginfo.sh | 13 +
 tests/rpmbuild.at | 33 +
 2 files changed, 46 insertions(+)

diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
index d8725ad..9b3815a 100755
--- a/scripts/find-debuginfo.sh
+++ b/scripts/find-debuginfo.sh
@@ -573,6 +573,19 @@ if [ -n "$srcout" ]; then
  find src/debug -mindepth 1 -maxdepth 1
 ) | sed 's,^,/usr/,' >> "$srcout"
   fi
+  if [ ! -s "$srcout" ]; then
+echo >&2 "*** WARNING: No source files found.  Creating empty debugsource 
package"
+# Create the empty directory.
+# See also debugedit invocation. Directories must match up.
+debug_base_name="$RPM_BUILD_DIR"
+debug_dest_name="/usr/src/debug"
+if [ ! -z "$unique_debug_src_base" ]; then
+  debug_base_name="$BUILDDIR"
+  debug_dest_name="/usr/src/debug/${unique_debug_src_base}"
+fi
+mkdir -p "${RPM_BUILD_ROOT}${debug_dest_name}"
+echo "$debug_dest_name" > "$srcout"
+  fi
 fi
 
 # Append to $1 only the lines from stdin not already in the file.
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index 3f41652..2359c63 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -900,3 +900,36 @@ ls ./usr/src/debug/test-1.0*/
 ],
 [ignore])
 AT_CLEANUP
+
+# --
+# Check that defining _debugsource_packages creates -debugsource package
+# doesn't break when there are no source files (found).
+AT_SETUP([rpmbuild debugsource no source files])
+AT_KEYWORDS([build] [debuginfo] [debugsource])
+AT_CHECK([
+rm -rf ${TOPDIR}
+AS_MKDIR_P(${TOPDIR}/SOURCES)
+
+# Setup sources
+cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz 
"${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
+
+# Build a package that doesn't use -g.
+run rpmbuild --quiet \
+  
--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 "_debugsource_packages 1" \
+  -ba "${abs_srcdir}"/data/SPECS/hello.spec
+
+# Unpack the debugsource rpm so we can check the sources are (not) there.
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-debugsource-1.0-1.*.rpm \
+  | cpio -diu --quiet
+
+# There should be just one empty directory (strip off nvra).
+find ./usr/src/debug/* | cut -f1 -d-
+
+],
+[0],
+[./usr/src/debug/hello
+],
+[ignore])
+AT_CLEANUP
-- 
1.8.3.1

___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] exclude respective debug files for files which are excluded (#286)

2017-07-28 Thread Igor Gnatenko

You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/286

-- Commit Summary --

  * remove duplicated call to strlen()
  * store path of excluded files
  * exclude respective debug files for files which are excluded

-- File Changes --

M build/files.c (26)
M build/rpmbuild_internal.h (1)
M build/spec.c (2)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/286.patch
https://github.com/rpm-software-management/rpm/pull/286.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/286
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [PATCH] Add two testcases for generating debugsource packages.

2017-07-28 Thread Mark Wielaard
These tests define _debugsource_packages and check a debugsource package
is created that contains the source of the program created.

Without the fix to make sure that debugsourcefiles.list is generated in
the build dir the second testcase will fail with:
error: Could not open %files file

Signed-off-by: Mark Wielaard 
---
 tests/Makefile.am  |  1 +
 tests/data/SPECS/hello-cd.spec | 29 
 tests/rpmbuild.at  | 62 ++
 3 files changed, 92 insertions(+)
 create mode 100644 tests/data/SPECS/hello-cd.spec

diff --git a/tests/Makefile.am b/tests/Makefile.am
index b962e4a..09239ba 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -78,6 +78,7 @@ 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/SPECS/hello-cd.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-cd.spec b/tests/data/SPECS/hello-cd.spec
new file mode 100644
index 000..ab1e300
--- /dev/null
+++ b/tests/data/SPECS/hello-cd.spec
@@ -0,0 +1,29 @@
+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
+# Pretend we need to do something in /tmp
+cd /tmp
+
+%files
+%attr(644,root,root) /bin/hello
+
+%changelog
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index 3200fb2..3f41652 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -838,3 +838,65 @@ hello-1.0
 ],
 [ignore])
 AT_CLEANUP
+
+# --
+# Check that defining _debugsource_packages creates -debugsource package
+AT_SETUP([rpmbuild debugsource])
+AT_KEYWORDS([build] [debuginfo] [debugsource])
+AT_CHECK([
+rm -rf ${TOPDIR}
+AS_MKDIR_P(${TOPDIR}/SOURCES)
+
+# Build a package that has some debuginfo
+cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz 
"${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
+
+run rpmbuild --quiet \
+  
--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 "_debugsource_packages 1" \
+  -ba "${abs_srcdir}"/data/SPECS/hello2.spec
+
+# Unpack the debuginfo rpms so we can check the sources are there.
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-debugsource-1.0-1.*.rpm \
+  | cpio -diu --quiet
+
+# Check that hello.c is there.
+ls ./usr/src/debug/hello2-1.0*/
+],
+[0],
+[hello.c
+],
+[ignore])
+AT_CLEANUP
+
+# --
+# Check that defining _debugsource_packages creates -debugsource package
+# even if %install changes the working directory (debugsourcefiles.list
+# should be in expected build dir).
+AT_SETUP([rpmbuild debugsource debugsourcefiles.list path])
+AT_KEYWORDS([build] [debuginfo] [debugsource])
+AT_CHECK([
+rm -rf ${TOPDIR}
+AS_MKDIR_P(${TOPDIR}/SOURCES)
+
+# Setup sources
+cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
+
+run rpmbuild --quiet \
+  
--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 "_debugsource_packages 1" \
+  -ba "${abs_srcdir}"/data/SPECS/hello-cd.spec
+
+# Unpack the debuginfo rpms so we can check the sources are there.
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-debugsource-1.0-1.*.rpm \
+  | cpio -diu --quiet
+
+# Check that hello.c is there.
+ls ./usr/src/debug/test-1.0*/
+],
+[0],
+[hello.c
+],
+[ignore])
+AT_CLEANUP
-- 
1.8.3.1

___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] find-debuginfo.sh: make sure that debugsourcefiles.list is generated … (#285)

2017-07-28 Thread Florian Festi
Merged #285.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/285#event-1183251098___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] _debugsource_packages sometimes crashes due to non-existing debugsourcefiles.list (#279)

2017-07-28 Thread Florian Festi
Closed #279 via #285.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/279#event-1183251099___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] find-debuginfo.sh: make sure that debugsourcefiles.list is generated … (#285)

2017-07-28 Thread Igor Gnatenko
…under the builddir

The %_debugsource_template expects the debugsourcefiles.list file
to be in the (current) build dir. Make sure that is always the case
even if find-debuginfo.sh was invoked in a different (sub) directory
by prepending $BUILDDIR to the output file as written in description
"All file names in switches are relative to builddir (. if not given).".

Closes: https://github.com/rpm-software-management/rpm/issues/279
Based-on-patch-by: Mark Wielaard 
Signed-off-by: Igor Gnatenko 
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/285

-- Commit Summary --

  * find-debuginfo.sh: make sure that debugsourcefiles.list is generated under 
the builddir

-- File Changes --

M scripts/find-debuginfo.sh (1)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/285.patch
https://github.com/rpm-software-management/rpm/pull/285.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/285
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint