Skip to content

Commit

Permalink
Upgrade pkg system
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed May 20, 2014
1 parent 223b17d commit 1355d9e
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 23 deletions.
7 changes: 5 additions & 2 deletions .cpan/bin/check-release → .pkg/bin/check-release
Expand Up @@ -11,8 +11,11 @@ error() {
[ -z "$(git status -s)" ] ||
error "Uncommited git changes"

grep "^version: $VERSION" Changes &>/dev/null ||
error "No Changes entry for version '$VERSION'"
if ! (grep "^version: $VERSION" Changes &>/dev/null); then
if ! (grep "^- $VERSION" Changes &>/dev/null); then
error "No Changes entry for version '$VERSION'"
fi
fi

git tag | grep -E "^v?${VERSION//./\\.}$" &>/dev/null &&
error "Version '$VERSION' already tagged as released"
Expand Down
3 changes: 2 additions & 1 deletion .cpan/bin/make-cpan → .pkg/bin/make-cpan
Expand Up @@ -9,10 +9,11 @@ mkdir cpan
set -x
cp Changes cpan
cp -r lib cpan
[ -e bin ] && cp -r bin cpan
[ -e eg ] && cp -r eg cpan
cp -r test cpan/t
rm -fr cpan/t/devel cpan/t/misc
./.cpan/bin/make-dist-ini > cpan/dist.ini
./.pkg/bin/make-dist-ini > cpan/dist.ini
)

for kwim in $(find doc -type f -name '*.kwim'); do
Expand Down
3 changes: 1 addition & 2 deletions .cpan/bin/make-dist-ini → .pkg/bin/make-dist-ini
Expand Up @@ -5,14 +5,13 @@ use YAML::XS;
use Template::Toolkit::Simple;
use Hash::Merge 'merge';
use IO::All;
use XXX;

my $meta = Load io->file('Meta')->all;
my $cpan = delete($meta->{'=cpan'}) || {};
my $data = merge($cpan, $meta);

print tt
->path(['./.cpan'])
->path(['./.pkg'])
->data($data)
->render('dist.ini');

2 changes: 2 additions & 0 deletions .cpan/dist.ini → .pkg/dist.ini
Expand Up @@ -10,7 +10,9 @@ version = [% version %]
[% ELSE -%]
[PkgVersion]
[% END -%]
[% UNLESS no_changes_yaml -%]
[ChangesFromYaml]
[% END -%]
[ReadmeFromPod]
filename = lib/[% name %].pod

Expand Down
58 changes: 40 additions & 18 deletions Makefile
Expand Up @@ -5,21 +5,39 @@ VERSION := $(shell grep '^version: ' Meta 2>/dev/null | cut -d' ' -f2)
DISTDIR := $(NAME)-$(VERSION)
DIST := $(DISTDIR).tar.gz

default: help

help:
@echo ''
@echo 'Makefile targets:'
@echo ''
@echo ' make test - Run the repo tests'
@echo ' make install - Install the repo'
@echo ' make doc - Make the docs'
@echo ''
@echo ' make cpan - Make cpan/ dir with dist.ini'
@echo ' make dist - Make CPAN distribution tarball'
@echo ' make distdir - Make CPAN distribution directory'
@echo ' make disttest - Run the dist tests'
@echo ' make publish - Publish the dist to CPAN'
@echo ' make publish-dryrun - Don'"'"'t actually push to CPAN'
@echo ''
@echo ' make upgrade - Upgrade the build system'
@echo ' make clean - Clean up build files'
@echo ''

test:
prove -lv test

cpan:
./.cpan/bin/make-cpan

test-cpan: cpan
(cd cpan; dzil test) && rm -fr cpan
install: distdir
(cd $(DISTDIR); perl Makefile.PL; make install)
make clean

doc:
kwim --pod-cpan doc/$(NAME).kwim > ReadMe.pod

install: distdir
(cd $(DISTDIR); perl Makefile.PL; make install)
make clean
cpan:
./.pkg/bin/make-cpan

dist: clean cpan
(cd cpan; dzil build)
Expand All @@ -32,29 +50,33 @@ distdir: clean cpan
tar xzf $(DIST)
rm -fr cpan $(DIST)

release: check-release dist
disttest: cpan
(cd cpan; dzil test) && rm -fr cpan

publish: check-release dist
cpan-upload $(DIST)
git tag $(VERSION)
git push --tag
rm $(DIST)

fake-release: check-release dist
publish-dryrun: check-release dist
echo cpan-upload $(DIST)
echo git tag $(VERSION)
echo git push --tag
rm $(DIST)

check-release:
./.cpan/bin/check-release

clean purge:
rm -fr cpan .build $(DIST) $(DISTDIR)

upgrade:
(PERL5REPO=$(PWD) make -C ../perl5-pkg do-upgrade)
(PKGREPO=$(PWD) make -C ../perl5-pkg do-upgrade)

#------------------------------------------------------------------------------
check-release:
./.pkg/bin/check-release

do-upgrade:
mkdir -p $(PERL5REPO)/.cpan/bin
cp Makefile $(PERL5REPO)/Makefile
cp dist.ini $(PERL5REPO)/.cpan/
cp -r bin/* $(PERL5REPO)/.cpan/bin/
mkdir -p $(PKGREPO)/.pkg/bin
cp Makefile $(PKGREPO)/Makefile
cp dist.ini $(PKGREPO)/.pkg/
cp -r bin/* $(PKGREPO)/.pkg/bin/

0 comments on commit 1355d9e

Please sign in to comment.