summaryrefslogtreecommitdiffstats
path: root/apkbuild-cpan.in
diff options
context:
space:
mode:
authorKiyoshi Aman <aphrael@alpinelinux.org>2011-06-28 10:51:07 -0400
committerKiyoshi Aman <aphrael@alpinelinux.org>2011-06-28 10:51:07 -0400
commitb17e7c1d02ce811ce6e072157980be24d6fc8749 (patch)
treeb126351e1d6e685a581706a8f331dd75200920c5 /apkbuild-cpan.in
parent014544bc688e5e8f66ce17b1c71243163f0d4ce7 (diff)
downloadabuild-b17e7c1d02ce811ce6e072157980be24d6fc8749.tar.bz2
abuild-b17e7c1d02ce811ce6e072157980be24d6fc8749.tar.xz
apkbuild-cpan: Added 'check' command, which prints latest & packaged versions.
Diffstat (limited to 'apkbuild-cpan.in')
-rwxr-xr-xapkbuild-cpan.in32
1 files changed, 19 insertions, 13 deletions
diff --git a/apkbuild-cpan.in b/apkbuild-cpan.in
index 96df111..d96a4b7 100755
--- a/apkbuild-cpan.in
+++ b/apkbuild-cpan.in
@@ -174,7 +174,7 @@ EOF
$build_func = <<'EOF';
build() {
cd "$_builddir"
- export CFLAGS=`perl -MConfig -E 'say $Config{ccflags}'`
+ export CFLAGS=`perl -MConfig -E 'say $Config{ccflags}'`
./Build && ./Build test
}
EOF
@@ -268,6 +268,16 @@ sub do_depends {
close $fh;
}
+sub get_data {
+ my $apkbuild = read_apkbuild;
+ my $response = $ua->get("http://search.cpan.org/api/dist/$apkbuild->{_pkgreal}");
+ $response->is_success or die $response->status_line;
+ my $distdata = $json->decode($response->decoded_content);
+ $distdata->{error} and die "Error trying to locate $apkbuild->{_pkgreal}: $distdata->{error}\n";
+
+ return ($apkbuild, $distdata);
+}
+
my $abuild_conf = read_assignments_from_file("/etc/abuild.conf");
$packager = $abuild_conf->{PACKAGER} if $abuild_conf->{PACKAGER};
@@ -296,23 +306,14 @@ given ( $ARGV[0] ) {
do_depends;
}
when ("recreate") {
- my $apkbuild = read_apkbuild;
- my $response = $ua->get("http://search.cpan.org/api/dist/$apkbuild->{_pkgreal}");
- $response->is_success or die $response->status_line;
- my $distdata = $json->decode($response->decoded_content);
- $distdata->{error} and die "Error trying to locate $apkbuild->{_pkgreal}: $distdata->{error}\n";
-
+ my ($apkbuild, $distdata) = get_data;
write_apkbuild($distdata);
prepare_tree;
update_functions;
do_depends;
}
when ("upgrade") {
- my $apkbuild = read_apkbuild;
- my $response = $ua->get("http://search.cpan.org/api/dist/$apkbuild->{_pkgreal}");
- $response->is_success or die $response->status_line;
- my $distdata = $json->decode($response->decoded_content);
- $distdata->{error} and die "Error trying to locate $apkbuild->{_pkgreal}: $distdata->{error}\n";
+ my ($apkbuild, $distdata) = get_data;
my $pkgver = $distdata->{releases}[0]->{version};
if ($pkgver != $apkbuild->{pkgver}) {
@@ -332,12 +333,17 @@ given ( $ARGV[0] ) {
say "Up-to-data with CPAN";
}
}
+ when ('check') {
+ my ($apkbuild, $distdata) = get_data;
+ my $pkgver = $distdata->{releases}[0]->{version};
+ say "Latest version: $pkgver Packaged version: $apkbuild->{pkgver}";
+ }
when ("update") {
prepare_tree;
do_depends;
}
default {
- say "Usage: apkbuild-cpan [create <Module::Name> | recreate | upgrade | update]";
+ say "Usage: apkbuild-cpan [create <Module::Name> | check | recreate | update | upgrade]";
exit;
}
}