ALT Linux Team development discussions
 help / color / mirror / Atom feed
* [devel] Q: Нужен триггер срабатывающий на замещение конкретных версий пакета.
@ 2011-05-12  9:24 Aleksey Avdeev
  2011-05-27 22:39 ` Aleksey Avdeev
  0 siblings, 1 reply; 2+ messages in thread
From: Aleksey Avdeev @ 2011-05-12  9:24 UTC (permalink / raw)
  To: ALT Linux Team development discussions

[-- Attachment #1: Type: text/plain, Size: 3260 bytes --]

Приветствую.

  Как правильно сделать триггер, срабатывающий на обновление с
конкретных версий пакета?

  Подробно:

  В целях закрытия
<https://bugzilla.altlinux.org/show_bug.cgi?id=24960>, по аналогии с
<http://www.altlinux.org/SpecTips/triggers#.D0.9F.D1.80.D0.B8.D0.BC.D0.B5.D1.80.D1.8B>
я нарисовал следующий триггер (не знаю как отключить автоперенос строк в
Thunderbird):

%triggerun base -- %name-base < 2.2.16
if [ $2 -gt 0 ]; then
  pushd %apache2_confdir
  for conffile in `egrep -Rsm1
'^[[:space:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:space:]]+(%apache2_basedir/|)%apache2_confdir_name/extra-available/Directory_(root|html|cgibin)_default\.conf'
*-available/*.conf|cut -sd: -f1`
  do
    echo "Warning: configuration files %apache2_confdir$conffile"
    echo "    uses
%apache2_extra_available/Directory_(root|html|cgibin)_default.conf,"
    echo "    moved to the %apache2_confdir_inc!"
    echo "    The original file is saved as
%apache2_confdir$conffile.rpmold"
    cp -fa --backup=t "$conffile" "$conffile.rpmold"
    sed -ri
's@^([[:space:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:space:]]+(%apache2_basedir/|)%apache2_confdir_name)/extra-available/(Directory_(root|html|cgibin)_default\.conf([[:space:]].*|)$)@\1/include/\3@'
"$conffile"
  done
  for conffile in `cd %apache2_extra_available/ && \
      find -maxdepth 1 -regextype posix-egrep -regex
'\./Directory_(root|html|cgibin)_default.conf$' -printf '%f\n'`
  do
    diff -q "%apache2_extra_available/$conffile"
"%apache2_confdir_inc/$conffile" >/dev/null` || {
      echo "Warning: config files %apache2_extra_available/$conffile"
      echo "    and %apache2_confdir_inc/$conffile are different!"
      echo "    %apache2_confdir_inc/$conffile file is saved as"
      echo "    %apache2_confdir_inc/$conffile.rpmnew and replaced by"
      echo "    %apache2_extra_available/$conffile."
      cp -fa --backup=t "%apache2_confdir_inc/$conffile"
"%apache2_confdir_inc/$conffile.rpmnew"
      cp -fa "%apache2_extra_available/$conffile"
"%apache2_confdir_inc/$conffile"
    }
    echo "Warning: config file %apache2_extra_available/$conffile"
    echo "    saved as %apache2_extra_available/$conffile.rpmold!"
    cp -fa --backup=t "%apache2_extra_available/$conffile"
"%apache2_extra_available/$conffile.rpmold"
    rm -f "%apache2_extra_available/$conffile"
  done
  popd
fi
exit 0

  Суть:

1. Заменить пути к перемещённым файлам (дабы httpd2 мог стартовать).

2. Заменить новые файлы старыми, если их содержимое отличается (дабы не
потерять ручные правки).

  Вопросы следующие:

1. Стоит ли вообще связываться с %triggerun? Судя по прядку применения
скриптов (см.
<http://www.altlinux.org/SpecTips/triggers#.D0.9F.D0.BE.D1.80.D1.8F.D0.B4.D0.BE.D0.BA_.D0.B2.D1.8B.D0.BF.D0.BE.D0.BB.D0.BD.D0.B5.D0.BD.D0.B8.D1.8F_.D1.81.D0.BA.D1.80.D0.B8.D0.BF.D1.82.D0.BE.D0.B2>)
мне может подойти и %post. Но я не знаю как в нём указать на обновление
каких версий пакетов он должен отрабатывать.

2. Помимо отработки на замещение apache2-base < 2.2.16 мне желательно
выполнять данный скрипт и при замещении apache2 < 2.2.9-alt10. Можно ли
это сделать без копипаста и не вынося тело скрипта в макрос?

-- 

С уважением. Алексей.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 900 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [devel] Q: Нужен триггер срабатывающий на замещение конкретных версий пакета.
  2011-05-12  9:24 [devel] Q: Нужен триггер срабатывающий на замещение конкретных версий пакета Aleksey Avdeev
@ 2011-05-27 22:39 ` Aleksey Avdeev
  0 siblings, 0 replies; 2+ messages in thread
From: Aleksey Avdeev @ 2011-05-27 22:39 UTC (permalink / raw)
  To: ALT Linux Team development discussions

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]

12.05.2011 13:24, Aleksey Avdeev пишет:
> Приветствую.
> 
...
> 
> 2. Помимо отработки на замещение apache2-base < 2.2.16 мне желательно
> выполнять данный скрипт и при замещении apache2 < 2.2.9-alt10. Можно ли
> это сделать без копипаста и не вынося тело скрипта в макрос?

  Rpm поддерживает синтаксис вида (см.
<http://git.altlinux.org/people/solo/packages/apache2.git?p=apache2.git;a=commitdiff;h=4fa2fe33b2ff85f5af48e07bfe158b39088777b0>):

%trigger* [<подпакет>] -- <условие для пакет1>[, <условие для пакет2>]

-- 

С уважением. Алексей.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 900 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-27 22:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-12  9:24 [devel] Q: Нужен триггер срабатывающий на замещение конкретных версий пакета Aleksey Avdeev
2011-05-27 22:39 ` Aleksey Avdeev

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git