// $RCSfile: pkg.php,v $ // $Revision: 1.1 $ // $Name: $ // $Date: 2008/09/04 16:36:18 $ // $Author: agibert $ /* * PkgBrowse - Packaging Project Browser * Copyright (C) 2008 Arnaud G. Gibert * mailto:arnaud@rx3.net * http://www.rx3.org/dvp/dvpbrowse * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $time_start = microtime_float(); include "/var/httpd/www.rx3.org/html/pkg/pkg_config.inc"; $pkg_myname="Pkg_Browse"; $pkg_tag_tab=explode( " ", "$Name: $"); $pkg_tag_tab=explode( "-", $pkg_tag_tab[1]); $pkg_myver=strtr( "$pkg_tag_tab[1]-$pkg_tag_tab[2]", "_", "."); /*--------------------------------------------------------------------------------------------------------------------*/ /* */ /*--------------------------------------------------------------------------------------------------------------------*/ function pkg_get_section( $pkg_id_lookup) { global $pkg_tab; foreach( $pkg_tab as $section_id => $value) { $pkg=$pkg_tab[$section_id]["pkg"]; foreach( $pkg as $pkg_id => $value) { if( $pkg_id == $pkg_id_lookup) { return $section_id; } } } return ""; } /*--------------------------------------------------------------------------------------------------------------------*/ /* */ /*--------------------------------------------------------------------------------------------------------------------*/ function pkg_get_name( $pkg_id_lookup) { global $pkg_tab; foreach( $pkg_tab as $section_id => $value) { $pkg=$pkg_tab[$section_id]["pkg"]; foreach( $pkg as $pkg_id => $value) { if( $pkg_id == $pkg_id_lookup) { return $pkg[$pkg_id]["name"]; } } } return ""; } /*--------------------------------------------------------------------------------------------------------------------*/ /* */ /*--------------------------------------------------------------------------------------------------------------------*/ function pkg_curverrel_get( $id) { $cmd="ls -rt download/$id/*/$id*.src.rpm | sed -e 's/^download.$id.//' -e 's/.src.rpm$//'"; $curverrel=exec($cmd); $tab=explode( "/", $curverrel); $curver=$tab[0]; $tab=explode( "-$curver-", $curverrel); $currel=$tab[1]; return( array( $curver, $currel)); } /*--------------------------------------------------------------------------------------------------------------------*/ /* */ /*--------------------------------------------------------------------------------------------------------------------*/ function pkg_list_get( $id, $curver, $currel) { $cmd="ls download/$id/$curver/$id-*$curver-$currel* | sort | sed -e 's/^download.$id.$curver.//'"; exec($cmd, $list); return( $list); } /*--------------------------------------------------------------------------------------------------------------------*/ /* */ /*--------------------------------------------------------------------------------------------------------------------*/ function pkg_tag_get( $pkg_id, $pkg_curver, $pkg_currel, $pkg_name, $pkg_qt) { if( $pkg_name == "") { $pkg_name="$pkg_id-$pkg_curver-$pkg_currel.src.rpm"; } $cmd="rpm -qp --qf \"$pkg_qt\" download/$pkg_id/$pkg_curver/$pkg_name | sed -e 's/\</g' -e's/>/\>/g'"; exec( $cmd, $reply_tab); return $reply_tab; } /*--------------------------------------------------------------------------------------------------------------------*/ /* */ /*--------------------------------------------------------------------------------------------------------------------*/ function pkg_tab_dump( $tab, $start) { for( $i = $start; $i < count($tab); $i++) { echo "$tab[$i]\n"; } } /*--------------------------------------------------------------------------------------------------------------------*/ /* */ /*--------------------------------------------------------------------------------------------------------------------*/ function pkg_main_header( $name) { $page_name="$name"; $page_title="$page_name !"; global $pkg_tab; global $pkg_header; global $pkg_keywords; $keywords="$pkg_keywords"; foreach( $pkg_tab as $section_id => $value) { foreach( $pkg_tab[$section_id]["pkg"] as $pkg_id => $value) { $keywords="$keywords,$pkg_id"; } } include "$pkg_header"; echo "
$pkg_notes
"; pkg_tab_dump( $description, 0); echo "
"; pkg_tab_dump( $change_log, 0); echo ""; $pkg_list = pkg_list_get( $id, $curver, $currel); if( $pkg_list != "") { echo"
"; for( $i = 0; $i < count($pkg_list); $i++) { echo " $pkg_list[$i]"; } echo "
"; } echo"