cookutils rev 598

Apply common stylesheet for docs; light reformatting of html code; add experimental (unfinished) '--cdeps' option to cook.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat May 04 18:02:53 2013 +0000 (2013-05-04)
parents f3eb8e8e9d2e
children f66c5d0bbc67
files cook doc/cookutils.en.html doc/cookutils.pt.html doc/cookutils.ru.html doc/style.css
line diff
     1.1 --- a/cook	Fri Apr 05 13:48:40 2013 +0200
     1.2 +++ b/cook	Sat May 04 18:02:53 2013 +0000
     1.3 @@ -50,6 +50,7 @@
     1.4    --getsrc|-gs       Cook : $(_ "get the package source tarball.")
     1.5    --block|-b         Cook : $(_ "block a package so cook will skip it.")
     1.6    --unblock|-ub      Cook : $(_ "unblock a blocked package.")
     1.7 +  --cdeps            Cook : $(_ "check dependencies of cooked package.")
     1.8    --pack             Cook : $(_ "repack an already built package.")
     1.9    --interactive|-x   New  : $(_ "create a receipt interactively.")
    1.10    --wok              Setup: $(_ "clone the cooking wok from Hg repo.")
    1.11 @@ -948,6 +949,69 @@
    1.12  	fi
    1.13  }
    1.14  
    1.15 +# Search file in mirrored packages
    1.16 +search_file_mirror()
    1.17 +{
    1.18 +	busybox unlzma -c $DB/files.list.lzma | grep $1\$ | cut -d: -f1 | sort -u
    1.19 +}
    1.20 +
    1.21 +# Search file in local wok packages
    1.22 +search_file_local()
    1.23 +{
    1.24 +	# existing packages have precedence over the package/taz folder
    1.25 +	srch=$1
    1.26 +	{ for package in $(find $PKGS -name '*.tazpkg'); do
    1.27 +		if [ ! "x$(busybox cpio --to-stdout --quiet -i files.list < $package | grep /$srch\$)" == "x" ]; then
    1.28 +			busybox cpio -i receipt < $package | fgrep PACKAGE | cut -d\" -f2
    1.29 +		fi
    1.30 +	done } | sort -u
    1.31 +}
    1.32 +
    1.33 +# Ask in multiple choice
    1.34 +ask_multiple()
    1.35 +{
    1.36 +	local multiples first my_choice
    1.37 +	multiples="$1"
    1.38 +	first=$(echo "$multiples" | head -n1)
    1.39 +	newline; _ "Multiple choice:\n$multiples\n"
    1.40 +	_ "Select one [$first]: "; read my_choice
    1.41 +	[ "x$my_choice" == "x" ] && my_choice="$first"
    1.42 +	found=$my_choice
    1.43 +}
    1.44 +
    1.45 +# Search file in local cache (fast), local wok packages, mirrored packages
    1.46 +search_file()
    1.47 +{
    1.48 +	local srch cache missing
    1.49 +	srch=$1
    1.50 +	cache=/var/cache/ldsearch.cache
    1.51 +	missing=/var/cache/missing.file
    1.52 +	touch $cache $missing
    1.53 +	found=$(grep $srch $cache | cut -d'	' -f2)
    1.54 +	if [ "x$found" == "x" ]; then
    1.55 +		found=$(search_file_local $srch)
    1.56 +		if [ "x$found" != "x" ]; then
    1.57 +			if [ $(echo "$found" | wc -l) -gt 1 ]; then
    1.58 +				ask_multiple "$found"
    1.59 +			fi
    1.60 +			echo "$srch	$found" >> $cache
    1.61 +		else
    1.62 +			found=$(search_file_mirror $srch)
    1.63 +			if [ "x$found" != "x" ]; then
    1.64 +				if [ $(echo "$found" | wc -l) -gt 1 ]; then
    1.65 +					ask_multiple "$found"
    1.66 +				fi
    1.67 +				echo "$srch	$found" >> $cache
    1.68 +			else
    1.69 +				echo "$srch" >> $missing
    1.70 +			fi
    1.71 +		fi
    1.72 +	fi
    1.73 +}
    1.74 +
    1.75 +
    1.76 +
    1.77 +
    1.78  #
    1.79  # Commands
    1.80  #
    1.81 @@ -1377,6 +1441,30 @@
    1.82  					_ "Need to build \$pkg." && exit 0
    1.83  				fi
    1.84  				exit 0 ;;
    1.85 +			--cdeps)
    1.86 +				[ ! -d $WOK/$pkg/taz ] && _ "Need to build \$pkg." && exit 0
    1.87 +				_ "Checking depends"; separator
    1.88 +				lddlist=/tmp/lddlist; touch $lddlist
    1.89 +				missing=/var/cache/missing.file
    1.90 +				# find all deps using ldd
    1.91 +				for exe in $(find $WOK/$pkg/taz -type f -perm +111); do
    1.92 +					[ "x$(dd if=$exe bs=4 count=1 2>/dev/null)" == "xELF" ] &&
    1.93 +						ldd $exe | sed 's|	||' | cut -d' ' -f1 >> $lddlist
    1.94 +				done
    1.95 +				# remove exe/so duplicates
    1.96 +				sort -u $lddlist > $lddlist.sorted
    1.97 +				# search packages
    1.98 +				for exefile in $(cat $lddlist.sorted); do
    1.99 +					search_file $exefile
   1.100 +					echo $found >> $lddlist.pkgs
   1.101 +					echo -n "."
   1.102 +				done
   1.103 +				echo
   1.104 +				# remove packages duplicates
   1.105 +				sort -u $lddlist.pkgs > $lddlist.final
   1.106 +				sort -u $missing > $missing.final
   1.107 +				rm -f $lddlist $lddlist.sorted $lddlist.pkgs $missing
   1.108 +				exit 0 ;;
   1.109  		esac
   1.110  
   1.111  		# Check if wanted is built now so we have separate log files.
     2.1 --- a/doc/cookutils.en.html	Fri Apr 05 13:48:40 2013 +0200
     2.2 +++ b/doc/cookutils.en.html	Sat May 04 18:02:53 2013 +0000
     2.3 @@ -1,15 +1,16 @@
     2.4  <!DOCTYPE html>
     2.5 -<html xmlns="http://www.w3.org/1999/xhtml">
     2.6 +<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
     2.7  <head>
     2.8 +	<meta charset="utf-8" />
     2.9  	<title>Cookutils Documentation</title>
    2.10 -	<meta charset="utf-8" />
    2.11 -	<link rel="stylesheet" type="text/css" href="style.css" />
    2.12 +	<link rel="stylesheet" type="text/css" href="../slitaz-doc.css" />
    2.13 +	<script type="text/javascript" src="../slitaz-doc.js"></script>
    2.14  </head>
    2.15  <body>
    2.16 -	
    2.17 -<div id="header">
    2.18 +
    2.19 +<header>
    2.20  	<h1>Cookutils Documentation</h1>
    2.21 -</div>
    2.22 +</header>
    2.23  
    2.24  <!-- Start content -->
    2.25  <div id="content">
    2.26 @@ -193,8 +194,7 @@
    2.27  # cook pkgdb
    2.28  </pre>
    2.29  
    2.30 -<a name="cooker"></a>
    2.31 -<h3>The Cooker</h3>
    2.32 +<h3 id="cooker">The Cooker</h3>
    2.33  <p>
    2.34  	The Cooker is a Build Bot, its first function is to check for commits in a wok,
    2.35  	create an ordered cooklist and cook all modified packages. It can also be
    2.36 @@ -271,8 +271,7 @@
    2.37  # cooker rev 9496
    2.38  </pre>
    2.39  
    2.40 -<a name="blocked"></a>
    2.41 -<h3>Blocked packages</h3>
    2.42 +<h3 id="blocked">Blocked packages</h3>
    2.43  <p>
    2.44  	Cook and the Cooker handle a file with a list of blocked package so they will
    2.45  	not cook when commits happen or if a cooklist is used. This is very useful
    2.46 @@ -391,10 +390,9 @@
    2.47  <!-- End content -->
    2.48  </div>
    2.49  
    2.50 -<div id="footer">
    2.51 -	Copyright &copy; 2011 SliTaz contributors
    2.52 -</div>
    2.53 +<footer>
    2.54 +	Copyright © 2013 <a href="http://www.slitaz.org/">SliTaz GNU/Linux</a>
    2.55 +</footer>
    2.56  
    2.57  </body>
    2.58  </html>
    2.59 -
     3.1 --- a/doc/cookutils.pt.html	Fri Apr 05 13:48:40 2013 +0200
     3.2 +++ b/doc/cookutils.pt.html	Sat May 04 18:02:53 2013 +0000
     3.3 @@ -1,16 +1,16 @@
     3.4 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     3.5 -    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     3.6 -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt" lang="pt">
     3.7 +<!DOCTYPE html>
     3.8 +<html xmlns="http://www.w3.org/1999/xhtml" lang="pt">
     3.9  <head>
    3.10 +	<meta charset="utf-8" />
    3.11  	<title>Documentação do Cookutils</title>
    3.12 -    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    3.13 -	<link rel="stylesheet" type="text/css" href="style.css" />
    3.14 +	<link rel="stylesheet" type="text/css" href="../slitaz-doc.css" />
    3.15 +	<script type="text/javascript" src="../slitaz-doc.js"></script>
    3.16  </head>
    3.17  <body>
    3.18 -	
    3.19 -<div id="header">
    3.20 +
    3.21 +<header>
    3.22  	<h1>Documentação do Cookutils</h1>
    3.23 -</div>
    3.24 +</header>
    3.25  
    3.26  <!-- Start content -->
    3.27  <div id="content">
    3.28 @@ -205,8 +205,7 @@
    3.29  # cook pkgdb
    3.30  </pre>
    3.31  
    3.32 -<a name="cooker"></a>
    3.33 -<h3>O comando 'cooker'</h3>
    3.34 +<h3 id="cooker">O comando 'cooker'</h3>
    3.35  <p>
    3.36      O cooker é um robô de compilação, que tem por função checar por commits
    3.37      em um wok, criar uma listagem da ordem de compilação (cooklist) e compilar
    3.38 @@ -287,8 +286,7 @@
    3.39  # cooker rev 9496
    3.40  </pre>
    3.41  
    3.42 -<a name="blocked"></a>
    3.43 -<h3>Pacotes bloqueados</h3>
    3.44 +<h3 id="blocked">Pacotes bloqueados</h3>
    3.45  <p>
    3.46      O 'cook' e o 'cooker' utilizam uma lista de pacotes bloqueados, nos quais
    3.47      são indicados quais pacotes não compilar quando acontece algum commit ou
    3.48 @@ -418,10 +416,9 @@
    3.49  <!-- End content -->
    3.50  </div>
    3.51  
    3.52 -<div id="footer">
    3.53 -	Copyright &copy; 2011 SliTaz contributors
    3.54 -</div>
    3.55 +<footer>
    3.56 +	Copyright © 2013 <a href="http://www.slitaz.org/">SliTaz GNU/Linux</a>
    3.57 +</footer>
    3.58  
    3.59  </body>
    3.60  </html>
    3.61 -
     4.1 --- a/doc/cookutils.ru.html	Fri Apr 05 13:48:40 2013 +0200
     4.2 +++ b/doc/cookutils.ru.html	Sat May 04 18:02:53 2013 +0000
     4.3 @@ -1,14 +1,16 @@
     4.4  <!DOCTYPE html>
     4.5 -<html xmlns="http://www.w3.org/1999/xhtml">
     4.6 -<head lang="ru">
     4.7 +<html xmlns="http://www.w3.org/1999/xhtml" lang="ru">
     4.8 +<head>
     4.9  	<meta charset="utf-8" />
    4.10  	<title>Документация CookUtils</title>
    4.11 -	<link rel="stylesheet" type="text/css" href="style.css" />
    4.12 +	<link rel="stylesheet" type="text/css" href="../slitaz-doc.css" />
    4.13 +	<script type="text/javascript" src="../slitaz-doc.js"></script>
    4.14  </head>
    4.15  <body>
    4.16 -<div id="header">
    4.17 +
    4.18 +<header>
    4.19  	<h1>Документация CookUtils</h1>
    4.20 -</div>
    4.21 +</header>
    4.22  
    4.23  <!-- Start content -->
    4.24  <div id="content">
    4.25 @@ -376,9 +378,9 @@
    4.26  <!-- End content -->
    4.27  </div>
    4.28  
    4.29 -<div id="footer">
    4.30 -	Авторское право © 2011–13 разрабочики SliTaz
    4.31 -</div>
    4.32 +<footer>
    4.33 +	Авторское право © 2011–13 <a href="http://www.slitaz.org/">SliTaz GNU/Linux</a>
    4.34 +</footer>
    4.35  
    4.36  </body>
    4.37  </html>
     5.1 --- a/doc/style.css	Fri Apr 05 13:48:40 2013 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,32 +0,0 @@
     5.4 -/* CSS style for SliTaz Doc */
     5.5 -
     5.6 -body {
     5.7 -	font: 88% "DejaVu Sans", Ubuntu, "Droid Sans", "Liberation Sans", FreeSans, sans-serif;
     5.8 -	margin: 0;
     5.9 -}
    5.10 -h1 { margin: 0; padding: 8px; color: #fff; font-size: 20px; }
    5.11 -h2 { color: #444; } h3 { color: #666; font-size: 140%; }
    5.12 -a:hover { text-decoration: none; }
    5.13 -pre {
    5.14 -	background-color: #f8f8f8;
    5.15 -	border: 1px solid #ddd;
    5.16 -	padding: 10px;
    5.17 -	border-radius: 4px;
    5.18 -}
    5.19 -
    5.20 -#header {
    5.21 -	background: #351a0a;
    5.22 -	height: 40px;
    5.23 -	border-bottom: 8px solid #d66018;
    5.24 -}
    5.25 -
    5.26 -#content {
    5.27 -	margin: 40px 80px;
    5.28 -	text-align: justify;
    5.29 -}
    5.30 -
    5.31 -#footer {
    5.32 -	text-align: center;
    5.33 -	padding: 20px;
    5.34 -	border-top: 1px solid #ddd;
    5.35 -}