[debhelper-devel] [debhelper] 03/03: isnative: Use Dpkg module directly instead of dpkg-parsechangelog
Niels Thykier
nthykier at moszumanska.debian.org
Sat Nov 11 11:10:35 UTC 2017
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository debhelper.
commit 6979bc9f3e915d8cec6be56a331c2714342a4c18
Author: Niels Thykier <niels at thykier.net>
Date: Sat Nov 11 10:34:55 2017 +0000
isnative: Use Dpkg module directly instead of dpkg-parsechangelog
Signed-off-by: Niels Thykier <niels at thykier.net>
---
debian/changelog | 4 ++++
lib/Debian/Debhelper/Dh_Lib.pm | 16 +++++++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index e5b2cb1..c90077b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -39,6 +39,10 @@ debhelper (10.10.6) UNRELEASED; urgency=medium
called via dh_gencontrol).
* dh_makeshlibs: Ignore non-ELF files even if they are named ".so".
(Closes: #880480)
+ * Dh_Lib: Improve the performance of isnative by using
+ Dpkg::Changelog::Parse instead of calling dpkg-parsechangelog as
+ an external process. This improves the performance of
+ dh_installchangelogs by ~10%.
[ Felipe Sateler ]
* dh_installsystemd: Fix a bug where dh_installsystemd would generate
diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm
index 04e94a6..f9dba9b 100644
--- a/lib/Debian/Debhelper/Dh_Lib.pm
+++ b/lib/Debian/Debhelper/Dh_Lib.pm
@@ -842,15 +842,25 @@ sub pkgfilename {
my $package=shift;
return $isnative_cache{$package} if defined $isnative_cache{$package};
-
+
+ if (not %isnative_cache) {
+ require Dpkg::Changelog::Parse;
+ }
+
# Make sure we look at the correct changelog.
my $isnative_changelog=pkgfile($package,"changelog");
if (! $isnative_changelog) {
$isnative_changelog="debian/changelog";
}
+ my $res = Dpkg::Changelog::Parse::changelog_parse(
+ file => $isnative_changelog,
+ compression => 0,
+ );
+ if (not defined($res)) {
+ error("No changelog entries for $package!? (changelog file: ${isnative_changelog})");
+ }
# Get the package version.
- my $version=`dpkg-parsechangelog -l$isnative_changelog -SVersion`;
- chomp($dh{VERSION} = $version);
+ $dh{VERSION} = $res->{'Version'};
# Did the changelog parse fail?
if ($dh{VERSION} eq q{}) {
error("changelog parse failure");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git
More information about the debhelper-devel
mailing list