Kaynağa Gözat

Provide a new makefile snippet exporting basic package information

Raphaël Hertzog 15 yıl önce
ebeveyn
işleme
9e03e21bf4
4 değiştirilmiş dosya ile 21 ekleme ve 2 silme
  1. 2 2
      debian/changelog
  2. 1 0
      scripts/mk/Makefile.am
  3. 1 0
      scripts/mk/default.mk
  4. 17 0
      scripts/mk/pkg-info.mk

+ 2 - 2
debian/changelog

@@ -81,8 +81,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Improve dpkg-source's error message complaining about the lack
     of the upstream tarball. Closes: #634510
   * Add some common makefile snippets for use in rules files in
-    /usr/share/dpkg/: default.mk, architecture.mk, buildflags.mk, vendor.mk
-    Closes: #606839
+    /usr/share/dpkg/: default.mk, architecture.mk, buildflags.mk, pkg-info.mk,
+    vendor.mk Closes: #606839
   * Fix the dpkg-divert test-suite to also skip test that would fail if run
     under root. Closes: #634961
   * Change merge conflict separators created by dpkg-mergechangelogs to match

+ 1 - 0
scripts/mk/Makefile.am

@@ -4,6 +4,7 @@ dist_pkgdata_DATA = \
 	architecture.mk \
 	buildflags.mk \
 	default.mk \
+	pkg-info.mk \
 	vendor.mk
 
 do_path_subst = $(AM_V_GEN) \

+ 1 - 0
scripts/mk/default.mk

@@ -4,4 +4,5 @@
 dpkg_datadir = .
 include $(dpkg_datadir)/architecture.mk
 include $(dpkg_datadir)/buildflags.mk
+include $(dpkg_datadir)/pkg-info.mk
 include $(dpkg_datadir)/vendor.mk

+ 17 - 0
scripts/mk/pkg-info.mk

@@ -0,0 +1,17 @@
+# Makefile snippet defining the following variables:
+#
+# DEB_SOURCE_PACKAGE: the source package name
+# DEB_VERSION: the full version of the package
+# DEB_VERSION_NOREV: the package's version without the Debian revision
+# DEB_VERSION_NOEPOCH: the package's version without the Debian epoch
+# DEB_VERSION_UPSTREAM: the package's upstream version
+# DEB_DISTRIBUTION: the first distribution of the current entry in debian/changelog
+
+dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
+
+DEB_SOURCE_PACKAGE = $(call dpkg_late_eval,DEB_SOURCE_PACKAGE,awk '/^Source: / { print $$2 }' debian/control)
+DEB_VERSION = $(call dpkg_late_eval,DEB_VERSION,dpkg-parsechangelog | awk '/^Version: / { print $$2 }')
+DEB_VERSION_NOREV = $(call dpkg_late_eval,DEB_VERSION_NOREV,echo '$(DEB_VERSION)' | sed -e 's/-[^-]*$$//')
+DEB_VERSION_NOEPOCH = $(call dpkg_late_eval,DEB_VERSION_NOEPOCH,echo '$(DEB_VERSION)' | sed -e 's/^[0-9]*://')
+DEB_VERSION_UPSTREAM = $(call dpkg_late_eval,DEB_VERSION_UPSTREAM,echo '$(DEB_VERSION_NOREV)' | sed -e 's/^[0-9]*://')
+DEB_DISTRIBUTION = $(call dpkg_late_eval,DEB_DISTRIBUTION,dpkg-parsechangelog | awk '/^Distribution: / { print $$2 }')