Debian-Apt-PM

 view release on metacpan or  search on metacpan

script/dh-make-pm  view on Meta::CPAN

#!/usr/bin/perl

=head1 NAME

dh-make-pm - build Debian packages (dh-make-perl on pbuilder+cowdancer  steroids)

=head1 SYNOPSIS

	dh-make-pm --cpan Debian::Apt::PM
	
		--cpan              which module to build
		--no-retry          will skip packaging modules that already failed to package
		--dh-make-perl=s    set different command to execute instead of dh-make-perl to create debian/ folder.
		--no-cpan-patches   do not apply CPAN::Patches
		--tilde=s           string that should apper after version~ (ex. 2.00~string)
		--debian-version	set debian version string, default is 1 (ex. 2.00-1)

=head1 DESCRIPTION

F<dh-make-pm> is basically recursive F<dh-make-perl> that will build the
deb package from CPAN distribution and all it's dependencies properly
indexing and creating repository.

=head1 USAGE

=head1 pbuilder set-up

	# execute
	sudo apt-get install cowdancer
	cowbuilder --create --distribution sid
	echo "dh-make-pm" > /var/cache/pbuilder/base.cow/etc/debian_chroot

	# add to /etc/pbuilderrc
	MIRRORSITE=http://ftp.cz.debian.org/debian/
	BINDMOUNTS="/var/cache/pbuilder/result"
	PDEBUILD_PBUILDER=cowbuilder
	
	mkdir /var/cache/pbuilder/result/unstable
	wget http://bratislava.pm.org/tutorial/debian-simple-repo/Makefile -O /var/cache/pbuilder/result/Makefile
	wget http://bratislava.pm.org/tutorial/debian-simple-repo/Release.conf -O /var/cache/pbuilder/result/Release.conf
	
	vim /var/cache/pbuilder/base.cow/etc/apt/sources.list    # update to your taste
	echo "deb file:///var/cache/pbuilder/result/ unstable/" >> /var/cache/pbuilder/base.cow/etc/apt/sources.list
	echo "deb file:///var/cache/pbuilder/result/ unstable/" >> /etc/apt/sources.list

	# generate a key without passphrase
	gpg --gen-key
	gpg --export --armor $KEYID
	apt-key add -
	chroot /var/cache/pbuilder/base.cow/
	apt-key add -
	exit

	cd /var/cache/pbuilder/result/
	make

	cowbuilder --update --bindmounts /var/cache/pbuilder/result/
	
	cpan -i Debian::Apt::PM
	
	# patch DhMakePerl.pm
	cd /usr/share/perl5/
	patch -p1 < $DIST_ROOT/patch/DhMakePerl.pm.patch

=head1 create deb files

	dh-make-pm --cpan Debian::Apt::PM
	dh-make-pm --cpan Tatsumaki

=head1 when something goes wrong

I most cases when there is a missing or wrong dependency then the .deb
build will fail.

	cd $HOME/.dh-make-pm/build/$TAR_BALL_FOLDER/
	vim debian/control
	# set correct dependencies
	pdebuild
	mv /var/cache/pbuilder/result/*-perl* /var/cache/pbuilder/result/unstable/
	cd /var/cache/pbuilder/result
	make
	dh-make-pm --cpan $THE_MODULE_YOU_WANTED_TO_BUILD

=cut


use strict;
use warnings;

our $VERSION = '0.08';

use 5.010;

use Getopt::Long;
use Pod::Usage;
use File::HomeDir;
use File::Path 2.01 'make_path', 'remove_tree';
use CPAN;
use File::Basename 'basename';
use File::Copy 'copy';
use JSON::Util;
use Module::Depends::Intrusive;
use CPAN::Patches;
use CPAN::Patches::Plugin::Debian 0.03;    # needed for `cpan-patches --update-debian`
use POSIX 'SEEK_SET';

use Debian::Apt::PM::SPc;
use Debian::Apt::PM;



( run in 0.846 second using v1.01-cache-2.11-cpan-e1769b4cff6 )