scripts: introduced tmpdir.sh

This commit is contained in:
Alexey Tourbin 2011-09-22 00:43:46 +04:00
parent 54aa57d2a3
commit 3d7945aad6
7 changed files with 26 additions and 44 deletions

View File

@ -473,6 +473,7 @@ fi
%rpmattr %_rpmlibdir/shebang.* %rpmattr %_rpmlibdir/shebang.*
%rpmattr %_rpmlibdir/static.* %rpmattr %_rpmlibdir/static.*
%rpmattr %_rpmlibdir/symlinks.* %rpmattr %_rpmlibdir/symlinks.*
%rpmattr %_rpmlibdir/tmpdir.sh
%rpmattr %_rpmlibdir/verify-elf %rpmattr %_rpmlibdir/verify-elf
%rpmattr %_rpmlibdir/*.awk %rpmattr %_rpmlibdir/*.awk
# set-version helpers # set-version helpers

View File

@ -28,6 +28,7 @@ EXTRA_DIST = \
strip_files \ strip_files \
static.req static.req.files \ static.req static.req.files \
symlinks.req symlinks.req.files \ symlinks.req symlinks.req.files \
tmpdir.sh \
verify-elf verify-elf
installprefix = $(DESTDIR) installprefix = $(DESTDIR)
@ -62,6 +63,7 @@ config_SCRIPTS = \
strip_files \ strip_files \
static.req static.req.files \ static.req static.req.files \
symlinks.req symlinks.req.files \ symlinks.req symlinks.req.files \
tmpdir.sh \
verify-elf verify-elf
install-data-local: install-data-local:

View File

@ -2,7 +2,7 @@
# #
# fixup-binconfig - /usr/bin/*-config fixups. # fixup-binconfig - /usr/bin/*-config fixups.
# #
# Copyright (C) 2002,2004,2006,2008,2011 Dmitry V. Levin <ldv@altlinux.org> # Copyright (C) 2002,2004,2006,2008 Dmitry V. Levin <ldv@altlinux.org>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -22,19 +22,10 @@
. @RPMCONFIGDIR@/functions . @RPMCONFIGDIR@/functions
ValidateBuildRoot ValidateBuildRoot
exit_handler() . @RPMCONFIGDIR@/tmpdir.sh
{ TMPFILE="$tmpdir/tmp"
rm -rf -- "$WORKDIR" f_saved="$tmpdir/sav"
exit $1 f_new="$tmpdir/new"
}
trap 'exit 143' HUP INT QUIT PIPE TERM
WORKDIR="$(mktemp -dt "$PROG.XXXXXXXXXX")"
trap 'exit_handler $?' EXIT
TMPFILE="$WORKDIR/tmp"
f_saved="$WORKDIR/sav"
f_new="$WORKDIR/new"
: ${RPM_FIXUP_SKIPLIST:=} : ${RPM_FIXUP_SKIPLIST:=}

View File

@ -22,15 +22,8 @@
. @RPMCONFIGDIR@/functions . @RPMCONFIGDIR@/functions
ValidateBuildRoot ValidateBuildRoot
exit_handler() . @RPMCONFIGDIR@/tmpdir.sh
{ TMPFILE=$tmpdir/tmp
rm -f -- "$TMPFILE"
exit $1
}
trap 'exit 143' HUP INT QUIT PIPE TERM
TMPFILE="$(mktemp -t "$PROG.XXXXXXXXXX")"
trap 'exit_handler $?' EXIT
: ${RPM_FIXUP_SKIPLIST:=} : ${RPM_FIXUP_SKIPLIST:=}

View File

@ -2,7 +2,7 @@
# #
# fixup-pkgconfig - /usr/lib/pkgconfig/*.pc fixups. # fixup-pkgconfig - /usr/lib/pkgconfig/*.pc fixups.
# #
# Copyright (C) 2002,2003,2004,2006,2008,2011 Dmitry V. Levin <ldv@altlinux.org> # Copyright (C) 2002,2003,2004,2006,2008 Dmitry V. Levin <ldv@altlinux.org>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -22,15 +22,8 @@
. @RPMCONFIGDIR@/functions . @RPMCONFIGDIR@/functions
ValidateBuildRoot ValidateBuildRoot
exit_handler() . @RPMCONFIGDIR@/tmpdir.sh
{ TMPFILE=$tmpdir/tmp
rm -f -- "$TMPFILE"
exit $1
}
trap 'exit 143' HUP INT QUIT PIPE TERM
TMPFILE="$(mktemp -t "$PROG.XXXXXXXXXX")"
trap 'exit_handler $?' EXIT
: ${RPM_FIXUP_SKIPLIST:=} : ${RPM_FIXUP_SKIPLIST:=}

View File

@ -1,6 +1,6 @@
#!/bin/sh -efu #!/bin/sh -efu
# #
# Copyright (C) 2000-2006,2008,2011 Dmitry V. Levin <ldv@altlinux.org> # Copyright (C) 2000-2006,2008 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (C) 2007-2010 Alexey Tourbin <at@altlinux.org> # Copyright (C) 2007-2010 Alexey Tourbin <at@altlinux.org>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -33,16 +33,7 @@ RPM_FINDREQ_RPATH="/$RPM_LIB $RPM_LIBDIR $("$dump_ld_config")"
RPM_FINDREQ_RPATH="$("$dump_ld_config" '' "$RPM_BUILD_ROOT") $RPM_FINDREQ_RPATH" RPM_FINDREQ_RPATH="$("$dump_ld_config" '' "$RPM_BUILD_ROOT") $RPM_FINDREQ_RPATH"
Debug "RPM_FINDREQ_RPATH=$RPM_FINDREQ_RPATH" Debug "RPM_FINDREQ_RPATH=$RPM_FINDREQ_RPATH"
Cleanup() . @RPMCONFIGDIR@/tmpdir.sh
{
rm -rf -- "$tmpdir"
exit $1
}
trap 'exit 143' HUP INT QUIT PIPE TERM
tmpdir=$(mktemp -dt "$PROG.XXXXXXXX")
trap 'Cleanup $?' EXIT
>"$tmpdir"/lib2dep >"$tmpdir"/lib2dep
>"$tmpdir"/sym2lib >"$tmpdir"/sym2lib
>"$tmpdir"/versioned >"$tmpdir"/versioned

11
scripts/tmpdir.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/sh
remove_tmpdir()
{
rm -rf -- "$tmpdir"
exit $1
}
trap 'exit 143' HUP INT QUIT PIPE TERM
tmpdir=$(mktemp -dt "${0##*/}.XXXXXXXX")
trap 'remove_tmpdir $?' EXIT