ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: "Alexey I. Froloff" <raorn@immo.ru>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] gear - сборка пакетов
Date: Fri, 5 May 2006 00:49:10 +0400
Message-ID: <20060504204910.GB9431@hell.immo.ru> (raw)
In-Reply-To: <445A3DF1.2020908@altlinux.com>


[-- Attachment #1.1: Type: text/plain, Size: 1122 bytes --]

* Anton Farygin <rider@> [060504 21:49]:
> С созданием всех каталогов в текущем каталоге git'а (ну или
> настраиваемо).
Я написал чудной кривизны "враппер" для rpm - подставляет нужный
.rpmmacros в зависимости от текущего каталога.

$ cat ~/.rpmwraprc
RPM_PREFIX="/usr/bin"
RPM="$RPM_PREFIX/rpm"
macrofile=".rpmwrapmacros"
allow_prefix="$HOME/src/BTE:$HOME/src/gitsnaps/packages"

$ cat ~/src/gitsnaps/packages/.rpmwrapmacros
%_topdir        %homedir/src/gitsnaps/packages
%_topsrcdir     %{_topdir}/%{name}
%_builddir      %{_topdir}/%{name}/work
%_sourcedir     %{_topsrcdir}/files
%_specdir       %{_topsrcdir}

$ cat ~/src/BTE/.rpmwrapmacros
%_topdir        %homedir/src/BTE/RPM
%_topsrcdir     %{_topdir}/%{name}
%_builddir      %{_topdir}/%{name}/work
%_sourcedir     %{_topsrcdir}/files
%_specdir       %{_topsrcdir}

$ ls -Alog ~/bin/rpm* 
lrwxrwxrwx 1   10 May  1 14:47 ~/bin/rpm -> rpmwrapper
lrwxrwxrwx 1   10 May  1 14:47 ~/bin/rpmbuild -> rpmwrapper
-rwxr-xr-x 1 1038 May  5 00:42 ~/bin/rpmwrapper

Думаю, принцип понятен?  Критика приветствуется.

-- 
Regards,
Sir Raorn.

[-- Attachment #1.2: rpmwrapper --]
[-- Type: text/plain, Size: 1038 bytes --]

#!/bin/sh -efu

PROG="${0##*/}"

etc="/etc/rpm"

[ "$0" = "./$PROG" ] && etc="." ||:
[ -f $etc/rpmwraprc ] && . $etc/rpmwraprc ||:
[ -f ~/.rpmwraprc ] && . ~/.rpmwraprc ||:

: ${RPM_PREFIX:="/usr/bin"}
: ${RPM:="$RPM_PREFIX/rpm"}
: ${macrofile:=".rpmwrapmacros"}

cwd="$(pwd)"
prefix=""
args=""

sIFS="$IFS"
IFS=":"
for i in $allow_prefix; do
    case "$cwd" in
	$i/*|$i)
	    [ -f "$i/$macrofile" ] && prefix="$i" ||:
	    ;;
	*)
	    continue
	    ;;
    esac
done
IFS="$sIFS"

rpmrc=
exit_handler()
{
	local rc=$?
	trap - EXIT
	[ -z "$rpmrc" ] || rm -r -- "$rpmrc"
	exit $rc
}

if [ -n "$prefix" ]; then
    rpmrc="$(mktemp -t "$PROG-rpmrc.XXXXXXXX")"
    trap exit_handler HUP PIPE INT QUIT TERM EXIT
    macrofiles="$($RPM --showrc| grep macrofiles)"
    macrofiles="${macrofiles#macrofiles}"
    macrofiles="${macrofiles#*:}"
    args="--rcfile=$rpmrc"
    cat <<EOF > "$rpmrc"
include:	/usr/lib/rpm/rpmrc
macrofiles:	${macrofiles+$macrofiles:}$prefix/$macrofile
EOF
fi
[ -x "$RPM_PREFIX/$PROG" ]  && "$RPM_PREFIX/$PROG" $args "$@"

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

  parent reply	other threads:[~2006-05-04 20:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-04 17:46 Anton Farygin
2006-05-04 20:21 ` Dmitry V. Levin
2006-05-04 21:10   ` Alexey I. Froloff
2006-05-04 21:43     ` Dmitry V. Levin
2006-05-05  4:35   ` Anton Farygin
2006-05-11 10:07   ` Kirill A. Shutemov
2006-05-04 20:49 ` Alexey I. Froloff [this message]
2006-05-05  4:39   ` Anton Farygin
2006-05-05  5:25     ` Alexey I. Froloff
2006-05-05  9:52       ` Anton Farygin
2006-05-05 10:54         ` Alexey I. Froloff

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=20060504204910.GB9431@hell.immo.ru \
    --to=raorn@immo.ru \
    --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