tazpkg rev 866

Module "get": fix reinstall (thanks Lucas Levrel); "get", "install": fix installing of blocked packages; add "list-cache" command
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Nov 19 04:07:05 2015 +0200 (2015-11-19)
parents 46bfd486a20c
children 4b0ae74ec45c
files doc/tazpkg.en.html doc/tazpkg.es.html doc/tazpkg.fr.html doc/tazpkg.pt.html doc/tazpkg.ru.html modules/cache modules/get modules/install po/el.po po/es.po po/fr.po po/pl.po po/pt_BR.po po/ru.po po/sv.po po/zh_CN.po po/zh_TW.po tazpkg
line diff
     1.1 --- a/doc/tazpkg.en.html	Tue Nov 17 18:35:34 2015 +0200
     1.2 +++ b/doc/tazpkg.en.html	Thu Nov 19 04:07:05 2015 +0200
     1.3 @@ -253,6 +253,8 @@
     1.4  	<li><a href="#activity">activity</a>: show TazPkg activity log</li>
     1.5  	<li><a href="#clean-cache">clean-cache</a>: clean all packages downloaded in cache
     1.6  		directory</li>
     1.7 +	<li><a href="#list-cache">list-cache</a>: list all packages downloaded in cache
     1.8 +		directory</li>
     1.9  	<li><a href="#shell">shell</a>: run interactive TazPkg shell</li>
    1.10  </ul>
    1.11  </article>
    1.12 @@ -395,6 +397,17 @@
    1.13  </article>
    1.14  
    1.15  
    1.16 +<article id="list-cache"><h3>list-cache</h3>
    1.17 +
    1.18 +<p>List *.tazpkg packages downloaded to the cache. Displays a list of file names and their sizes,
    1.19 +as well as the total amount and size.</p>
    1.20 +
    1.21 +<pre>
    1.22 +# tazpkg list-cache
    1.23 +</pre>
    1.24 +</article>
    1.25 +
    1.26 +
    1.27  <article id="shell"><h3>shell</h3>
    1.28  
    1.29  <p>Run interactive TazPkg shell. Here you can enter all the TazPkg commands listed above.</p>
     2.1 --- a/doc/tazpkg.es.html	Tue Nov 17 18:35:34 2015 +0200
     2.2 +++ b/doc/tazpkg.es.html	Thu Nov 19 04:07:05 2015 +0200
     2.3 @@ -260,6 +260,8 @@
     2.4  	<li><a href="#activity">activity</a>: show TazPkg activity log</li>
     2.5  	<li><a href="#clean-cache">clean-cache</a>: clean all packages downloaded in cache
     2.6  		directory</li>
     2.7 +	<li><a href="#list-cache">list-cache</a>: list all packages downloaded in cache
     2.8 +		directory</li>
     2.9  	<li><a href="#shell">shell</a>: run interactive TazPkg shell</li>
    2.10  </ul>
    2.11  </article>
    2.12 @@ -405,6 +407,17 @@
    2.13  </article>
    2.14  
    2.15  
    2.16 +<article id="list-cache"><h3>list-cache</h3>
    2.17 +
    2.18 +<p>List *.tazpkg packages downloaded to the cache. Displays a list of file names and their sizes,
    2.19 +as well as the total amount and size.</p>
    2.20 +
    2.21 +<pre>
    2.22 +# tazpkg list-cache
    2.23 +</pre>
    2.24 +</article>
    2.25 +
    2.26 +
    2.27  <article id="shell"><h3>shell</h3>
    2.28  
    2.29  <p>Run interactive TazPkg shell. Here you can enter all the TazPkg commands listed above.</p>
     3.1 --- a/doc/tazpkg.fr.html	Tue Nov 17 18:35:34 2015 +0200
     3.2 +++ b/doc/tazpkg.fr.html	Thu Nov 19 04:07:05 2015 +0200
     3.3 @@ -283,6 +283,8 @@
     3.4              denières actions de TazPkg</li>
     3.5            <li><a href="#clean-cache">clean-cache</a>&nbsp;: efface tous
     3.6              les paquets téléchargés dans le répertoire cache</li>
     3.7 +          <li><a href="#list-cache">list-cache</a>: list all packages downloaded
     3.8 +            in cache directory</li>
     3.9            <li><a href="#shell">shell</a>&nbsp;: lancer le shell
    3.10              interactif de TazPkg</li>
    3.11          </ul>
    3.12 @@ -444,6 +446,14 @@
    3.13  </pre>
    3.14        </article>
    3.15  
    3.16 +      <article id="list-cache"><h3>list-cache</h3>
    3.17 +        <p>List *.tazpkg packages downloaded to the cache. Displays a list of
    3.18 +          file names and their sizes, as well as the total amount and size.</p>
    3.19 +        <pre>
    3.20 +# tazpkg list-cache
    3.21 +</pre>
    3.22 +      </article>
    3.23 +
    3.24        <article id="shell"><h3>shell</h3>
    3.25          <p>TazPkg fournit un mode SHell permettant de passer successivement
    3.26            plusieurs commandes au gestionnaire de paquets. Ce mode supporte
     4.1 --- a/doc/tazpkg.pt.html	Tue Nov 17 18:35:34 2015 +0200
     4.2 +++ b/doc/tazpkg.pt.html	Thu Nov 19 04:07:05 2015 +0200
     4.3 @@ -64,6 +64,8 @@
     4.4  	<li><a href="#activity">activity</a>: mostra o log de atividade do TazPkg</li>
     4.5  	<li><a href="#clean-cache">clean-cache</a>: limpa todos os pacotes baixados do diretório de
     4.6  		cache</li>
     4.7 +	<li><a href="#list-cache">list-cache</a>: list all packages downloaded in cache
     4.8 +		directory</li>
     4.9  	<li><a href="#shell">shell</a>: run interactive TazPkg shell</li>
    4.10  </ul>
    4.11  </article>
    4.12 @@ -208,6 +210,17 @@
    4.13  </article>
    4.14  
    4.15  
    4.16 +<article id="list-cache"><h3>list-cache</h3>
    4.17 +
    4.18 +<p>List *.tazpkg packages downloaded to the cache. Displays a list of file names and their sizes,
    4.19 +as well as the total amount and size.</p>
    4.20 +
    4.21 +<pre>
    4.22 +# tazpkg list-cache
    4.23 +</pre>
    4.24 +</article>
    4.25 +
    4.26 +
    4.27  <article id="shell"><h3>shell</h3>
    4.28  
    4.29  <p>Run interactive TazPkg shell. Here you can enter all the TazPkg commands listed above.</p>
     5.1 --- a/doc/tazpkg.ru.html	Tue Nov 17 18:35:34 2015 +0200
     5.2 +++ b/doc/tazpkg.ru.html	Thu Nov 19 04:07:05 2015 +0200
     5.3 @@ -261,6 +261,7 @@
     5.4  	<li><a href="#help">help</a>: справка по выбранной команде</li>
     5.5  	<li><a href="#activity">activity</a>: журнал действий TazPkg</li>
     5.6  	<li><a href="#clean-cache">clean-cache</a>: очистить кэш загруженных пакетов</li>
     5.7 +	<li><a href="#list-cache">list-cache</a>: список пакетов, находящихся в кеше</li>
     5.8  	<li><a href="#shell">shell</a>: запустить интерактивную оболочку TazPkg</li>
     5.9  </ul>
    5.10  </article>
    5.11 @@ -409,6 +410,17 @@
    5.12  </article>
    5.13  
    5.14  
    5.15 +<article id="list-cache"><h3>list-cache</h3>
    5.16 +
    5.17 +<p>Список пакетов *.tazpkg, находящихся в кэше. Будет отображен список имен файлов и их размеров,
    5.18 +а также общее количество фалов и размер.</p>
    5.19 +
    5.20 +<pre>
    5.21 +# tazpkg list-cache
    5.22 +</pre>
    5.23 +</article>
    5.24 +
    5.25 +
    5.26  <article id="shell"><h3>shell</h3>
    5.27  
    5.28  <p>Запустить интерактивную оболочку TazPkg. Здесь вы можете ввести все команды TazPkg, описанные
     6.1 --- a/modules/cache	Tue Nov 17 18:35:34 2015 +0200
     6.2 +++ b/modules/cache	Thu Nov 19 04:07:05 2015 +0200
     6.3 @@ -13,12 +13,12 @@
     6.4  
     6.5  
     6.6  
     6.7 +num=$(find "$CACHE_DIR" -name '*.tazpkg' | wc -l)
     6.8 +size=$(du -hs "$CACHE_DIR" | cut -f1 | sed 's|\.0||')
     6.9 +[ "$num" -eq 0 ] && size="0K"
    6.10 +
    6.11  case $1 in
    6.12  	clean)
    6.13 -		num=$(find "$CACHE_DIR" -name '*.tazpkg' | wc -l)
    6.14 -		size=$(du -hs "$CACHE_DIR" | cut -f1 | sed 's|\.0||')
    6.15 -		[ "$num" -eq 0 ] && size="0K"
    6.16 -
    6.17  		title 'Cleaning cache directory...'
    6.18  		action 'Path: %s' "$CACHE_DIR"
    6.19  		find "$CACHE_DIR" -name '*.tazpkg' -delete
    6.20 @@ -29,4 +29,15 @@
    6.21  			'%s files removed from cache (%s).' "$num" \
    6.22  			"$(colorize 32 "$num")" "$size")"
    6.23  		;;
    6.24 +
    6.25 +	list)
    6.26 +		title 'Packages cache'
    6.27 +		find "$CACHE_DIR" -name '*.tazpkg' -exec busybox ls -lh \{\} \; | \
    6.28 +		awk '{printf "%s (%s)\n", $9, $5}'
    6.29 +		footer "$(_p \
    6.30 +			'%s file (%s)' \
    6.31 +			'%s files (%s)' "$num" \
    6.32 +			"$(colorize 32 "$num")" "$size")"
    6.33 +		;;
    6.34 +
    6.35  esac
     7.1 --- a/modules/get	Tue Nov 17 18:35:34 2015 +0200
     7.2 +++ b/modules/get	Thu Nov 19 04:07:05 2015 +0200
     7.3 @@ -364,16 +364,25 @@
     7.4  
     7.5  # Command 'get-install' calls 'get', then 'install' modules. Check package presence here, on the
     7.6  # first stage, if '--forced' option not given
     7.7 -if [ "$tazpkg_command" == 'get-install' -a -z "$forced" ]; then
     7.8 -	awk -F$'\t' -vpv="$i" '$1==pv { exit 1 }' "$PKGS_DB/installed.info"
     7.9 -	if [ "$?" -eq 1 ]; then
    7.10 -		newline
    7.11 -		_ '"%s" package is already installed.' "$(colorize 34 "$i")"
    7.12 -		longline "$(_ 'You can use the --forced option to force installation.')"
    7.13 -		newline
    7.14 -		# Prevent execution 'install' stage:
    7.15 +if [ "$tazpkg_command" == 'get-install' ]; then
    7.16 +	if grep -qs "^$1$" "$BLOCKED"; then
    7.17 +		_ 'Package "%s" blocked.' "$1" >&2
    7.18  		exit 1
    7.19  	fi
    7.20 +
    7.21 +	if [ -z "$forced" ]; then
    7.22 +		awk -F$'\t' -vpv="$1" '$1==pv { exit 1 }' "$PKGS_DB/installed.info"
    7.23 +		if [ "$?" -eq 1 ]; then
    7.24 +			(
    7.25 +				newline
    7.26 +				_ '"%s" package is already installed.' "$(colorize 34 "$1")"
    7.27 +				longline "$(_ 'You can use the --forced option to force installation.')"
    7.28 +				newline
    7.29 +			) >&2
    7.30 +			# Prevent execution 'install' stage:
    7.31 +			exit 1
    7.32 +		fi
    7.33 +	fi
    7.34  fi
    7.35  
    7.36  if [ -n "$extra" ]; then
     8.1 --- a/modules/install	Tue Nov 17 18:35:34 2015 +0200
     8.2 +++ b/modules/install	Thu Nov 19 04:07:05 2015 +0200
     8.3 @@ -585,6 +585,11 @@
     8.4  	rm -rf "$tmp_dir"
     8.5  ) < "$1"
     8.6  
     8.7 +if grep -qs "^$PACKAGE$" "$BLOCKED"; then
     8.8 +	_ 'Package "%s" blocked.' "$PACKAGE"
     8.9 +	exit 1
    8.10 +fi
    8.11 +
    8.12  if [ -z "$forced" ]; then
    8.13  	# Check if a package is already installed
    8.14  	debug "\ncheck for installed package '$PACKAGE'"
     9.1 --- a/po/el.po	Tue Nov 17 18:35:34 2015 +0200
     9.2 +++ b/po/el.po	Thu Nov 19 04:07:05 2015 +0200
     9.3 @@ -197,6 +197,12 @@
     9.4  msgstr[0] "%s το αρχείο έχει διαγραφεί από τη μνήμη cache (%s)."
     9.5  msgstr[1] "%s το αρχείο έχει διαγραφεί από τη μνήμη cache (%s)."
     9.6  
     9.7 +#: modules/cache:37
     9.8 +msgid "%s file (%s)"
     9.9 +msgid_plural "%s files (%s)"
    9.10 +msgstr[0] "%s αρχείο (%s)"
    9.11 +msgstr[1] "%s αρχεία (%s)"
    9.12 +
    9.13  #: modules/check:20 tazpanel/pkgs.cgi:948
    9.14  msgid "Package %s"
    9.15  msgstr "Πακέτο %s"
    10.1 --- a/po/es.po	Tue Nov 17 18:35:34 2015 +0200
    10.2 +++ b/po/es.po	Thu Nov 19 04:07:05 2015 +0200
    10.3 @@ -200,6 +200,12 @@
    10.4  msgstr[0] "%s archivo removido de la caché (%s)."
    10.5  msgstr[1] "%s archivo removido de la caché (%s)."
    10.6  
    10.7 +#: modules/cache:37
    10.8 +msgid "%s file (%s)"
    10.9 +msgid_plural "%s files (%s)"
   10.10 +msgstr[0] "%s archivo (%s)"
   10.11 +msgstr[1] "%s archivos (%s)"
   10.12 +
   10.13  #: modules/check:20 tazpanel/pkgs.cgi:948
   10.14  msgid "Package %s"
   10.15  msgstr "Paquete %s"
    11.1 --- a/po/fr.po	Tue Nov 17 18:35:34 2015 +0200
    11.2 +++ b/po/fr.po	Thu Nov 19 04:07:05 2015 +0200
    11.3 @@ -183,6 +183,12 @@
    11.4  msgstr[0] "%s fichier supprimé du cache (%s)."
    11.5  msgstr[1] "%s fichiers supprimés du cache (%s)."
    11.6  
    11.7 +#: modules/cache:37
    11.8 +msgid "%s file (%s)"
    11.9 +msgid_plural "%s files (%s)"
   11.10 +msgstr[0] "%s fichier (%s)"
   11.11 +msgstr[1] "%s fichiers (%s)"
   11.12 +
   11.13  #: modules/check:20 tazpanel/pkgs.cgi:948
   11.14  msgid "Package %s"
   11.15  msgstr "Paquet %s"
    12.1 --- a/po/pl.po	Tue Nov 17 18:35:34 2015 +0200
    12.2 +++ b/po/pl.po	Thu Nov 19 04:07:05 2015 +0200
    12.3 @@ -201,6 +201,13 @@
    12.4  msgstr[1] "Usunięto %s plik z pamięci podręcznej (%s)."
    12.5  msgstr[2] "Usunięto %s plik z pamięci podręcznej (%s)."
    12.6  
    12.7 +#: modules/cache:37
    12.8 +msgid "%s file (%s)"
    12.9 +msgid_plural "%s files (%s)"
   12.10 +msgstr[0] "%s plik (%s)"
   12.11 +msgstr[1] "%s pliki (%s)"
   12.12 +msgstr[2] "%s plików (%s)"
   12.13 +
   12.14  #: modules/check:20 tazpanel/pkgs.cgi:948
   12.15  msgid "Package %s"
   12.16  msgstr "Pakiet %s"
    13.1 --- a/po/pt_BR.po	Tue Nov 17 18:35:34 2015 +0200
    13.2 +++ b/po/pt_BR.po	Thu Nov 19 04:07:05 2015 +0200
    13.3 @@ -189,7 +189,13 @@
    13.4  msgid "%s file removed from cache (%s)."
    13.5  msgid_plural "%s files removed from cache (%s)."
    13.6  msgstr[0] "%s arquivo removido do cache (%s)."
    13.7 -msgstr[1] "%s arquivo removido do cache (%s)."
    13.8 +msgstr[1] "%s arquivos removidos do cache (%s)."
    13.9 +
   13.10 +#: modules/cache:37
   13.11 +msgid "%s file (%s)"
   13.12 +msgid_plural "%s files (%s)"
   13.13 +msgstr[0] "%s arquivo (%s)"
   13.14 +msgstr[1] "%s arquivos (%s)"
   13.15  
   13.16  #: modules/check:20 tazpanel/pkgs.cgi:948
   13.17  msgid "Package %s"
    14.1 --- a/po/ru.po	Tue Nov 17 18:35:34 2015 +0200
    14.2 +++ b/po/ru.po	Thu Nov 19 04:07:05 2015 +0200
    14.3 @@ -186,6 +186,13 @@
    14.4  msgstr[1] "Из кэша удалены %s файла (%s)."
    14.5  msgstr[2] "Из кэша удалено %s файлов (%s)."
    14.6  
    14.7 +#: modules/cache:37
    14.8 +msgid "%s file (%s)"
    14.9 +msgid_plural "%s files (%s)"
   14.10 +msgstr[0] "%s файл (%s)"
   14.11 +msgstr[1] "%s файла (%s)"
   14.12 +msgstr[2] "%s файлов (%s)"
   14.13 +
   14.14  #: modules/check:20 tazpanel/pkgs.cgi:948
   14.15  msgid "Package %s"
   14.16  msgstr "Пакет %s"
    15.1 --- a/po/sv.po	Tue Nov 17 18:35:34 2015 +0200
    15.2 +++ b/po/sv.po	Thu Nov 19 04:07:05 2015 +0200
    15.3 @@ -185,6 +185,12 @@
    15.4  msgstr[0] ""
    15.5  msgstr[1] ""
    15.6  
    15.7 +#: modules/cache:37
    15.8 +msgid "%s file (%s)"
    15.9 +msgid_plural "%s files (%s)"
   15.10 +msgstr[0] ""
   15.11 +msgstr[1] ""
   15.12 +
   15.13  #: modules/check:20 tazpanel/pkgs.cgi:948
   15.14  msgid "Package %s"
   15.15  msgstr "Paket %s"
    16.1 --- a/po/zh_CN.po	Tue Nov 17 18:35:34 2015 +0200
    16.2 +++ b/po/zh_CN.po	Thu Nov 19 04:07:05 2015 +0200
    16.3 @@ -186,6 +186,11 @@
    16.4  msgid_plural "%s files removed from cache (%s)."
    16.5  msgstr[0] "%s 个文件已在缓存中被删除 (%s)"
    16.6  
    16.7 +#: modules/cache:37
    16.8 +msgid "%s file (%s)"
    16.9 +msgid_plural "%s files (%s)"
   16.10 +msgstr[0] "%s文件 (%s)"
   16.11 +
   16.12  #: modules/check:20 tazpanel/pkgs.cgi:948
   16.13  msgid "Package %s"
   16.14  msgstr "软件包 %s"
    17.1 --- a/po/zh_TW.po	Tue Nov 17 18:35:34 2015 +0200
    17.2 +++ b/po/zh_TW.po	Thu Nov 19 04:07:05 2015 +0200
    17.3 @@ -190,6 +190,11 @@
    17.4  msgid_plural "%s files removed from cache (%s)."
    17.5  msgstr[0] "%s 個文件已在緩存中被刪除 (%s)"
    17.6  
    17.7 +#: modules/cache:37
    17.8 +msgid "%s file (%s)"
    17.9 +msgid_plural "%s files (%s)"
   17.10 +msgstr[0] "%s文件 (%s)"
   17.11 +
   17.12  #: modules/check:20 tazpanel/pkgs.cgi:948
   17.13  msgid "Package %s"
   17.14  msgstr "包 %s"
    18.1 --- a/tazpkg	Tue Nov 17 18:35:34 2015 +0200
    18.2 +++ b/tazpkg	Thu Nov 19 04:07:05 2015 +0200
    18.3 @@ -475,6 +475,9 @@
    18.4  	clean-cache|-cc)
    18.5  		# Remove all downloaded packages.
    18.6  		check_cmd su; @@MODULES@@/cache clean;;
    18.7 +	list-cache)
    18.8 +		# List of packages in the cache.
    18.9 +		@@MODULES@@/cache list;;
   18.10  
   18.11  
   18.12  	list-undigest)