diff options
author | des <des@FreeBSD.org> | 2004-11-21 06:03:26 +0800 |
---|---|---|
committer | des <des@FreeBSD.org> | 2004-11-21 06:03:26 +0800 |
commit | ba3f37b07926c9565c0d2daba94ceb2b76d6f50d (patch) | |
tree | 9481ea4604d2f135fc8570b44bff867022803cce | |
parent | 81e1f1b227614df1490c8646bcc31f029f033af8 (diff) | |
download | freebsd-ports-gnome-ba3f37b07926c9565c0d2daba94ceb2b76d6f50d.tar.gz freebsd-ports-gnome-ba3f37b07926c9565c0d2daba94ceb2b76d6f50d.tar.zst freebsd-ports-gnome-ba3f37b07926c9565c0d2daba94ceb2b76d6f50d.zip |
Use the bzipped index to speed up downloading.
-rw-r--r-- | misc/porteasy/Makefile | 2 | ||||
-rw-r--r-- | misc/porteasy/src/porteasy.pl | 23 | ||||
-rw-r--r-- | ports-mgmt/porteasy/Makefile | 2 | ||||
-rw-r--r-- | ports-mgmt/porteasy/src/porteasy.pl | 23 |
4 files changed, 36 insertions, 14 deletions
diff --git a/misc/porteasy/Makefile b/misc/porteasy/Makefile index 4f86b3f3fc39..c27e404fa916 100644 --- a/misc/porteasy/Makefile +++ b/misc/porteasy/Makefile @@ -8,7 +8,7 @@ # PORTNAME= porteasy -PORTVERSION= 2.8.1 +PORTVERSION= 2.8.2 CATEGORIES= misc MASTER_SITES= # none DISTFILES= # none diff --git a/misc/porteasy/src/porteasy.pl b/misc/porteasy/src/porteasy.pl index 7a14ab9e3be8..3801b5d5cdd6 100644 --- a/misc/porteasy/src/porteasy.pl +++ b/misc/porteasy/src/porteasy.pl @@ -33,7 +33,7 @@ use strict; use Fcntl; use Getopt::Long; -my $VERSION = "2.8.1"; +my $VERSION = "2.8.2"; my $COPYRIGHT = "Copyright (c) 2000-2004 Dag-Erling Smørgrav. " . "All rights reserved."; @@ -42,6 +42,7 @@ sub ANONCVS_ROOT { ":ext:anoncvs\@anoncvs.FreeBSD.org:/home/ncvs" } sub REQ_EXPLICIT { 1 } sub REQ_IMPLICIT { 2 } +sub PATH_BZIP2 { "/usr/bin/bzip2" } sub PATH_CVS { "/usr/bin/cvs" } sub PATH_FETCH { "/usr/bin/fetch" } sub PATH_LDCONFIG { "/sbin/ldconfig" } @@ -352,11 +353,21 @@ sub update_index() { my $ifn; # Index file name - $ifn = capture(\&cmd, ("make", "-f$portsdir/Makefile", "-VINDEXFILE")); - if ($update) { - info("Retrieving $ifn"); - cmd(&PATH_FETCH, $verbose ? "-mv" : "-m", "-o$portsdir/$ifn", - "http://www.freebsd.org/ports/$ifn"); + cd($portsdir); + $ifn = capture(\&cmd, ("make", "-VINDEXFILE")); + if ($update || ! -f $ifn) { + my $izfn = "$ifn.bz2"; + info("Retrieving $izfn"); + if (!cmd(&PATH_FETCH, $verbose ? "-mv" : "-m", + "http://www.freebsd.org/ports/$izfn") || ! -f $izfn) { + bsd::errx(1, "Failed to retrieve index file"); + } + if (! -f $ifn || (stat($izfn))[9] > (stat($ifn))[9]) { + info("Decompressing $izfn"); + if (!cmd(&PATH_BZIP2, "-dfk", $izfn)) { + bsd::errx(1, "Failed to decompress index file"); + } + } } $index = "$portsdir/$ifn"; if (! -f $index) { diff --git a/ports-mgmt/porteasy/Makefile b/ports-mgmt/porteasy/Makefile index 4f86b3f3fc39..c27e404fa916 100644 --- a/ports-mgmt/porteasy/Makefile +++ b/ports-mgmt/porteasy/Makefile @@ -8,7 +8,7 @@ # PORTNAME= porteasy -PORTVERSION= 2.8.1 +PORTVERSION= 2.8.2 CATEGORIES= misc MASTER_SITES= # none DISTFILES= # none diff --git a/ports-mgmt/porteasy/src/porteasy.pl b/ports-mgmt/porteasy/src/porteasy.pl index 7a14ab9e3be8..3801b5d5cdd6 100644 --- a/ports-mgmt/porteasy/src/porteasy.pl +++ b/ports-mgmt/porteasy/src/porteasy.pl @@ -33,7 +33,7 @@ use strict; use Fcntl; use Getopt::Long; -my $VERSION = "2.8.1"; +my $VERSION = "2.8.2"; my $COPYRIGHT = "Copyright (c) 2000-2004 Dag-Erling Smørgrav. " . "All rights reserved."; @@ -42,6 +42,7 @@ sub ANONCVS_ROOT { ":ext:anoncvs\@anoncvs.FreeBSD.org:/home/ncvs" } sub REQ_EXPLICIT { 1 } sub REQ_IMPLICIT { 2 } +sub PATH_BZIP2 { "/usr/bin/bzip2" } sub PATH_CVS { "/usr/bin/cvs" } sub PATH_FETCH { "/usr/bin/fetch" } sub PATH_LDCONFIG { "/sbin/ldconfig" } @@ -352,11 +353,21 @@ sub update_index() { my $ifn; # Index file name - $ifn = capture(\&cmd, ("make", "-f$portsdir/Makefile", "-VINDEXFILE")); - if ($update) { - info("Retrieving $ifn"); - cmd(&PATH_FETCH, $verbose ? "-mv" : "-m", "-o$portsdir/$ifn", - "http://www.freebsd.org/ports/$ifn"); + cd($portsdir); + $ifn = capture(\&cmd, ("make", "-VINDEXFILE")); + if ($update || ! -f $ifn) { + my $izfn = "$ifn.bz2"; + info("Retrieving $izfn"); + if (!cmd(&PATH_FETCH, $verbose ? "-mv" : "-m", + "http://www.freebsd.org/ports/$izfn") || ! -f $izfn) { + bsd::errx(1, "Failed to retrieve index file"); + } + if (! -f $ifn || (stat($izfn))[9] > (stat($ifn))[9]) { + info("Decompressing $izfn"); + if (!cmd(&PATH_BZIP2, "-dfk", $izfn)) { + bsd::errx(1, "Failed to decompress index file"); + } + } } $index = "$portsdir/$ifn"; if (! -f $index) { |