Author: bdubbs
Date: Thu Jan 21 15:37:27 2021
New Revision: 24126

Log:
Currency fixes for shared-mime-info, upower, and glib-networking.
Created helper function when latest directory has no released tarball.

Modified:
   trunk/scripts/blfs-chapter11.php
   trunk/scripts/blfs-chapter12.php
   trunk/scripts/blfs-chapter17.php
   trunk/scripts/blfs-include.php

Modified: trunk/scripts/blfs-chapter11.php
==============================================================================
--- trunk/scripts/blfs-chapter11.php    Thu Jan 21 12:32:45 2021        (r24125)
+++ trunk/scripts/blfs-chapter11.php    Thu Jan 21 15:37:27 2021        (r24126)
@@ -66,7 +66,7 @@
 
    array( 'pkg'     => 'shared-mime-info',
           'match'   => '^.*$', 
-          'replace' => 
"https://gitlab.freedesktop.org/xdg/shared-mime-info/tags"; ),
+          'replace' => 
"https://github.com/freedesktop/xdg-shared-mime-info/releases"; ),
 
    array( 'pkg'     => 'tidy-html5',
           'match'   => '^.*$', 
@@ -203,7 +203,7 @@
     return find_max( $lines, '/rep-gtk/', '/^.*rep-gtk[_-]([\d\.]+).tar.*$/' );
 
   if ( $book_index == "shared-mime-info" )
-    return find_max( $lines, '/shared-mime-info/', '/^.*shared-mime-info 
([\d\.]+).*$/' );
+    return find_max( $lines, '/\d\.tar/', '/^.*\/([\d\.]+).tar.*$/' );
 
   if ( $book_index == "telepathy-mission-control" )
     return find_max( $lines, "/$package/", 
"/^.*$package-([\d\.]*\d)\.tar.*$/", TRUE );

Modified: trunk/scripts/blfs-chapter12.php
==============================================================================
--- trunk/scripts/blfs-chapter12.php    Thu Jan 21 12:32:45 2021        (r24125)
+++ trunk/scripts/blfs-chapter12.php    Thu Jan 21 15:37:27 2021        (r24126)
@@ -245,7 +245,7 @@
     return find_max( $lines, '/paxmirabilis/', 
'/^.*paxmirabilis-(\d\d*\d).tgz.*$/' );
 
   if ( $book_index == "upower" )
-    return find_max( $lines, '/upower/', '/^.*upower-(\d\.[\d\.]+\d).*$/' );
+    return find_max( $lines, '/Released UPower/', '/^.*UPower 
(\d\.[\d\.]+\d).*$/' );
 
   if ( $book_index == "p7zip" )
   {

Modified: trunk/scripts/blfs-chapter17.php
==============================================================================
--- trunk/scripts/blfs-chapter17.php    Thu Jan 21 12:32:45 2021        (r24125)
+++ trunk/scripts/blfs-chapter17.php    Thu Jan 21 15:37:27 2021        (r24126)
@@ -145,7 +145,7 @@
   if ( preg_match( "/^ftp/", $dirpath ) )
   {
     // glib type packages
-    if ( $book_index == "glib-networking" ||
+    if ( $book_index == "glib-networking" ||  // This shouldn't happen any more
          $book_index == "libsoup"          )
     {
       // Parent listing
@@ -170,7 +170,7 @@
       $dirpath  = rtrim  ( $dirpath, "/" );    // Trim any trailing slash
       $position = strrpos( $dirpath, "/" );
       $dirpath  = substr ( $dirpath, 0, $position );
-      $lines1   = http_get_file( $dirpath );
+      $lines1   = http_get_file( "$dirpath/" );
       $dir      = find_even_max( $lines1, '/^\s*[\d\.]+\/.*$/', 
'/^\s*([\d\.]+).*$/' );
       $dirpath .= "/$dir/";
     }
@@ -210,6 +210,28 @@
   if ( $book_index == "c-ares" )
     return find_max( $lines, '/c-ares/', '/^.*c-ares-([\d\.]+).tar.*$/' );
 
+  if ( $book_index == "glib-networking" )
+  {
+    $version = find_max( $lines, "/$book_index/", 
"/.*$book_index-([\d\.]*\d)\.tar.*$/" );
+    if ( $version == 0 )
+    {
+      // Reduce last directory segment by 0.02
+      /*
+      $dirpath  = rtrim  ( $dirpath, "/" );    // Trim any trailing slash
+      $position = strrpos( $dirpath, "/" );
+      $basedir  = substr ( $dirpath, 0, $position );
+      $lastdir  = substr ( $dirpath, -4  );    // 3.xx 
+      $newdir   = (float)$lastdir - 0.02 ;
+      $dirpath  = $basedir . "/" . $newdir;
+
+      // Get values from that diretory
+      $lines    = http_get_file( "$dirpath/" );
+      */
+      $lines   = backup_dir( $dirpath, 4, 0.02 );
+      $version = find_max( $lines, "/$book_index/", 
"/^.*$book_index-([\d\.]*\d)\.tar.*$/" );
+    }
+    return $version;
+  }
   if ( $book_index == "curl" )
     return find_max( $lines, '/^\d/', '/^([\d\.]+) .*$/' );
 

Modified: trunk/scripts/blfs-include.php
==============================================================================
--- trunk/scripts/blfs-include.php      Thu Jan 21 12:32:45 2021        (r24125)
+++ trunk/scripts/blfs-include.php      Thu Jan 21 15:37:27 2021        (r24126)
@@ -120,6 +120,20 @@
   return ( isset( $a[0] ) ) ? $a[0] : 0;
 }
 
+function backup_dir( $path, $dirlen, $diff )
+{
+   $path     = rtrim  ( $path, "/" );         // Trim any trailing slash
+   $position = strrpos( $path, "/" );
+   $basedir  = substr ( $path, 0, $position );
+   $lastdir  = substr ( $path, -$dirlen );    // last $dirlen characters
+   $newdir   = (float)$lastdir - $diff ;      // backup
+   $fullpath = $basedir . "/" . $newdir;
+
+   // Get values from that diretory
+   $newlines = http_get_file( "$fullpath/" );
+   return $newlines;
+}
+
 function http_get_file( $url )
 {
   if ( preg_match( "/graphviz/", $url ) ||
@@ -139,7 +153,8 @@
   // Do not strip tags
   if ( preg_match( "/gpm/",      $url ) ||
        preg_match( "/libvdpau/", $url ) ||
-       preg_match( "/imagemagick/", $url ) ||
+       preg_match( "/shared-mime-info/", $url ) ||
+       preg_match( "/imagemagick/",      $url ) ||
        preg_match( "/allbsd/",   $url ) ||    // paxmirabilis
        preg_match( "/alsa/",     $url ) )
   {
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-book
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to