function get_current_xorg() { global $vers; global $book; global $freedesk; global $start; global $WGET_DIR; global $START_PACKAGE; global $STOP_PACKAGE; $wget_file = "{$WGET_DIR}/wget-list"; $contents = file_get_contents($wget_file); $wget = explode("\n", $contents); foreach ($wget as $line) { if ($line == "") { continue; } if (preg_match("/patch/", $line)) { continue; } // Skip patches $file = basename($line); $url = dirname($line); $file = preg_replace("/\\.tar\\..z.*\$/", "", $file); // Remove .tar.?z*$ $file = preg_replace("/\\.tar\$/", "", $file); // Remove .tar$ $file = preg_replace("/\\.gz\$/", "", $file); // Remove .gz$ $file = preg_replace("/\\.orig\$/", "", $file); // Remove .orig$ $file = preg_replace("/\\.src\$/", "", $file); // Remove .src$ $file = preg_replace("/\\.tgz\$/", "", $file); // Remove .tgz$ $pattern = get_pattern($line); $version = preg_replace($pattern, "\$1", $file); // Isolate version $version = preg_replace("/^-/", "", $version); // Remove leading #- if (preg_match("/^xf/", $file)) { $basename = preg_replace("/^(.+\\-).*\$/", "\$1", $file); } else { $basename = strstr($file, $version, true); } $basename = rtrim($basename, "-"); if ($basename == $START_PACKAGE) { $start = true; } if (!$start) { continue; } $index = $basename; while (isset($book[$index])) { $index .= "1"; } $book[$index] = array('basename' => $basename, 'url' => $url, 'version' => $version); if ($basename == 'glamor-egl') { $book['Xorg Drivers'] = array('basename' => "Xorg Drivers", 'url' => "", 'version' => ""); } if (preg_match("/^xf86/", $basename)) { $book[$index]['indent'] = "driver"; } // If $basename is util-macros, add Xorg Protocol Headers if ($basename == 'util-macros') { insert_subsection("Xorg Protocol Headers", "x7proto.xml", "proto"); } // If $basename is libxcb, add Xorg libs if ($basename == 'libxcb') { insert_subsection("Xorg Libraries", "x7lib.xml", "lib"); } // If $basename is xbitmaps, add Xorg Apps if ($basename == 'xbitmaps') { insert_subsection("Xorg Apps", "x7app.xml", "app"); } // If $basename is xcursor-themes, add Xorg Fonts if ($basename == 'xcursor-themes') { insert_subsection("Xorg Fonts", "x7font.xml", "font"); } if (preg_match("/{$STOP_PACKAGE}/", $line)) { break; } } }
function get_current() { global $vers; global $book; global $START_PACKAGE; global $STOP_PACKAGE; global $WGET_DIR; global $start; $wget_file = "{$WGET_DIR}/wget-list"; $contents = file_get_contents($wget_file); $wget = explode("\n", $contents); foreach ($wget as $line) { if ($line == "") { continue; } if (preg_match("/patch/", $line)) { continue; } // Skip patches $file = basename($line); $url = dirname($line); $file = preg_replace("/\\.tar\\..z.*\$/", "", $file); // Remove .tar.?z*$ $file = preg_replace("/\\.tar\$/", "", $file); // Remove .tar$ $file = preg_replace("/\\.gz\$/", "", $file); // Remove .gz$ $file = preg_replace("/\\.orig\$/", "", $file); // Remove .orig$ $file = preg_replace("/\\.src\$/", "", $file); // Remove .src$ $file = preg_replace("/\\.tgz\$/", "", $file); // Remove .tgz$ //$pattern = get_pattern( $line ); $pattern = get_pattern($file); $version = preg_replace($pattern, "\$1", $file); // Isolate version $version = preg_replace("/^-/", "", $version); // Remove leading #- $basename = strstr($file, $version, true); $basename = rtrim($basename, "-"); if ($basename == $START_PACKAGE) { $start = true; } if (!$start) { continue; } // Custom for Chapter 48 if ($version == "install-tl-unx") { $version = "Unversioned"; $basename = "install-tl-unx"; } $index = $basename; while (isset($book[$index])) { $index .= "1"; } $book[$index] = array('basename' => $basename, 'url' => $url, 'version' => $version); // Custom for chapter 12 -- there is both p7zip, unzip, and zip there if (preg_match("/p7zip|unzip/", $line)) { continue; } // Custom for chapter 30 -- there is both yelp and yelp-sxl if (preg_match("/yelp-xsl/", $line)) { continue; } if (preg_match("/{$STOP_PACKAGE}/", $line)) { break; } } }
function get_current() { global $dirs; global $vers; global $book; /* // Fetech from svn and get wget-list $current = array(); $lfssvn = "svn://svn.linuxfromscratch.org/LFS/trunk"; $tmpdir = exec( "mktemp -d /tmp/lfscheck.XXXXXX" ); $cdir = getcwd(); chdir( $tmpdir ); exec ( "svn --quiet export $lfssvn LFS" ); chdir( $cdir ); $PAGE = "$tmpdir/LFS/BOOK/chapter03/chapter03.xml"; $STYLESHEET = "$tmpdir/LFS/BOOK/stylesheets/wget-list.xsl"; exec( "xsltproc --xinclude --nonet $STYLESHEET $PAGE", $current ); exec( "rm -rf $tmpdir" ); */ $wget_file = "/home/bdubbs/public_html/blfs-book-xsl/wget-list"; $contents = file_get_contents($wget_file); $wget = explode("\n", $contents); //print_r( $current ); $i = 0; foreach ($wget as $line) { if ($i++ > 40) { break; } if ($line == "") { continue; } if (preg_match("/patch\$/", $line)) { continue; } // Skip patches $file = basename($line); $url = dirname($line); $file = preg_replace("/\\.tar\\..z.*\$/", "", $file); // Remove .tar.?z*$ $file = preg_replace("/\\.tar\$/", "", $file); // Remove .tar$ $file = preg_replace("/\\.gz\$/", "", $file); // Remove .gz$ $file = preg_replace("/\\.orig\$/", "", $file); // Remove .orig$ $file = preg_replace("/\\.src\$/", "", $file); // Remove .src$ $pattern = get_pattern($line); //echo "$pattern\n"; $version = preg_replace($pattern, "\$1", $file); // Isolate version $version = preg_replace("/^-/", "", $version); // Remove leading #- $basename = strstr($file, $version, true); $basename = rtrim($basename, "-"); //echo "$version\t$basename\t$url\n"; $index = $basename; while (isset($book[$index])) { $index .= "1"; } $book[$index] = array('basename' => $basename, 'url' => $url, 'version' => $version); continue; if (preg_match("/patch\$/", $file)) { continue; } // Skip patches $file = preg_replace("/bz2/", '', $file); // The 2 confusses the regex $file = rtrim($file); $pkg_pattern = "/(\\D*).*\$/"; //$pattern = "/\D*(\d.*\d)\D*$/"; $pattern = "/\\D*(\\d.*\\d)\\D*\$/"; if (preg_match("/e2fsprogs/", $file)) { $pattern = "/e2\\D*(\\d.*\\d)\\D*\$/"; $pkg_pattern = "/(e2\\D*).*\$/"; } else { if (preg_match("/tzdata/", $file)) { $pattern = "/\\D*(\\d.*[a-z])\\.tar\\D*\$/"; } } $version = preg_replace($pattern, "\$1", $file); // Isolate version $version = preg_replace("/^\\d-/", "", $version); // Remove leading #- // Touch up package names $pkg_name = preg_replace($pkg_pattern, "\$1", $file); $pkg_name = trim($pkg_name, "-"); if (preg_match("/bzip|iproute/", $pkg_name)) { $pkg_name .= "2"; } if (preg_match("/^m\$/", $pkg_name)) { $pkg_name .= "4"; } $dirs[$pkg_name] = dirname($line); $vers[$pkg_name] = $version; } //echo "===============\n"; //print_r( $book ); }