[Pkg-octave-commit] r1311 - octave-pkg-dev/trunk

Rafael Laboissiere rafael at alioth.debian.org
Thu Feb 28 22:44:46 UTC 2008


Author: rafael
Date: 2008-02-28 22:44:46 +0000 (Thu, 28 Feb 2008)
New Revision: 1311

Modified:
   octave-pkg-dev/trunk/get-oct-pkg-src.pl
Log:
Add comments

Modified: octave-pkg-dev/trunk/get-oct-pkg-src.pl
===================================================================
--- octave-pkg-dev/trunk/get-oct-pkg-src.pl	2008-02-28 22:18:12 UTC (rev 1310)
+++ octave-pkg-dev/trunk/get-oct-pkg-src.pl	2008-02-28 22:44:46 UTC (rev 1311)
@@ -19,14 +19,17 @@
 # with this program; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
+### Extract the name of the script by stripping the path
 (my $prog = $0) =~ s:.*/::;
 
+### Open Debian control and changelog files
 open (CONTROL, "< ./debian/control")
   or die "$prog:E: File ./debian/control not found\n";
 
 open (CHGLOG, "< debian/changelog")
   or die "$prog:E: File ./debian/changelog not found\n";
 
+### Extract te package name from debian/control
 my $pkgname = "";
 while (<CONTROL>) {
     if (/^Package: (.*)/) {
@@ -35,37 +38,46 @@
     }
 }
 
+
 $pkgname ne ""
   or die "$prog:E: Cannot find package name in debian/control\n";
 
+### URL for package index and pacakge download
 my $pkgurl = "http://octave.sourceforge.net/packages.html";
 my $urlbase = "http://downloads.sourceforge.net/octave";
 
+### Get the package index
 open (PAGE, "curl --silent $pkgurl |");
 
+### Store URL of pacakges in a list
 my @PKGS = ();
 while (<PAGE>) {
     push (@PKGS, m{href="($urlbase/.*\.tar\.gz\?download)"}g)
 }
 
+### Extract the URL for the current package
 my $download = (grep {/$pkgname/} @PKGS) [0];
 
 $download ne ""
   or die "$prog:E: Tarball for $pkgname not found at SF site\n";
 
+### Extract the name of the tarball from the URL...
 (my $tarball = $download) =~ s/.*($pkgname-([\d.]+)\.tar\.gz).*/$1/;
+### ... as well as the version number
 my $version = $2;
 
+### Check whether the tarball is already download
 if (-f $tarball) {
     print "$prog:W: Tarball $tarball already downloaded\n";
 } else {
+    ## Tarball needs to be downloaded
     system (qq {curl --location --silent --output $tarball "$download"}) == 0
       or die "$prog:E: Cannot download $tarball from SF site\n";
     print "$prog:I: Downloaded $tarball\n";
 }
 
+### Read the most recent version in debain/changelog
 my $debver;
-
 while (<CHGLOG>) {
     if (/\((.*)\)/) {
         $debver = $1;
@@ -73,8 +85,9 @@
     }
 }
 
+### Warn the user whether the dowloaded version is diferent from that
+### in debian/changelog
 system ("dpkg --compare-versions $version lt $debver") == 0
   or print "$prog:W: Version in debian/changelog is lower than upstream\n";
-
 system ("dpkg --compare-versions $version gt $debver") == 0
   or print "$prog:W: Version in debian/changelog is higher than upstream\n";




More information about the Pkg-octave-commit mailing list