test: Fix varbuf memory leak in t-pkg-format test
[dpkg.git] / build-aux / cpan.am
bloba9c12497e37beede49697e4e40cabc60cf423e64
1 CPAN_DIST_NAME = $(PACKAGE_CPAN_NAME)
2 CPAN_DIST_VERSION = $(PACKAGE_VERSION)
3 if !PACKAGE_DIST_IS_RELEASE
4 CPAN_DIST_SUFFIX = -TRIAL
5 endif
6 CPAN_DIST = $(CPAN_DIST_NAME)-$(CPAN_DIST_VERSION)$(CPAN_DIST_SUFFIX)
7 CPAN_DIST_ARCHIVE = $(CPAN_DIST).tar.gz
9 dist-cpan:
10         : # Create the CPAN source tree.
11         mkdir -p $(CPAN_DIST)
12         mkdir -p $(CPAN_DIST)/lib
13         mkdir -p $(CPAN_DIST)/t
14         cp -fpR $(top_srcdir)/COPYING $(CPAN_DIST)/LICENSE
15         cp -fpR $(top_srcdir)/debian/changelog $(CPAN_DIST)/Changes
16         cp -fpR $(top_srcdir)/data $(CPAN_DIST)
17         cp -fpR $(top_srcdir)/t/* \
18                  $(top_srcdir)/scripts/t/Dpkg* \
19                  $(top_srcdir)/scripts/t/origins \
20                  $(CPAN_DIST)/t
21         cp -fpR $(top_srcdir)/scripts/Dpkg.pm $(CPAN_DIST)/lib/
22         cp -fpR $(top_srcdir)/scripts/Dpkg $(CPAN_DIST)/lib/
23         cp -fpR $(top_srcdir)/scripts/Test $(CPAN_DIST)/lib/
24         cp -fpR $(top_builddir)/scripts/README.cpan $(CPAN_DIST)/README
25         cp -fpR $(top_builddir)/scripts/Build.PL $(CPAN_DIST)
27         : # Fix permissions of the distributed files.
28         find $(CPAN_DIST) \
29                -type d ! -perm 755 -exec chmod u+rwx,go+rx {} ';' -o \
30              ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
31              ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
32              ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; || \
33           chmod -R a+r $(CPAN_DIST)
35         : # Prepare the CPAN distribution.
36         cd $(CPAN_DIST) && $(PERL) Build.PL
37         cd $(CPAN_DIST) && ./Build manifest
38         cd $(CPAN_DIST) && ./Build distdir
40         : # Pack the CPAN distribution.
41         $(TAR) -caf $(CPAN_DIST_ARCHIVE) -C $(CPAN_DIST) -Hustar \
42           --sort=name --owner=root:0 --group=root:0 $(CPAN_DIST)
44         : # Cleanup the CPAN source tree.
45         find $(CPAN_DIST) -type d ! -perm -200 -exec chmod u+w {} ';'
46         rm -rf $(CPAN_DIST)
48 # Ignore the CPAN archive for distcleancheck.
49 distcleancheck_listfiles = \
50         find -type f \( -name $(CPAN_DIST_ARCHIVE) -o -print \)