# HG changeset patch # User Aleksej Bobylev # Date 1447898825 -7200 # Node ID af67b2269d1ffdfd25de80c3bc858705ab639330 # Parent 46bfd486a20cb1c851f786f61846b726bbdf139a Module "get": fix reinstall (thanks Lucas Levrel); "get", "install": fix installing of blocked packages; add "list-cache" command diff -r 46bfd486a20c -r af67b2269d1f doc/tazpkg.en.html --- a/doc/tazpkg.en.html Tue Nov 17 18:35:34 2015 +0200 +++ b/doc/tazpkg.en.html Thu Nov 19 04:07:05 2015 +0200 @@ -253,6 +253,8 @@
  • activity: show TazPkg activity log
  • clean-cache: clean all packages downloaded in cache directory
  • +
  • list-cache: list all packages downloaded in cache + directory
  • shell: run interactive TazPkg shell
  • @@ -395,6 +397,17 @@ +

    list-cache

    + +

    List *.tazpkg packages downloaded to the cache. Displays a list of file names and their sizes, +as well as the total amount and size.

    + +
    +# tazpkg list-cache
    +
    +
    + +

    shell

    Run interactive TazPkg shell. Here you can enter all the TazPkg commands listed above.

    diff -r 46bfd486a20c -r af67b2269d1f doc/tazpkg.es.html --- a/doc/tazpkg.es.html Tue Nov 17 18:35:34 2015 +0200 +++ b/doc/tazpkg.es.html Thu Nov 19 04:07:05 2015 +0200 @@ -260,6 +260,8 @@
  • activity: show TazPkg activity log
  • clean-cache: clean all packages downloaded in cache directory
  • +
  • list-cache: list all packages downloaded in cache + directory
  • shell: run interactive TazPkg shell
  • @@ -405,6 +407,17 @@ +

    list-cache

    + +

    List *.tazpkg packages downloaded to the cache. Displays a list of file names and their sizes, +as well as the total amount and size.

    + +
    +# tazpkg list-cache
    +
    +
    + +

    shell

    Run interactive TazPkg shell. Here you can enter all the TazPkg commands listed above.

    diff -r 46bfd486a20c -r af67b2269d1f doc/tazpkg.fr.html --- a/doc/tazpkg.fr.html Tue Nov 17 18:35:34 2015 +0200 +++ b/doc/tazpkg.fr.html Thu Nov 19 04:07:05 2015 +0200 @@ -283,6 +283,8 @@ denières actions de TazPkg
  • clean-cache : efface tous les paquets téléchargés dans le répertoire cache
  • +
  • list-cache: list all packages downloaded + in cache directory
  • shell : lancer le shell interactif de TazPkg
  • @@ -444,6 +446,14 @@
    +

    list-cache

    +

    List *.tazpkg packages downloaded to the cache. Displays a list of + file names and their sizes, as well as the total amount and size.

    +
    +# tazpkg list-cache
    +
    +
    +

    shell

    TazPkg fournit un mode SHell permettant de passer successivement plusieurs commandes au gestionnaire de paquets. Ce mode supporte diff -r 46bfd486a20c -r af67b2269d1f doc/tazpkg.pt.html --- a/doc/tazpkg.pt.html Tue Nov 17 18:35:34 2015 +0200 +++ b/doc/tazpkg.pt.html Thu Nov 19 04:07:05 2015 +0200 @@ -64,6 +64,8 @@

  • activity: mostra o log de atividade do TazPkg
  • clean-cache: limpa todos os pacotes baixados do diretório de cache
  • +
  • list-cache: list all packages downloaded in cache + directory
  • shell: run interactive TazPkg shell
  • @@ -208,6 +210,17 @@ +

    list-cache

    + +

    List *.tazpkg packages downloaded to the cache. Displays a list of file names and their sizes, +as well as the total amount and size.

    + +
    +# tazpkg list-cache
    +
    +
    + +

    shell

    Run interactive TazPkg shell. Here you can enter all the TazPkg commands listed above.

    diff -r 46bfd486a20c -r af67b2269d1f doc/tazpkg.ru.html --- a/doc/tazpkg.ru.html Tue Nov 17 18:35:34 2015 +0200 +++ b/doc/tazpkg.ru.html Thu Nov 19 04:07:05 2015 +0200 @@ -261,6 +261,7 @@
  • help: справка по выбранной команде
  • activity: журнал действий TazPkg
  • clean-cache: очистить кэш загруженных пакетов
  • +
  • list-cache: список пакетов, находящихся в кеше
  • shell: запустить интерактивную оболочку TazPkg
  • @@ -409,6 +410,17 @@ +

    list-cache

    + +

    Список пакетов *.tazpkg, находящихся в кэше. Будет отображен список имен файлов и их размеров, +а также общее количество фалов и размер.

    + +
    +# tazpkg list-cache
    +
    +
    + +

    shell

    Запустить интерактивную оболочку TazPkg. Здесь вы можете ввести все команды TazPkg, описанные diff -r 46bfd486a20c -r af67b2269d1f modules/cache --- a/modules/cache Tue Nov 17 18:35:34 2015 +0200 +++ b/modules/cache Thu Nov 19 04:07:05 2015 +0200 @@ -13,12 +13,12 @@ +num=$(find "$CACHE_DIR" -name '*.tazpkg' | wc -l) +size=$(du -hs "$CACHE_DIR" | cut -f1 | sed 's|\.0||') +[ "$num" -eq 0 ] && size="0K" + case $1 in clean) - num=$(find "$CACHE_DIR" -name '*.tazpkg' | wc -l) - size=$(du -hs "$CACHE_DIR" | cut -f1 | sed 's|\.0||') - [ "$num" -eq 0 ] && size="0K" - title 'Cleaning cache directory...' action 'Path: %s' "$CACHE_DIR" find "$CACHE_DIR" -name '*.tazpkg' -delete @@ -29,4 +29,15 @@ '%s files removed from cache (%s).' "$num" \ "$(colorize 32 "$num")" "$size")" ;; + + list) + title 'Packages cache' + find "$CACHE_DIR" -name '*.tazpkg' -exec busybox ls -lh \{\} \; | \ + awk '{printf "%s (%s)\n", $9, $5}' + footer "$(_p \ + '%s file (%s)' \ + '%s files (%s)' "$num" \ + "$(colorize 32 "$num")" "$size")" + ;; + esac diff -r 46bfd486a20c -r af67b2269d1f modules/get --- a/modules/get Tue Nov 17 18:35:34 2015 +0200 +++ b/modules/get Thu Nov 19 04:07:05 2015 +0200 @@ -364,16 +364,25 @@ # Command 'get-install' calls 'get', then 'install' modules. Check package presence here, on the # first stage, if '--forced' option not given -if [ "$tazpkg_command" == 'get-install' -a -z "$forced" ]; then - awk -F$'\t' -vpv="$i" '$1==pv { exit 1 }' "$PKGS_DB/installed.info" - if [ "$?" -eq 1 ]; then - newline - _ '"%s" package is already installed.' "$(colorize 34 "$i")" - longline "$(_ 'You can use the --forced option to force installation.')" - newline - # Prevent execution 'install' stage: +if [ "$tazpkg_command" == 'get-install' ]; then + if grep -qs "^$1$" "$BLOCKED"; then + _ 'Package "%s" blocked.' "$1" >&2 exit 1 fi + + if [ -z "$forced" ]; then + awk -F$'\t' -vpv="$1" '$1==pv { exit 1 }' "$PKGS_DB/installed.info" + if [ "$?" -eq 1 ]; then + ( + newline + _ '"%s" package is already installed.' "$(colorize 34 "$1")" + longline "$(_ 'You can use the --forced option to force installation.')" + newline + ) >&2 + # Prevent execution 'install' stage: + exit 1 + fi + fi fi if [ -n "$extra" ]; then diff -r 46bfd486a20c -r af67b2269d1f modules/install --- a/modules/install Tue Nov 17 18:35:34 2015 +0200 +++ b/modules/install Thu Nov 19 04:07:05 2015 +0200 @@ -585,6 +585,11 @@ rm -rf "$tmp_dir" ) < "$1" +if grep -qs "^$PACKAGE$" "$BLOCKED"; then + _ 'Package "%s" blocked.' "$PACKAGE" + exit 1 +fi + if [ -z "$forced" ]; then # Check if a package is already installed debug "\ncheck for installed package '$PACKAGE'" diff -r 46bfd486a20c -r af67b2269d1f po/el.po --- a/po/el.po Tue Nov 17 18:35:34 2015 +0200 +++ b/po/el.po Thu Nov 19 04:07:05 2015 +0200 @@ -197,6 +197,12 @@ msgstr[0] "%s το αρχείο έχει διαγραφεί από τη μνήμη cache (%s)." msgstr[1] "%s το αρχείο έχει διαγραφεί από τη μνήμη cache (%s)." +#: modules/cache:37 +msgid "%s file (%s)" +msgid_plural "%s files (%s)" +msgstr[0] "%s αρχείο (%s)" +msgstr[1] "%s αρχεία (%s)" + #: modules/check:20 tazpanel/pkgs.cgi:948 msgid "Package %s" msgstr "Πακέτο %s" diff -r 46bfd486a20c -r af67b2269d1f po/es.po --- a/po/es.po Tue Nov 17 18:35:34 2015 +0200 +++ b/po/es.po Thu Nov 19 04:07:05 2015 +0200 @@ -200,6 +200,12 @@ msgstr[0] "%s archivo removido de la caché (%s)." msgstr[1] "%s archivo removido de la caché (%s)." +#: modules/cache:37 +msgid "%s file (%s)" +msgid_plural "%s files (%s)" +msgstr[0] "%s archivo (%s)" +msgstr[1] "%s archivos (%s)" + #: modules/check:20 tazpanel/pkgs.cgi:948 msgid "Package %s" msgstr "Paquete %s" diff -r 46bfd486a20c -r af67b2269d1f po/fr.po --- a/po/fr.po Tue Nov 17 18:35:34 2015 +0200 +++ b/po/fr.po Thu Nov 19 04:07:05 2015 +0200 @@ -183,6 +183,12 @@ msgstr[0] "%s fichier supprimé du cache (%s)." msgstr[1] "%s fichiers supprimés du cache (%s)." +#: modules/cache:37 +msgid "%s file (%s)" +msgid_plural "%s files (%s)" +msgstr[0] "%s fichier (%s)" +msgstr[1] "%s fichiers (%s)" + #: modules/check:20 tazpanel/pkgs.cgi:948 msgid "Package %s" msgstr "Paquet %s" diff -r 46bfd486a20c -r af67b2269d1f po/pl.po --- a/po/pl.po Tue Nov 17 18:35:34 2015 +0200 +++ b/po/pl.po Thu Nov 19 04:07:05 2015 +0200 @@ -201,6 +201,13 @@ msgstr[1] "Usunięto %s plik z pamięci podręcznej (%s)." msgstr[2] "Usunięto %s plik z pamięci podręcznej (%s)." +#: modules/cache:37 +msgid "%s file (%s)" +msgid_plural "%s files (%s)" +msgstr[0] "%s plik (%s)" +msgstr[1] "%s pliki (%s)" +msgstr[2] "%s plików (%s)" + #: modules/check:20 tazpanel/pkgs.cgi:948 msgid "Package %s" msgstr "Pakiet %s" diff -r 46bfd486a20c -r af67b2269d1f po/pt_BR.po --- a/po/pt_BR.po Tue Nov 17 18:35:34 2015 +0200 +++ b/po/pt_BR.po Thu Nov 19 04:07:05 2015 +0200 @@ -189,7 +189,13 @@ msgid "%s file removed from cache (%s)." msgid_plural "%s files removed from cache (%s)." msgstr[0] "%s arquivo removido do cache (%s)." -msgstr[1] "%s arquivo removido do cache (%s)." +msgstr[1] "%s arquivos removidos do cache (%s)." + +#: modules/cache:37 +msgid "%s file (%s)" +msgid_plural "%s files (%s)" +msgstr[0] "%s arquivo (%s)" +msgstr[1] "%s arquivos (%s)" #: modules/check:20 tazpanel/pkgs.cgi:948 msgid "Package %s" diff -r 46bfd486a20c -r af67b2269d1f po/ru.po --- a/po/ru.po Tue Nov 17 18:35:34 2015 +0200 +++ b/po/ru.po Thu Nov 19 04:07:05 2015 +0200 @@ -186,6 +186,13 @@ msgstr[1] "Из кэша удалены %s файла (%s)." msgstr[2] "Из кэша удалено %s файлов (%s)." +#: modules/cache:37 +msgid "%s file (%s)" +msgid_plural "%s files (%s)" +msgstr[0] "%s файл (%s)" +msgstr[1] "%s файла (%s)" +msgstr[2] "%s файлов (%s)" + #: modules/check:20 tazpanel/pkgs.cgi:948 msgid "Package %s" msgstr "Пакет %s" diff -r 46bfd486a20c -r af67b2269d1f po/sv.po --- a/po/sv.po Tue Nov 17 18:35:34 2015 +0200 +++ b/po/sv.po Thu Nov 19 04:07:05 2015 +0200 @@ -185,6 +185,12 @@ msgstr[0] "" msgstr[1] "" +#: modules/cache:37 +msgid "%s file (%s)" +msgid_plural "%s files (%s)" +msgstr[0] "" +msgstr[1] "" + #: modules/check:20 tazpanel/pkgs.cgi:948 msgid "Package %s" msgstr "Paket %s" diff -r 46bfd486a20c -r af67b2269d1f po/zh_CN.po --- a/po/zh_CN.po Tue Nov 17 18:35:34 2015 +0200 +++ b/po/zh_CN.po Thu Nov 19 04:07:05 2015 +0200 @@ -186,6 +186,11 @@ msgid_plural "%s files removed from cache (%s)." msgstr[0] "%s 个文件已在缓存中被删除 (%s)" +#: modules/cache:37 +msgid "%s file (%s)" +msgid_plural "%s files (%s)" +msgstr[0] "%s文件 (%s)" + #: modules/check:20 tazpanel/pkgs.cgi:948 msgid "Package %s" msgstr "软件包 %s" diff -r 46bfd486a20c -r af67b2269d1f po/zh_TW.po --- a/po/zh_TW.po Tue Nov 17 18:35:34 2015 +0200 +++ b/po/zh_TW.po Thu Nov 19 04:07:05 2015 +0200 @@ -190,6 +190,11 @@ msgid_plural "%s files removed from cache (%s)." msgstr[0] "%s 個文件已在緩存中被刪除 (%s)" +#: modules/cache:37 +msgid "%s file (%s)" +msgid_plural "%s files (%s)" +msgstr[0] "%s文件 (%s)" + #: modules/check:20 tazpanel/pkgs.cgi:948 msgid "Package %s" msgstr "包 %s" diff -r 46bfd486a20c -r af67b2269d1f tazpkg --- a/tazpkg Tue Nov 17 18:35:34 2015 +0200 +++ b/tazpkg Thu Nov 19 04:07:05 2015 +0200 @@ -475,6 +475,9 @@ clean-cache|-cc) # Remove all downloaded packages. check_cmd su; @@MODULES@@/cache clean;; + list-cache) + # List of packages in the cache. + @@MODULES@@/cache list;; list-undigest)