scripts/mk: Protect files against double inclusion
[dpkg.git] / scripts / mk / pkg-info.mk
blobb65a8d1a4217262cde1f7bf83ea8d88a7db1047a
1 # This Makefile fragment (since dpkg 1.16.1) defines the following package
2 # information variables:
4 # DEB_SOURCE: source package name.
5 # DEB_VERSION: package's full version (epoch + upstream vers. + revision).
6 # DEB_VERSION_EPOCH_UPSTREAM: package's version without the Debian revision.
7 # DEB_VERSION_UPSTREAM_REVISION: package's version without the Debian epoch.
8 # DEB_VERSION_UPSTREAM: package's upstream version.
9 # DEB_DISTRIBUTION: distribution(s) listed in the current debian/changelog
10 # entry.
12 # SOURCE_DATE_EPOCH: source release date as seconds since the epoch, as
13 # specified by <https://reproducible-builds.org/specs/source-date-epoch/>
14 # (since dpkg 1.18.8).
16 ifndef dpkg_pkg_info_mk_included
17 dpkg_pkg_info_mk_included = yes
19 dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
21 DEB_SOURCE = $(call dpkg_late_eval,DEB_SOURCE,dpkg-parsechangelog -SSource)
22 DEB_VERSION = $(call dpkg_late_eval,DEB_VERSION,dpkg-parsechangelog -SVersion)
23 DEB_VERSION_EPOCH_UPSTREAM = $(call dpkg_late_eval,DEB_VERSION_EPOCH_UPSTREAM,echo '$(DEB_VERSION)' | sed -e 's/-[^-]*$$//')
24 DEB_VERSION_UPSTREAM_REVISION = $(call dpkg_late_eval,DEB_VERSION_UPSTREAM_REVISION,echo '$(DEB_VERSION)' | sed -e 's/^[0-9]*://')
25 DEB_VERSION_UPSTREAM = $(call dpkg_late_eval,DEB_VERSION_UPSTREAM,echo '$(DEB_VERSION_EPOCH_UPSTREAM)' | sed -e 's/^[0-9]*://')
26 DEB_DISTRIBUTION = $(call dpkg_late_eval,DEB_DISTRIBUTION,dpkg-parsechangelog -SDistribution)
28 SOURCE_DATE_EPOCH ?= $(call dpkg_late_eval,SOURCE_DATE_EPOCH,dpkg-parsechangelog -STimestamp)
30 export SOURCE_DATE_EPOCH
32 endif # dpkg_pkg_info_mk_included