From: "Денис Назаров" <nenderus@altlinux.org>
To: devel@lists.altlinux.org
Subject: Re: [devel] hasher config
Date: Sun, 28 Mar 2021 23:01:09 +0300
Message-ID: <cfe0ff6b-b24a-6099-566f-9c7edbd46771@altlinux.org> (raw)
In-Reply-To: <47270849-66d8-bf72-3976-e936ed416319@altlinux.org>
[-- Attachment #1.1: Type: text/plain, Size: 5416 bytes --]
28.03.2021 14:39, Денис Назаров пишет:
> 28.03.2021 13:47, Денис Назаров пишет:
>> 28.03.2021 12:40, Leonid Krivoshein пишет:
>>> Добрый день!
>>>
>>>
>>> 28.03.2021 10:54, Денис Назаров пишет:
>>>> Добрый день!
>>>>
>>>>
>>>> Можно ли при сборке передавать hasher'у какой конфиг использовать
>>>> (вместо стандартного ~/.hasher/config)?
>>>>
>>>>
>>>> Сейчас у меня для разных веток свои конфиги sisyphus-config,
>>>> p9-config и я просто в ~/.hasher/ создаю симлинк с именем config на
>>>> нужный. Может как-то можно избежать этого, передавая параметр?
>>>
>>> Да, при локальной сборке через gear-hsh после "--" можно передавать
>>> опции hasher, например --apt-config=$HOME/.hasher/p9-config , нечто
>>> похожее на сборочнице реализовано через ssh build -b p9 ...
>>
>> Так похоже слишком много вручную параметров надо передавать, а если
>> архитекрутра ещё и qemu требует.
>>
>> А так у меня такие конфиги:
>>
>>
>> cat ~/.hasher/sisyphus-config
>> USER=nenderus
>> TARGET=x86_64
>>
>> for arg in "$@"; do
>> PARAM=`echo $arg | awk -F= '{print $1}'`
>> VALUE=`echo $arg | awk -F= '{print $2}'`
>> if [ $PARAM = '--target' ]; then
>> TARGET=$VALUE
>> fi
>> done
>>
>> if [ `uname -m` = i686 ]; then
>> TARGET=i586
>> fi
>>
>> case $TARGET in
>> x86_64 | i586)
>> ;;
>> aarch64 | ppc64le)
>> qemu_arch=$TARGET
>> ;;
>> armh)
>> qemu_arch=arm
>> ;;
>> *)
>> TARGET=x86_64
>> ;;
>> esac
>>
>> mkdir -p /tmp/.private/$USER/hasher-sisyphus-$TARGET
>> workdir="/tmp/.private/$USER/hasher-sisyphus-$TARGET"
>> def_target=$TARGET
>> apt_config="$HOME/.hasher/sisyphus-$TARGET-apt.conf"
>> def_repo=$HOME/hasher-sisyphus/repo
>> packager="`rpm --eval %packager`"
>> mount=/dev/pts,/proc
>>
>>
>> cat ~/.hasher/p9-config
>> USER=nenderus
>> TARGET=x86_64
>>
>> for arg in "$@"; do
>> PARAM=`echo $arg | awk -F= '{print $1}'`
>> VALUE=`echo $arg | awk -F= '{print $2}'`
>> if [ $PARAM = '--target' ]; then
>> TARGET=$VALUE
>> fi
>> done
>>
>> if [ `uname -m` = i686 ]; then
>> TARGET=i586
>> fi
>>
>> case $TARGET in
>> x86_64 | i586)
>> ;;
>> aarch64 | ppc64le)
>> qemu_arch=$TARGET
>> ;;
>> armh)
>> qemu_arch=arm
>> ;;
>> *)
>> TARGET=x86_64
>> ;;
>> esac
>>
>> mkdir -p /tmp/.private/$USER/hasher-p9-$TARGET
>> workdir="/tmp/.private/$USER/hasher-p9-$TARGET"
>> def_target=$TARGET
>> apt_config="$HOME/.hasher/p9-$TARGET-apt.conf"
>> def_repo=$HOME/hasher-p9/repo
>> packager="`rpm --eval %packager`"
>> mount=/dev/pts,/proc
>>
>>
>> И я просто делаю gear-hsh -v (для x86_64) или gear-hsh --target=%ARCH
>> -v (для другой архитектуры), но приходится менять симлинк
>> ~/.hasher/config указывающий на конфиг нужной ветки.
>
> Придумал такую штуку:
>
>
> cat ~/.hasher/config
> TARGET=x86_64
>
> for arg in "$@"; do
> PARAM=`echo $arg | awk -F= '{print $1}'`
> VALUE=`echo $arg | awk -F= '{print $2}'`
> if [ $PARAM = '--target' ]; then
> TARGET=$VALUE
> fi
> done
>
> if [ `uname -m` = i686 ]; then
> TARGET=i586
> fi
>
> case $TARGET in
> x86_64 | i586)
> ;;
> aarch64 | ppc64le)
> qemu_arch=$TARGET
> ;;
> armh)
> qemu_arch=arm
> ;;
> *)
> TARGET=x86_64
> ;;
> esac
>
> if [ -z $BRANCH ]; then
> BRANCH=sisyphus
> fi
>
> case $BRANCH in
> sisyphus | p9)
> ;;
> *)
> BRANCH=sisyphus
> ;;
> esac
>
> mkdir -p /tmp/.private/$USER/hasher-$BRANCH-$TARGET
> workdir="/tmp/.private/$USER/hasher-$BRANCH-$TARGET"
> def_target=$TARGET
> apt_config="$HOME/.hasher/$BRANCH-$TARGET-apt.conf"
> def_repo=$HOME/hasher-$BRANCH/repo
> packager="`rpm --eval %packager`"
> mount=/dev/pts,/proc
>
>
> И тогда получается по-умолчанию сизиф, а если надо p9, то:
>
>
> BRANCH=p9 gear-hsh --target=%ARCH -v
>
>
> Не так удобно, как переменные конечно
Придумал в общем такой конфиг (может кому пригодится):
cat ~/.hasher/config
TARGET=x86_64
BRANCH=sisyphus
for arg in "$@"; do
shift
PARAM=`echo $arg | awk -F= '{print $1}'`
VALUE=`echo $arg | awk -F= '{print $2}'`
if [ $PARAM = '--target' ]; then
TARGET=$VALUE
fi
if [ $PARAM = '--branch' ]; then
BRANCH=$VALUE
continue
fi
set -- "$@" "$arg"
done
if [ `uname -m` = i686 ]; then
TARGET=i586
fi
case $TARGET in
x86_64 | i586)
;;
aarch64 | ppc64le)
qemu_arch=$TARGET
;;
armh)
qemu_arch=arm
;;
*)
TARGET=x86_64
;;
esac
case $BRANCH in
sisyphus | p9)
;;
*)
BRANCH=sisyphus
;;
esac
mkdir -p /tmp/.private/$USER/hasher-$BRANCH-$TARGET
workdir="/tmp/.private/$USER/hasher-$BRANCH-$TARGET"
def_target=$TARGET
apt_config="$HOME/.hasher/$BRANCH-$TARGET-apt.conf"
def_repo=$HOME/hasher-$BRANCH/repo
packager="`rpm --eval %packager`"
mount=/dev/pts,/proc
И можно указывать через параметр --branch:
gear-hsh --branch=p9 -v
>
>>
>>
>>>
>>>
>>
>>
>> _______________________________________________
>> Devel mailing list
>> Devel@lists.altlinux.org
>> https://lists.altlinux.org/mailman/listinfo/devel
>
>
>
> _______________________________________________
> Devel mailing list
> Devel@lists.altlinux.org
> https://lists.altlinux.org/mailman/listinfo/devel
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 203 bytes --]
prev parent reply other threads:[~2021-03-28 20:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-28 7:54 Денис Назаров
2021-03-28 9:40 ` Leonid Krivoshein
2021-03-28 10:47 ` Денис Назаров
2021-03-28 11:20 ` Leonid Krivoshein
2021-03-28 11:25 ` Yuri Sedunov
2021-03-28 11:39 ` Денис Назаров
2021-03-28 20:01 ` Денис Назаров [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cfe0ff6b-b24a-6099-566f-9c7edbd46771@altlinux.org \
--to=nenderus@altlinux.org \
--cc=devel@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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