Изменение profile.bashrc. Модификация сборки ядра. Обновление утилит.

Удалены устаревшие eclass для сборки ядре.
Добавлен новый calculate-kernel-6.eclass для сборки ядра на dracut.
profile.bashrc изменен для вызова скриптов из
/etc/calculate/profile.bashrc.d.
Старый profile.bashrc переименован в profile.bashrc
В утилитах добавлен параметр postmerge для вызова шаблонов после
postinst.
Добавлен patch для dracut для сборки им ядра через emerge
atratsevskiy
Mike khiretskiy 10 years ago
parent 2f19d703ff
commit f1cce1a38f

@ -1,154 +0,0 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# Original Author: © 2007-2009 Mir Calculate, Ltd.
# Purpose: Installing linux-desktop, linux-server.
# Build the kernel from source.
inherit calculate eutils kernel-2
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst
IUSE="vmlinuz"
detect_version
detect_arch
if [[ "$(get_version_component_range 1)" == "3" ]]
then
CKV=$(get_version_component_range 1-2)
else
CKV=$(get_version_component_range 1-3)
fi
SLOT=$(get_version_component_range 1-4)
KV_FULL="${PV}-calculate"
S="${WORKDIR}/linux-${KV_FULL}"
CALC_K_SUBV=.$(get_version_component_range 4)
[[ ${CALC_K_SUBV} == "." ]] && CALC_K_SUBV=
EXTRAVERSION="${CALC_K_SUBV}-calculate"
UNIPATCH_STRICTORDER=1
CALC_URI="ftp://ftp.calculate.ru/pub/calculate/${PN}/${PN}-${CKV}.tar.bz2
ftp://ftp.calculate-linux.org/pub/calculate/${PN}/${PN}-${CKV}.tar.bz2
http://mirror.yandex.ru/calculate/${PN}/${PN}-${CKV}.tar.bz2
ftp://ftp.linux.kiev.ua/pub/Linux/Calculate/${PN}/${PN}-${CKV}.tar.bz2"
if [[ -n $LONGTERM ]];then
if [[ $KERNEL_URI =~ ^(.*)(kernel/v2.6/patch)(.*)$ ]];then
KERNEL_URI="${BASH_REMATCH[1]}kernel/v2.6/longterm/v${CKV}/patch${BASH_REMATCH[3]}"
fi
fi
calculate-kernel-2_pkg_setup() {
kernel-2_pkg_setup
ewarn "!!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!"
ewarn "After the kernel assemble perform command to update modules:"
ewarn " module-rebuild -X rebuild"
ebeep 5
}
calculate-kernel-2_src_unpack() {
kernel-2_src_unpack
}
vmlinuz_src_compile() {
# disable sandbox
export SANDBOX_ON=0
export LDFLAGS=""
local GENTOOARCH="${ARCH}"
unset ARCH
cd ${S}
DEFAULT_KERNEL_SOURCE="${S}" CMD_KERNEL_DIR="${S}" cl-kernel \
--ebuild \
${CL_KERNEL_OPTS} \
--kerneldir=${S} \
--set cl_kernel_cache_path=${WORKDIR}/cache \
--set cl_kernel_temp_path=${S}/temp \
--set cl_kernel_install_path=${WORKDIR} \
--mrproper || die "kernel build failed"
make distclean &>/dev/null || die "cannot perform distclean"
ARCH="${GENTOOARCH}"
rm ${WORKDIR}/lib/modules/${KV_FULL}/build
rm ${WORKDIR}/lib/modules/${KV_FULL}/source
}
calculate-kernel-2_src_compile() {
use vmlinuz && vmlinuz_src_compile
}
vmlinuz_src_install() {
cd ${WORKDIR}/lib
insinto /lib
doins -r modules
insinto /usr/share/${PN}/${PV}
doins -r firmware
cd ${WORKDIR}
doins -r boot
dosym /usr/src/linux-${KV_FULL} \
"/lib/modules/${KV_FULL}/source" ||
die "cannot install source symlink"
dosym /usr/src/linux-${KV_FULL} \
"/lib/modules/${KV_FULL}/build" ||
die "cannot install build symlink"
insinto /etc/modprobe.d
}
calculate-kernel-2_src_install() {
kernel-2_src_install
dodir /usr/share/${PN}/${PV}/boot
use vmlinuz && vmlinuz_src_install
if ! use vmlinuz
then
local configname=$(cl-kernel -v --filter cl_kernel_config | \
sed -nr 's/.*\[.\]\s//p')
[[ -n $configname ]] &&
cp $configname ${D}/usr/share/${PN}/${PV}/boot/config-${KV_FULL}
fi
}
vmlinuz_pkg_postinst() {
cp -p /usr/share/${PN}/${PV}/boot/* ${ROOT}/boot/
cl-kernel --ebuild \
-k /usr/src/linux-${KV_FULL} \
--set cl_kernel_install_path=${ROOT}/
mkdir -p ${ROOT}/lib/firmware
cp -a ${ROOT}/usr/share/${PN}/${PV}/firmware/* ${ROOT}/lib/firmware/
calculate_update_depmod
calculate_update_modules
[[ -f $MODULESDBFILE ]] &&
sed -ri 's/a:1:sys-fs\/aufs2/a:0:sys-fs\/aufs2/' $MODULESDBFILE
}
calculate-kernel-2_pkg_postinst() {
kernel-2_pkg_postinst
KV_OUT_DIR=${ROOT}/usr/src/linux-${KV_FULL}
if ls /usr/share/${PN}/${PV}/boot/ | grep -q System.map
then
cp -p /usr/share/${PN}/${PV}/boot/System.map* ${KV_OUT_DIR}/System.map
fi
cp -p /usr/share/${PN}/${PV}/boot/config* ${KV_OUT_DIR}/.config
cd ${KV_OUT_DIR}
local GENTOOARCH="${ARCH}"
unset ARCH
ebegin "kernel: >> Running oldconfig..."
make oldconfig </dev/null &>/dev/null
eend $? "Failed oldconfig"
ebegin "kernel: >> Running modules_prepare..."
make modules_prepare &>/dev/null
eend $? "Failed modules prepare"
ARCH="${GENTOOARCH}"
use vmlinuz && vmlinuz_pkg_postinst
}

@ -1,168 +0,0 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# Original Author: © 2007-2009 Mir Calculate, Ltd.
# Purpose: Installing linux-desktop, linux-server.
# Build the kernel from source.
inherit calculate eutils kernel-2
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst
IUSE="vmlinuz"
detect_version
detect_arch
if [[ ${KV_MAJOR} -ge 3 ]]
then
CKV=$(get_version_component_range 1-3)
CL_PATCH=$(get_version_component_range 1-2)
local oldifs=${IFS}
export IFS="."
local OKV_ARRAY=( $OKV )
export IFS=${oldifs}
if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
# handle calculate-sources-3.x.y correctly
if [[ ${KV_PATCH} -gt 0 ]]; then
KERNEL_URI="${KERNEL_BASE_URI}/patch-${OKV}.xz"
UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.xz"
fi
KERNEL_URI="${KERNEL_URI} ${KERNEL_BASE_URI}/linux-${KV_MAJOR}.${KV_MINOR}.tar.xz"
else
KERNEL_URI="${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
fi
else
die "Eclass is used only for kernel-3"
fi
SLOT=$(get_version_component_range 1-4)
KV_FULL="${PV}-calculate"
S="${WORKDIR}/linux-${KV_FULL}"
CALC_K_SUBV=.$(get_version_component_range 4)
[[ ${CALC_K_SUBV} == "." ]] && CALC_K_SUBV=
EXTRAVERSION="${CALC_K_SUBV}-calculate"
UNIPATCH_STRICTORDER=1
CALC_URI="ftp://ftp.calculate.ru/pub/calculate/${PN}/${PN}-${CL_PATCH}.tar.bz2
ftp://ftp.calculate-linux.org/pub/calculate/${PN}/${PN}-${CL_PATCH}.tar.bz2
http://mirror.yandex.ru/calculate/${PN}/${PN}-${CL_PATCH}.tar.bz2
ftp://ftp.linux.kiev.ua/pub/Linux/Calculate/${PN}/${PN}-${CL_PATCH}.tar.bz2"
if [[ -n $LONGTERM ]];then
if [[ $KERNEL_URI =~ ^(.*)(kernel/v3.0/patch)(.*)$ ]];then
KERNEL_URI="${BASH_REMATCH[1]}kernel/v3.0/longterm/v${CKV}/patch${BASH_REMATCH[3]}"
fi
fi
calculate-kernel-3_pkg_setup() {
kernel-2_pkg_setup
ewarn "!!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!"
ewarn "After the kernel assemble perform command to update modules:"
ewarn " module-rebuild -X rebuild"
ebeep 5
}
calculate-kernel-3_src_unpack() {
kernel-2_src_unpack
}
vmlinuz_src_compile() {
# disable sandbox
export SANDBOX_ON=0
export LDFLAGS=""
local GENTOOARCH="${ARCH}"
unset ARCH
cd ${S}
DEFAULT_KERNEL_SOURCE="${S}" CMD_KERNEL_DIR="${S}" cl-kernel \
--ebuild \
${CL_KERNEL_OPTS} \
--kerneldir=${S} \
--set cl_kernel_cache_path=${WORKDIR}/cache \
--set cl_kernel_temp_path=${S}/temp \
--set cl_kernel_install_path=${WORKDIR} \
--mrproper || die "kernel build failed"
make distclean &>/dev/null || die "cannot perform distclean"
ARCH="${GENTOOARCH}"
rm ${WORKDIR}/lib/modules/${KV_FULL}/build
rm ${WORKDIR}/lib/modules/${KV_FULL}/source
}
calculate-kernel-3_src_compile() {
use vmlinuz && vmlinuz_src_compile
}
vmlinuz_src_install() {
cd ${WORKDIR}/lib
insinto /lib
doins -r modules
insinto /usr/share/${PN}/${PV}
doins -r firmware
cd ${WORKDIR}
doins -r boot
dosym /usr/src/linux-${KV_FULL} \
"/lib/modules/${KV_FULL}/source" ||
die "cannot install source symlink"
dosym /usr/src/linux-${KV_FULL} \
"/lib/modules/${KV_FULL}/build" ||
die "cannot install build symlink"
insinto /etc/modprobe.d
}
calculate-kernel-3_src_install() {
kernel-2_src_install
dodir /usr/share/${PN}/${PV}/boot
use vmlinuz && vmlinuz_src_install
if ! use vmlinuz
then
local configname=$(cl-kernel -v --filter cl_kernel_config | \
sed -nr 's/.*\[.\]\s//p')
[[ -n $configname ]] &&
cp $configname ${D}/usr/share/${PN}/${PV}/boot/config-${KV_FULL}
fi
}
vmlinuz_pkg_postinst() {
cp -p /usr/share/${PN}/${PV}/boot/* ${ROOT}/boot/
cl-kernel --ebuild \
-k /usr/src/linux-${KV_FULL} \
--set cl_kernel_install_path=${ROOT}/
mkdir -p ${ROOT}/lib/firmware
cp -a ${ROOT}/usr/share/${PN}/${PV}/firmware/* ${ROOT}/lib/firmware/
calculate_update_depmod
calculate_update_modules
[[ -f $MODULESDBFILE ]] &&
sed -ri 's/a:1:sys-fs\/aufs2/a:0:sys-fs\/aufs2/' $MODULESDBFILE
}
calculate-kernel-3_pkg_postinst() {
kernel-2_pkg_postinst
KV_OUT_DIR=${ROOT}/usr/src/linux-${KV_FULL}
if ls /usr/share/${PN}/${PV}/boot/ | grep -q System.map
then
cp -p /usr/share/${PN}/${PV}/boot/System.map* ${KV_OUT_DIR}/System.map
fi
cp -p /usr/share/${PN}/${PV}/boot/config* ${KV_OUT_DIR}/.config
cd ${KV_OUT_DIR}
local GENTOOARCH="${ARCH}"
unset ARCH
ebegin "kernel: >> Running oldconfig..."
make oldconfig </dev/null &>/dev/null
eend $? "Failed oldconfig"
ebegin "kernel: >> Running modules_prepare..."
make modules_prepare &>/dev/null
eend $? "Failed modules prepare"
ARCH="${GENTOOARCH}"
use vmlinuz && vmlinuz_pkg_postinst
}

@ -1,212 +0,0 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# Original Author: © 2007-2009 Mir Calculate, Ltd.
# Purpose: Installing linux-desktop, linux-server.
# Build the kernel from source.
inherit calculate eutils kernel-2
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst
IUSE="vmlinuz minimal"
REQUIRED_USE="minimal? ( vmlinuz )"
detect_version
detect_arch
if [[ ${KV_MAJOR} -ge 3 ]]
then
CKV=$(get_version_component_range 1-3)
CL_PATCH=$(get_version_component_range 1-2)
local oldifs=${IFS}
export IFS="."
local OKV_ARRAY=( $OKV )
export IFS=${oldifs}
if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
# handle calculate-sources-3.x.y correctly
if [[ ${KV_PATCH} -gt 0 ]]; then
KERNEL_URI="${KERNEL_BASE_URI}/patch-${OKV}.xz"
UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.xz"
fi
KERNEL_URI="${KERNEL_URI} ${KERNEL_BASE_URI}/linux-${KV_MAJOR}.${KV_MINOR}.tar.xz"
else
KERNEL_URI="${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
fi
else
die "Eclass is used only for kernel-3"
fi
SLOT=$(get_version_component_range 1-4)
KV_FULL="${PV}-calculate"
S="${WORKDIR}/linux-${KV_FULL}"
CALC_K_SUBV=.$(get_version_component_range 4)
[[ ${CALC_K_SUBV} == "." ]] && CALC_K_SUBV=
EXTRAVERSION="${CALC_K_SUBV}-calculate"
UNIPATCH_STRICTORDER=1
CALC_URI="ftp://ftp.calculate.ru/pub/calculate/${PN}/${PN}-${CL_PATCH}.tar.bz2
ftp://ftp.calculate-linux.org/pub/calculate/${PN}/${PN}-${CL_PATCH}.tar.bz2
http://mirror.yandex.ru/calculate/${PN}/${PN}-${CL_PATCH}.tar.bz2
ftp://ftp.linux.kiev.ua/pub/Linux/Calculate/${PN}/${PN}-${CL_PATCH}.tar.bz2"
if [[ -n $LONGTERM ]];then
if [[ $KERNEL_URI =~ ^(.*)(kernel/v3.0/patch)(.*)$ ]];then
KERNEL_URI="${BASH_REMATCH[1]}kernel/v3.0/longterm/v${CKV}/patch${BASH_REMATCH[3]}"
fi
fi
calculate-kernel-4_pkg_setup() {
kernel-2_pkg_setup
ewarn "!!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!"
ewarn "After the kernel assemble perform command to update modules:"
ewarn " module-rebuild -X rebuild"
ebeep 5
}
calculate-kernel-4_src_unpack() {
kernel-2_src_unpack
}
vmlinuz_src_compile() {
# disable sandbox
export SANDBOX_ON=0
export LDFLAGS=""
local GENTOOARCH="${ARCH}"
unset ARCH
cd ${S}
DEFAULT_KERNEL_SOURCE="${S}" CMD_KERNEL_DIR="${S}" cl-kernel \
--ebuild \
${CL_KERNEL_OPTS} \
--kerneldir=${S} \
--set cl_kernel_cache_path=${WORKDIR}/cache \
--set cl_kernel_temp_path=${S}/temp \
--set cl_kernel_install_path=${WORKDIR} \
--mrproper || die "kernel build failed"
make distclean &>/dev/null || die "cannot perform distclean"
ARCH="${GENTOOARCH}"
rm ${WORKDIR}/lib/modules/${KV_FULL}/build
rm ${WORKDIR}/lib/modules/${KV_FULL}/source
}
calculate-kernel-4_src_compile() {
use vmlinuz && vmlinuz_src_compile
}
vmlinuz_src_install() {
cd ${WORKDIR}/lib
insinto /lib
doins -r modules
insinto /usr/share/${PN}/${PV}
doins -r firmware
cd ${WORKDIR}
doins -r boot
dosym /usr/src/linux-${KV_FULL} \
"/lib/modules/${KV_FULL}/source" ||
die "cannot install source symlink"
dosym /usr/src/linux-${KV_FULL} \
"/lib/modules/${KV_FULL}/build" ||
die "cannot install build symlink"
insinto /etc/modprobe.d
}
calculate-kernel-4_src_install() {
if use minimal
then
local configname=$(cl-kernel -v --filter cl_kernel_config$ | \
sed -nr 's/.*\[.\]\s//p')
cp $configname .config
local GENTOOARCH="${ARCH}"
unset ARCH
ebegin "kernel: >> Running oldconfig..."
make oldconfig </dev/null &>/dev/null
eend $? "Failed oldconfig"
ebegin "kernel: >> Running modules_prepare..."
make modules_prepare &>/dev/null
eend $? "Failed modules prepare"
ARCH="${GENTOOARCH}"
einfo "Cleaning sources"
for rmpath in $(ls arch | grep -v x86)
do
rm -r arch/$rmpath
done
KEEPLIST="scripts/Makefile.lib scripts/module-common.lds \
scripts/gcc-version.sh scripts/Makefile.help \
scripts/Makefile.modinst scripts/Makefile.asm-generic \
scripts/Makefile.modbuiltin scripts/Makefile.fwinst \
scripts/depmod.sh scripts/Makefile.host \
scripts/Kbuild.include scripts/Makefile.modpost \
scripts/gcc-goto.sh scripts/Makefile.headersinst \
scripts/Makefile.build scripts/basic/fixdep \
scripts/Makefile.clean scripts/mod/modpost \
include/config/kernel.release include/config/auto.conf \
arch/x86/Makefile_32.cpu arch/x86/Makefile \
System.map Makefile Kbuild"
find . -type f -a \! -wholename ./.config \
$(echo $KEEPLIST | sed -r 's/(\S+)(\s|$)/-a \! -wholename .\/\1 /g') \
-a \! -name "*.h" -delete
rm -r drivers
rm -r Documentation
fi
kernel-2_src_install
dodir /usr/share/${PN}/${PV}/boot
use vmlinuz && vmlinuz_src_install
if ! use vmlinuz
then
local configname=$(cl-kernel -v --filter cl_kernel_config$ | \
sed -nr 's/.*\[.\]\s//p')
[[ -n $configname ]] &&
cp $configname ${D}/usr/share/${PN}/${PV}/boot/config-${KV_FULL}
fi
}
vmlinuz_pkg_postinst() {
cp -p /usr/share/${PN}/${PV}/boot/* ${ROOT}/boot/
cl-kernel --ebuild \
-k /usr/src/linux-${KV_FULL} \
--set cl_kernel_install_path=${ROOT}/
mkdir -p ${ROOT}/lib/firmware
cp -a ${ROOT}/usr/share/${PN}/${PV}/firmware/* ${ROOT}/lib/firmware/
calculate_update_depmod
calculate_update_modules
[[ -f $MODULESDBFILE ]] &&
sed -ri 's/a:1:sys-fs\/aufs2/a:0:sys-fs\/aufs2/' $MODULESDBFILE
}
calculate-kernel-4_pkg_postinst() {
kernel-2_pkg_postinst
KV_OUT_DIR=${ROOT}/usr/src/linux-${KV_FULL}
if ls /usr/share/${PN}/${PV}/boot/ | grep -q System.map
then
cp -p /usr/share/${PN}/${PV}/boot/System.map* ${KV_OUT_DIR}/System.map
fi
cp -p /usr/share/${PN}/${PV}/boot/config* ${KV_OUT_DIR}/.config
cd ${KV_OUT_DIR}
if ! use minimal
then
local GENTOOARCH="${ARCH}"
unset ARCH
ebegin "kernel: >> Running oldconfig..."
make oldconfig </dev/null &>/dev/null
eend $? "Failed oldconfig"
ebegin "kernel: >> Running modules_prepare..."
make modules_prepare &>/dev/null
eend $? "Failed modules prepare"
ARCH="${GENTOOARCH}"
fi
use vmlinuz && vmlinuz_pkg_postinst
}

@ -0,0 +1,163 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# Original Author: © 2007-2009 Mir Calculate, Ltd.
# Purpose: Installing linux-desktop, linux-server.
# Build the kernel from source.
inherit calculate eutils kernel-2
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst
IUSE="vmlinuz minimal"
REQUIRED_USE="minimal? ( vmlinuz )"
RDEPEND="sys-kernel/dracut"
detect_version
detect_arch
if [[ ${KV_MAJOR} -lt 3 ]]
then
die "Eclass is used only for kernel-3"
fi
SLOT=${PV}
EXTRAVERSION="-calculate"
KV_FULL="${PV}${EXTRAVERSION}"
S="${WORKDIR}/linux-${KV_FULL}"
calculate-kernel-6_pkg_setup() {
kernel-2_pkg_setup
eqawarn "!!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!"
eqawarn "After the kernel assemble perform command to update modules:"
eqawarn " emerge @modules-rebuild"
}
calculate-kernel-6_src_unpack() {
kernel-2_src_unpack
}
vmlinuz_src_compile() {
# disable sandbox
local GENTOOARCH="${ARCH}"
unset ARCH
cd ${S}
emake && emake modules || die "kernel build failed"
[ -f .config ] && cp .config .config.save
ARCH="${GENTOOARCH}"
}
calculate-kernel-6_src_compile() {
use vmlinuz && vmlinuz_src_compile
}
vmlinuz_src_install() {
# dracut change this files in chroot of ramdisk
SANDBOX_WRITE="${SANDBOX_WRITE}:/etc/ld.so.cache~:/etc/ld.so.cache:/etc/mtab"
cd ${S}
dodir /usr/share/${PN}/${PV}/boot
INSTALL_PATH=${D}/usr/share/${PN}/${PV}/boot emake install
INSTALL_MOD_PATH=${D} emake modules_install
/sbin/depmod -b ${D} ${KV_FULL}
/usr/bin/dracut -a calculate -k ${D}/lib/modules/${KV_FULL} \
--kver ${KV_FULL} \
${D}/usr/share/${PN}/${PV}/boot/initramfs-${KV_FULL}
# move firmware to share, because /lib/firmware installation does collisions
mv ${D}/lib/firmware ${D}/usr/share/${PN}/${PV}
insinto /usr/share/${PN}/${PV}/boot/
newins .config config-${KV_FULL}
# recreate symlink in /lib/modules because symlink point to tmp/portage after make install
rm ${D}/lib/modules/${KV_FULL}/build
rm ${D}/lib/modules/${KV_FULL}/source
dosym /usr/src/linux-${KV_FULL} \
"/lib/modules/${KV_FULL}/source" ||
die "cannot install source symlink"
dosym /usr/src/linux-${KV_FULL} \
"/lib/modules/${KV_FULL}/build" ||
die "cannot install build symlink"
}
# FUNCTION: clean_for_minimal
# DESCRIPTION:
# Clear kernel sources, keeping only need for custom modules compilation
clean_for_minimal() {
local GENTOOARCH="${ARCH}"
unset ARCH
ARCH="${GENTOOARCH}"
emake distclean &>/dev/null || die "cannot perform distclean"
mv .config.save .config
ebegin "kernel: >> Running modules_prepare..."
emake modules_prepare &>/dev/null
eend $? "Failed modules prepare"
einfo "Cleaning sources"
for rmpath in $(ls arch | grep -v x86)
do
rm -r arch/$rmpath
done
KEEPLIST="scripts/Makefile.lib scripts/module-common.lds \
scripts/gcc-version.sh scripts/Makefile.help \
scripts/Makefile.modinst scripts/Makefile.asm-generic \
scripts/Makefile.modbuiltin scripts/Makefile.fwinst \
scripts/depmod.sh scripts/Makefile.host \
scripts/Kbuild.include scripts/Makefile.modpost \
scripts/gcc-goto.sh scripts/Makefile.headersinst \
scripts/Makefile.build scripts/basic/fixdep \
scripts/Makefile.clean scripts/mod/modpost \
include/config/kernel.release include/config/auto.conf \
arch/x86/Makefile_32.cpu arch/x86/Makefile \
System.map Makefile Kbuild"
find . -type f -a \! -wholename ./.config \
$(echo $KEEPLIST | sed -r 's/(\S+)(\s|$)/-a \! -wholename .\/\1 /g') \
-a \! -name "*.h" -delete
rm -r drivers
rm -r Documentation
}
calculate-kernel-6_src_install() {
use vmlinuz && vmlinuz_src_install
use minimal && clean_for_minimal
kernel-2_src_install
if ! use vmlinuz
then
cp .config ${D}/usr/share/${PN}/${PV}/boot/config-${KV_FULL}
fi
}
vmlinuz_pkg_postinst() {
# install kernel into /boot
calculate_update_ver /boot vmlinuz ${KV_FULL} /usr/share/${PN}/${PV}/boot/vmlinuz-${KV_FULL}
calculate_update_ver /boot config ${KV_FULL} /usr/share/${PN}/${PV}/boot/config-${KV_FULL}
calculate_update_ver /boot initramfs ${KV_FULL} /usr/share/${PN}/${PV}/boot/initramfs-${KV_FULL}
calculate_update_ver /boot System.map ${KV_FULL} /usr/share/${PN}/${PV}/boot/System.map-${KV_FULL}
# install firmware into /
mkdir -p ${ROOT}/lib/firmware
cp -a ${ROOT}/usr/share/${PN}/${PV}/firmware/* ${ROOT}/lib/firmware/
calculate_update_depmod
calculate_update_modules
}
calculate-kernel-6_pkg_postinst() {
kernel-2_pkg_postinst
KV_OUT_DIR=${ROOT}/usr/src/linux-${KV_FULL}
use vmlinuz && cp -p /usr/share/${PN}/${PV}/boot/System.map* ${KV_OUT_DIR}/System.map
if ! use minimal
then
cd ${KV_OUT_DIR}
local GENTOOARCH="${ARCH}"
unset ARCH
ebegin "kernel: >> Running modules_prepare..."
(emake oldconfig && emake modules_prepare) &>/dev/null
eend $? "Failed modules prepare"
ARCH="${GENTOOARCH}"
fi
use vmlinuz && vmlinuz_pkg_postinst
use vmlinuz && calculate_fix_lib_modules_contents
}

@ -1,177 +0,0 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# Original Author: © 2007-2009 Mir Calculate, Ltd.
# Purpose: Installing linux-desktop, linux-server.
# Build the kernel from source.
inherit calculate eutils kernel-2
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst
IUSE="vmlinuz"
detect_version
detect_arch
CKV=$(get_version_component_range 1-3)
SLOT=$(get_version_component_range 1-4)
KV_FULL="${PV}-calculate"
S="${WORKDIR}/linux-${KV_FULL}"
EXTRAVERSION="-calculate"
CALC_K_SUBV=.$(get_version_component_range 4)
[[ ${CALC_K_SUBV} == "." ]] && CALC_K_SUBV=
EXTRAVERSION="${CALC_K_SUBV}-calculate"
UNIPATCH_STRICTORDER=1
CALC_URI="ftp://ftp.calculate.ru/pub/calculate/${PN}/${PN}-${CKV}.tar.bz2
ftp://ftp.calculate-linux.org/pub/calculate/${PN}/${PN}-${CKV}.tar.bz2
http://mirror.yandex.ru/calculate/${PN}/${PN}-${CKV}.tar.bz2
ftp://ftp.linux.kiev.ua/pub/Linux/Calculate/${PN}/${PN}-${CKV}.tar.bz2"
NEW_CALCULATE_OVERLAY="/var/lib/layman/calculate"
[[ -d ${ROOT}/${NEW_CALCULATE_OVERLAY} ]] &&
CALCULATE_OVERLAY=${NEW_CALCULATE_OVERLAY} ||
CALCULATE_OVERLAY="/usr/local/portage/layman/calculate"
MODULESDBFILE=${ROOT}/var/lib/module-rebuild/moduledb
calculate-kernel-old_pkg_setup() {
kernel-2_pkg_setup
local calculate_ini=${ROOT}/etc/calculate/calculate.ini
[[ -e $calculate_ini ]] && \
SYSTEM=$( sed -rn 's/^system\=(.*)/\1/p' $calculate_ini )
[[ -n "$SYSTEM" ]] || SYSTEM=desktop
if [[ -z "${KERNEL_CONFIG}" ]] || [[ ! -f "${KERNEL_CONFIG}" ]]
then
KERNEL_CONFIG="${ROOT}/${CALCULATE_OVERLAY}/profiles/kernel"
[[ -n "$CARCH" ]] || CARCH=`arch`
KERNEL_CONFIG="${KERNEL_CONFIG}/config-${SYSTEM}-${CARCH}-${CKV}"
fi
ewarn "After the kernel assemble perform command to update modules:"
ewarn " module-rebuild -X rebuild"
ebeep 5
}
calculate-kernel-old_src_unpack() {
kernel-2_src_unpack
}
vmlinuz_src_compile() {
# disable sandbox
export SANDBOX_ON=0
export LDFLAGS=""
mkdir -p ${WORKDIR}/boot
cd ${S}
einfo "Using kernel config from "$( readlink -f ${KERNEL_CONFIG} )
cp ${KERNEL_CONFIG} ${WORKDIR}/config || die "cannot copy kernel config"
cp ${WORKDIR}/config ${S}/.config
local GENTOOARCH="${ARCH}"
unset ARCH
DEFAULT_KERNEL_SOURCE="${S}" CMD_KERNEL_DIR="${S}" genkernel \
--kerneldir=${S} \
--kernel-config=${WORKDIR}/config \
--cachedir=${WORKDIR}/cache \
--makeopts=${MAKEOPTS} \
--tempdir=${S}/temp \
--logfile=${WORKDIR}/genkernel.log \
--bootdir=${WORKDIR}/boot \
--no-save-config \
--kernname=${SYSTEM} \
--no-menuconfig \
--clean \
--loglevel=2 \
--mrproper \
--no-cleartmp \
--disklabel \
--slowusb \
--splash=tty1 \
--all-ramdisk-modules \
--unionfs \
--module-prefix=${WORKDIR} \
all || die "genkernel failed"
cp ${S}/.config ${WORKDIR}/boot/config-${KV_FULL}-installed
einfo "kernel: >> Distclean..."
make distclean &>/dev/null || die "cannot perform distclean"
ARCH="${GENTOOARCH}"
mv ${WORKDIR}/boot/kernel-${SYSTEM}-*-${KV_FULL} \
${WORKDIR}/boot/vmlinuz-${KV_FULL}-installed
mv ${WORKDIR}/boot/initramfs-${SYSTEM}-*-${KV_FULL} \
${WORKDIR}/boot/initramfs-${KV_FULL}-installed
mv ${WORKDIR}/boot/System.map-${SYSTEM}-*-${KV_FULL} \
${WORKDIR}/boot/System.map-${KV_FULL}-installed
cp ${WORKDIR}/boot/System.map-${KV_FULL}-installed ${S}/System.map
rm ${WORKDIR}/lib/modules/${KV_FULL}/build
rm ${WORKDIR}/lib/modules/${KV_FULL}/source
}
calculate-kernel-old_src_compile() {
use vmlinuz && vmlinuz_src_compile
}
vmlinuz_src_install() {
cd ${WORKDIR}
insinto /
doins -r boot
cd ${WORKDIR}/lib
insinto /lib
doins -r modules
insinto /tmp
doins -r firmware
dosym /usr/src/linux-${KV_FULL} \
"/lib/modules/${KV_FULL}/source" ||
die "cannot install source symlink"
dosym /usr/src/linux-${KV_FULL} \
"/lib/modules/${KV_FULL}/build" ||
die "cannot install build symlink"
insinto /etc/modprobe.d
newins "${FILESDIR}"/modprobe_i915.conf i915.conf || die
}
calculate-kernel-old_src_install() {
kernel-2_src_install
use vmlinuz && vmlinuz_src_install
}
vmlinuz_pkg_postinst() {
calculate_update_splash ${ROOT}/boot/initramfs-${KV_FULL}-installed
cp ${ROOT}/boot/initramfs-${KV_FULL}-installed \
${ROOT}/boot/initramfs-${KV_FULL}-install-installed
calculate_update_kernel ${KV_FULL} ${ROOT}/boot
mkdir -p ${ROOT}/lib/firmware
cp -a ${ROOT}/tmp/firmware/* ${ROOT}/lib/firmware/
rm -rf ${ROOT}/tmp/firmware
calculate_update_depmod
calculate_update_modules
[[ -f $MODULESDBFILE ]] &&
sed -ri 's/a:1:sys-fs\/aufs2/a:0:sys-fs\/aufs2/' $MODULESDBFILE
}
calculate-kernel-old_pkg_postinst() {
kernel-2_pkg_postinst
KV_OUT_DIR=${ROOT}/usr/src/linux-${KV_FULL}
[[ -e ${ROOT}/boot/config-${KV_FULL}-installed ]] &&
cp ${ROOT}/boot/config-${KV_FULL}-installed ${KV_OUT_DIR}/.config ||
cp ${KERNEL_CONFIG} ${KV_OUT_DIR}/.config
cd ${KV_OUT_DIR}
local GENTOOARCH="${ARCH}"
unset ARCH
ebegin "kernel: >> Running modules_prepare..."
make modules_prepare &>/dev/null
eend $? "Failed modules prepare"
ARCH="${GENTOOARCH}"
use vmlinuz && vmlinuz_pkg_postinst
}

@ -1,208 +0,0 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# Original Author: © 2007-2009 Mir Calculate, Ltd.
# Purpose: Installing linux-desktop, linux-server.
# Build the kernel from source.
inherit calculate eutils kernel-2
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst
IUSE="vmlinuz"
detect_version
detect_arch
CKV=$(get_version_component_range 1-3)
SLOT=$(get_version_component_range 1-4)
KV_FULL="${PV}-calculate"
S="${WORKDIR}/linux-${KV_FULL}"
CALC_K_SUBV=.$(get_version_component_range 4)
[[ ${CALC_K_SUBV} == "." ]] && CALC_K_SUBV=
EXTRAVERSION="${CALC_K_SUBV}-calculate"
UNIPATCH_STRICTORDER=1
CALC_URI="ftp://ftp.calculate.ru/pub/calculate/${PN}/${PN}-${CKV}.tar.bz2
ftp://ftp.calculate-linux.org/pub/calculate/${PN}/${PN}-${CKV}.tar.bz2
http://mirror.yandex.ru/calculate/${PN}/${PN}-${CKV}.tar.bz2
ftp://ftp.linux.kiev.ua/pub/Linux/Calculate/${PN}/${PN}-${CKV}.tar.bz2"
NEW_CALCULATE_OVERLAY="/var/lib/layman/calculate"
[[ -d ${ROOT}/${NEW_CALCULATE_OVERLAY} ]] &&
CALCULATE_OVERLAY=${NEW_CALCULATE_OVERLAY} ||
CALCULATE_OVERLAY="/usr/local/portage/layman/calculate"
MODULESDBFILE=${ROOT}/var/lib/module-rebuild/moduledb
if [[ -n $LONGTERM ]];then
if [[ $KERNEL_URI =~ ^(.*)(kernel/v2.6/patch)(.*)$ ]];then
KERNEL_URI="${BASH_REMATCH[1]}kernel/v2.6/longterm/v${CKV}/patch${BASH_REMATCH[3]}"
fi
fi
calculate-kernel_pkg_setup() {
kernel-2_pkg_setup
local calculate_ini=${ROOT}/etc/calculate/calculate.ini
[[ -e $calculate_ini ]] && \
SYSTEM=$( sed -rn 's/^system\=(.*)/\1/p' $calculate_ini )
[[ -n "$SYSTEM" ]] || SYSTEM=desktop
if [[ -z "${KERNEL_CONFIG}" ]] || [[ ! -f "${KERNEL_CONFIG}" ]]
then
KERNEL_CONFIG="${ROOT}/${CALCULATE_OVERLAY}/profiles/kernel"
[[ -n "$CARCH" ]] || CARCH=`arch`
KERNEL_CONFIG="${KERNEL_CONFIG}/config-${SYSTEM}-${CARCH}-${CKV}"
fi
ewarn "After the kernel assemble perform command to update modules:"
ewarn " module-rebuild -X rebuild"
ebeep 5
}
calculate-kernel_src_unpack() {
kernel-2_src_unpack
}
vmlinuz_src_compile() {
# disable sandbox
export SANDBOX_ON=0
export LDFLAGS=""
mkdir -p ${WORKDIR}/boot
cd ${S}
einfo "Using kernel config from "$( readlink -f ${KERNEL_CONFIG} )
cp ${KERNEL_CONFIG} ${WORKDIR}/config || die "cannot copy kernel config"
cp ${WORKDIR}/config ${S}/.config
local GENTOOARCH="${ARCH}"
unset ARCH
DEFAULT_KERNEL_SOURCE="${S}" CMD_KERNEL_DIR="${S}" genkernel \
--kerneldir=${S} \
--kernel-config=${WORKDIR}/config \
--cachedir=${WORKDIR}/cache \
--makeopts=${MAKEOPTS} \
--tempdir=${S}/temp \
--logfile=${WORKDIR}/genkernel.log \
--bootdir=${WORKDIR}/boot \
--no-save-config \
--kernname=${SYSTEM} \
--no-menuconfig \
--clean \
--loglevel=2 \
--mrproper \
--no-cleartmp \
--disklabel \
--slowusb \
--splash=tty1 \
--all-ramdisk-modules \
--unionfs \
--module-prefix=${WORKDIR} \
all || die "genkernel failed"
OLDARCH=`arch`
NAMESUFFIX=${PV}-${OLDARCH}-$(detect_linux_shortname)
cp ${S}/.config ${WORKDIR}/boot/config-${NAMESUFFIX}-installed
einfo "kernel: >> Distclean..."
make distclean &>/dev/null || die "cannot perform distclean"
ARCH="${GENTOOARCH}"
mv ${WORKDIR}/boot/kernel-${SYSTEM}-*-${KV_FULL} \
${WORKDIR}/boot/vmlinuz-${NAMESUFFIX}-installed
mv ${WORKDIR}/boot/initramfs-${SYSTEM}-*-${KV_FULL} \
${WORKDIR}/boot/initramfs-${NAMESUFFIX}-installed
mv ${WORKDIR}/boot/System.map-${SYSTEM}-*-${KV_FULL} \
${WORKDIR}/boot/System.map-${NAMESUFFIX}-installed
cp ${WORKDIR}/boot/System.map-${NAMESUFFIX}-installed ${S}/System.map
rm ${WORKDIR}/lib/modules/${KV_FULL}/build
rm ${WORKDIR}/lib/modules/${KV_FULL}/source
}
calculate-kernel_src_compile() {
use vmlinuz && vmlinuz_src_compile
}
vmlinuz_src_install() {
cd ${WORKDIR}
insinto /
doins -r boot
cd ${WORKDIR}/lib
insinto /lib
doins -r modules
insinto /tmp
doins -r firmware
dosym /usr/src/linux-${KV_FULL} \
"/lib/modules/${KV_FULL}/source" ||
die "cannot install source symlink"
dosym /usr/src/linux-${KV_FULL} \
"/lib/modules/${KV_FULL}/build" ||
die "cannot install build symlink"
insinto /etc/modprobe.d
newins "${FILESDIR}"/modprobe_i915.conf i915.conf || die
}
calculate-kernel_src_install() {
kernel-2_src_install
use vmlinuz && vmlinuz_src_install
}
# FUNCTION: change_kernel_in_grub
# DESCRIPTION:
# Change kernel version in grub
change_kernel_in_grub() {
[[ -f /boot/vmlinuz-${NAMESUFFIX} ]] &&
[[ -f /boot/initramfs-${NAMESUFFIX} ]] &&
[[ -f /boot/initramfs-${NAMESUFFIX}-install ]] &&
[[ -f /boot/grub/grub.conf ]] &&
sed -ri "/^title/{ #find title in grub.conf
:readnextline;N; #read next line
s/\ninitrd/&/; #if pattern not contents initrd
Treadnextline; #goto read next line
:changemenuitem; #else try change menuitem
s|root=${ROOTDEV}|&|; #if menuitem not for the system
Tskipmenuitem; #then skip menuitem
s|(/boot/vmlinuz)[^ ]+|\1-${NAMESUFFIX}|; #else change vmlinuz
s|initrd (.*)-install$|initrd \1/install|; #hide '-install'
s|(/boot/initramfs)[^ /]+|\1-${NAMESUFFIX}|; #change initramfs
s|/install$|-install|; #show '-install'
:skipmenuitem;
}" /boot/grub/grub.conf
}
vmlinuz_pkg_postinst() {
calculate_update_splash ${ROOT}/boot/initramfs-${NAMESUFFIX}-installed
cp ${ROOT}/boot/initramfs-${NAMESUFFIX}-installed \
${ROOT}/boot/initramfs-${NAMESUFFIX}-install-installed
calculate_update_kernel ${NAMESUFFIX} ${ROOT}/boot
mkdir -p ${ROOT}/lib/firmware
cp -a ${ROOT}/tmp/firmware/* ${ROOT}/lib/firmware/
rm -rf ${ROOT}/tmp/firmware
calculate_update_depmod
calculate_update_modules
[[ -f $MODULESDBFILE ]] &&
sed -ri 's/a:1:sys-fs\/aufs2/a:0:sys-fs\/aufs2/' $MODULESDBFILE
calculate_initvars
change_kernel_in_grub
}
calculate-kernel_pkg_postinst() {
kernel-2_pkg_postinst
KV_OUT_DIR=${ROOT}/usr/src/linux-${KV_FULL}
[[ -e ${ROOT}/boot/config-${NAMESUFFIX}-installed ]] &&
cp ${ROOT}/boot/config-${NAMESUFFIX}-installed ${KV_OUT_DIR}/.config ||
cp ${KERNEL_CONFIG} ${KV_OUT_DIR}/.config
cd ${KV_OUT_DIR}
local GENTOOARCH="${ARCH}"
unset ARCH
ebegin "kernel: >> Running modules_prepare..."
make modules_prepare &>/dev/null
eend $? "Failed modules prepare"
ARCH="${GENTOOARCH}"
use vmlinuz && vmlinuz_pkg_postinst
}

@ -50,6 +50,10 @@ app-cdr/cdrtools amd64 x86
=app-crypt/shim-signed-0.2 amd64 x86
~app-crypt/sbsigntool-0.6 amd64 x86
# need for dracut
~sys-process/procps-3.3.9 amd64 x86
~sys-kernel/dracut-034 amd64 x86
~app-emulation/emul-linux-x86-bjdeps-0.1 amd64 x86
~app-emulation/emul-linux-x86-baselibs-20131008 amd64 x86

@ -1,327 +1,14 @@
# vim: set syntax=sh
# Automatic patching.
# put PATCH_OVERLAY=/path/to/patches into make.conf and then put patches into
# $PATCH_OVERLAY/cate-gory/package/
#
# As I know history: Initial idea from solar, later
# Ed Catmur added support autoreconf calls then pva rewritten everything...
# Added interval check for version and run .sh hooks by Calculate
# don't setup packages by cl-core
check_skip() {
declare -A SKIPPKGS=(
["calculate-install"]="1"
["calculate-lib"]="1"
["calculate-console"]="1"
["calculate-console-gui"]="1"
["calculate-core"]="1"
["calculate-desktop"]="1"
["calculate-client"]="1"
["calculate-update"]="1" )
[[ -z ${SKIPPKGS[$PN]} ]]
}
pkg_checkver() {
PATCH_PV=( `echo $1 | sed 's/[._]/ /g' | sed -r 's/([a-z]+)/ \1 /g'` )
EBUILD_PV=( `echo $2 | sed 's/[._]/ /g' | sed -r 's/([a-z]+)/ \1 /g'` )
for i in $(seq 0 10);
do
# next part of version of patch
if [[ -n ${PATCH_PV[$i]} ]]
then
# if part patch version not equal ebuild version
if [[ ${PATCH_PV[$i]} != ${EBUILD_PV[$i]} ]]
then
# is pv in patch interval
if [[ ${PATCH_PV[$i]} =~ ^([0-9]+)-([0-9]+)$ ]]
then
# check version of ebuild not in interval
if [[ ${EBUILD_PV[$i]} -lt ${BASH_REMATCH[1]} ||
${EBUILD_PV[$i]} -gt ${BASH_REMATCH[2]} ]]
then
return 1
fi
# pv not interval
else
return 1
fi
fi
else
return 0
fi
done
return 0
}
pkg_try2apply() {
local patch=${1}
for l in `seq 0 4`; do
patch -g0 --dry-run -p${l} >/dev/null < "${patch}"
if [ $? = 0 ]; then
echo "auto patching succeeded (-p${l}) ${patch}" > "${S}/.$(basename ${patch})"
#patch -g0 -p${l} < "${patch}" && return 0
patch -g0 -p${l} < "${patch}" > /dev/null && return 0
fi
done
return 1
}
apecho() {
:
#echo "AP: ${@}"
}
pkg_pick_patches() {
apecho " * entering pick_patches ${1}"
pushd "${1}" > /dev/null 2>&1
local VERSION='(-(cvs[.])?[0-9]+([.][0-9]+(-[0-9]+)?)*[a-z]?(_(pre|p|beta|alpha|rc)[0-9]*)*)?'
for f in *${PN}*; do
[[ ! -e ${f} ]] && continue
apecho " > processing file: ${f}."
if [[ ${f} =~ ^(..-)?${PN}${VERSION}(-r[0-9]+)?(_[0-9a-zA-Z-]+_)?([0-9a-zA-Z_.-]+[.](${patch_extens}))?$ ]]; then
local MATCHED_PV=${BASH_REMATCH[2]/-}
local MATCHED_PR=${BASH_REMATCH[7]/-}
local MATCHED_ARCH=${BASH_REMATCH[8]//_}
local MATCHED_EXT=${BASH_REMATCH[10]}
apecho " | parsed: PV=$MATCHED_PV, PR=$MATCHED_PR, ARCH=$MATCHED_ARCH, ext=$MATCHED_EXT."
if [[ -n ${MATCHED_ARCH} && ( ${MATCHED_ARCH} != ${ARCH} && ${MATCHED_ARCH} != all ) ]]; then
apecho " X ARCH does not match. Skipping..."
continue
fi
if [[ -n ${MATCHED_PR} && ${MATCHED_PR} != ${PR} ]]; then
apecho " X PR does not match. Skipping..."
continue
fi
if [[ -n ${MATCHED_PV} ]] && ! pkg_checkver ${MATCHED_PV} ${PV}; then
apecho " X PV=${MATCHED_PV} does not match. Skipping..."
continue
fi
if [[ -d ${f} ]]; then
apecho " -> $f is a direcrory. Delving..."
pkg_pick_patches ${f}
apecho "<- Back. Continuing..."
continue
elif [[ -z ${MATCHED_EXT} ]]; then
apecho " X Is $f a file without patch|diff extension. Skipping."
continue
fi
apecho " + Adding '$(pwd)/${f}' to patches."
patches=( "${patches[@]}" "$(pwd)/${f}")
fi
done
popd > /dev/null
apecho " < ${patches[@]}"
}
pkgpatch() {
local -a patches=()
local -i runautomake=0 runautoconf=0
[[ ! -d "${PATCH_OVERLAY}/${CATEGORY}" ]] && return 0
# only in precompile phase find patches and hooks
if [[ ${EBUILD_PHASE} == compile ]]; then
local patch_extens="diff|patch|sh"
# in other phases find only hooks
else
local patch_extens="sh"
fi
pkg_pick_patches "${PATCH_OVERLAY}/${CATEGORY}"
apecho " ! GRAND RESULT: ${patches[@]}"
# before unpack phase ${S} yet not present
if ! pushd "${S}" &>/dev/null;then
pushd "`pwd`" >/dev/null
fi
for patch in "${patches[@]}"; do
if [[ $patch =~ \.sh$ ]];
then
source $patch
else
ebegin "Trying to apply $(basename ${patch})"
if pkg_try2apply "${patch}"; then
eend 0
else
eend 1
continue
fi
fi
if grep -E '^[+][+][+][[:space:]]+.*Makefile[.]am[[:space:]]+.*$' "${patch}" >/dev/null; then
einfo "Need to rerun automake"
(( ++runautomake ))
fi
if grep -E '^[+][+][+][[:space:]]+.*configure[.](ac|in)[[:space:]]+.*$' "${patch}">/dev/null; then
einfo "Need to rerun autoconf"
(( ++runautoconf ))
fi
done
if [[ ${runautomake} -gt 0 || ${runautoconf} -gt 0 ]]; then
inherit autotools
fi
if [[ ${runautomake} -gt 0 && ${runautoconf} -gt 0 ]]; then
eautoreconf
elif [[ ${runautomake} -gt 0 ]]; then
eautomake
elif [[ ${runautoconf} -gt 0 ]]; then
eautoconf
fi
popd > /dev/null
}
[ -d /var/db/pkg/sys-apps/calculate-core-3.1.[1-9]* ] && calcver=3.1.1
post_pkg_preinst() {
CL_UPDATE_PROG=/usr/lib/calculate-2.2/calculate-lib/bin/cl-update-config
if [ -e ${CL_UPDATE_PROG} ];then
[[ -z ${CONFIG_PROTECT} && -e /etc/profile ]] && source /etc/profile
CONFIG_PROTECT=${CONFIG_PROTECT} ${CL_UPDATE_PROG} --desktop --system --pkg_version ${PVR} --pkg_category ${CATEGORY} --path ${D} $PN
fi
CL_UPDATE_PROG=/usr/sbin/cl-core-setup
if [ -e ${CL_UPDATE_PROG} ] && [[ -z $calcver ]] && check_skip
then
${CL_UPDATE_PROG} --no-progress --pkg-version ${PVR} --pkg-category ${CATEGORY} --pkg-path ${D} --pkg-name ${PN}
fi
}
post_pkg_postinst() {
if [ -e "${PORTAGE_BUILDDIR}/.patched" ];then
rm -f "${PORTAGE_BUILDDIR}/.patched"
fi
}
pre_pkg_postinst() {
if [[ -n $calcver ]] && check_skip
then
CL_UPDATE_PROG=/usr/sbin/cl-core-setup
if [ -e ${CL_UPDATE_PROG} ];then
CTARGET=${CTARGET} GCC_CONFIG_VER=${GCC_CONFIG_VER} ${CL_UPDATE_PROG} --no-progress --pkg-version ${PVR} --pkg-slot ${SLOT} --pkg-category ${CATEGORY} --pkg-path "/" --pkg-name ${PN}
fi
fi
rm -f /var/lib/calculate/-merge-$PN-*
rm -f /var/lib/calculate/-CONTENTS-*
}
CL_CORE_PATCH=/usr/sbin/cl-core-patch
if [[ ${EBUILD_PHASE} == "compile" ]] && [ -e ${CL_CORE_PATCH} ] &&
[[ -d ${S} ]] && check_skip; then
${CL_CORE_PATCH} --no-progress --pkg-version ${PVR} --pkg-slot ${SLOT} --pkg-category ${CATEGORY} --pkg-path ${S} --pkg-name ${PN} --verbose
else
if [[ `readlink -f /etc/portage/bashrc` != "/usr/calculate/install/bashrc" ]] || [[ ! -f /etc/portage/bashrc ]]
then
PATCH_OVERLAY="/usr/local/portage/layman/calculate/profiles/patches"
[[ -d "/var/lib/layman/calculate/profiles/patches" ]] && \
PATCH_OVERLAY="/var/lib/layman/calculate/profiles/patches"
PATH=${PATH}:/usr/sbin:/usr/bin:/bin:/sbin
if [[ ${EBUILD_PHASE} == compile ]]; then
if [[ ! -f ${PORTAGE_BUILDDIR}/.patched || \
( ${PORTAGE_BUILDDIR}/.unpacked -nt ${PORTAGE_BUILDDIR}/.patched ) ]]; then
touch "${PORTAGE_BUILDDIR}/.patched"
elif [[ "${PORTAGE_BUILDDIR}/.unpacked" -nt "${PORTAGE_BUILDDIR}/.patched" ]]; then
einfo ">>> WORKDIR is up-to-date and patched, keeping..."
fi
fi
pkgpatch
fi
fi
# Update configuration files for package installation
if [[ ${EBUILD_PHASE} == setup ]]; then
userBashrc="/etc/portage/bashrc"
if [[ -f /etc/portage/bashrc ]] &&
grep -q -e "function\s+post_pkg_preinst" -e "post_pkg_preinst\(\)" $userBashrc &&
! grep -q "calculate_post_pkg_preinst" $userBashrc;
then
ewarn ""
ewarn "!!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!"
ewarn "Redeclaration post_pkg_reinst was detected in ${useBashrc}."
ewarn "Remove it for correct package configuration."
inherit eutils
ebeep 5
fi
fi
# added for calculate2.2
# FUNC: change_permissions
# DESC: change permissions for all files and directories into specified
change_permissions() {
local directory=$1
[[ -d $1 ]] || return
# get owner from parent directory
addwrite ${directory}
local dirowner=$(stat -c"%u:%g" ${directory})
local dirmode=0$(stat -c%a ${directory})
# get permissions from parent directory
local dirmode=0$(stat -c%a ${directory})
# turnoff execute for all (permission for files in parent directory)
if which bc &>/dev/null;
then
local filemode=0$(echo "obase=8;$(( $dirmode & 0666 ))" | bc)
elif which printf &>/dev/null;
then
local filemode=$(printf "0%o" $(( $dirmode & 0666 )) )
else
local filemode=
fi
# set for all files and directories dirowner
chown -R ${dirowner} ${directory}
# set permissions for all directories in parent directory
find ${directory} \! -perm ${dirmode} -type d -exec chmod ${dirmode} {} \;
if [[ -n $filemode ]]
then
# set permissions for all files in parent directory
find ${directory} \! -perm ${filemode} -type f -exec chmod ${filemode} {} \;
fi
}
# system has "remote" share
if grep "\[remote\]" /etc/samba/smb.conf &>/dev/null
then
post_src_unpack() {
einfo "Performing permissions change for distdir directory"
change_permissions ${PORTAGE_ACTUAL_DISTDIR}
}
else
post_src_unpack() {
:
}
fi
if grep "\[remote\]" /etc/samba/smb.conf &>/dev/null
then
pre_pkg_preinst() {
einfo "Performing permissions change for packages directory"
change_permissions ${PKGDIR}
}
else
pre_pkg_preinst() {
:
}
fi
# prerm functions
if [[ $EBUILD_PHASE == "preinst" ]]
then
[[ ! -d /var/lib/calculate ]] && mkdir /var/lib/calculate
touch "/var/lib/calculate/-merge-$PN--${SLOT/\//_}-$PPID"
fi
# Copyright 2014 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
if [[ $EBUILD_PHASE == "postrm" ]]
then
if [[ ! -f /var/lib/calculate/-merge-$PN--${SLOT/\//_}-$PPID ]] && check_skip
then
if [[ -n $calcver ]]
then
CL_UPDATE_PROG=/usr/sbin/cl-core-setup
if [ -e ${CL_UPDATE_PROG} ];then
${CL_UPDATE_PROG} --no-progress --pkg-version ${PVR} --pkg-slot ${SLOT} --pkg-category ${CATEGORY} --pkg-path / --pkg-name ${PN}
fi
fi
else
cp /var/db/pkg/${CATEGORY}/${PF}/CONTENTS /var/lib/calculate/-CONTENTS-$PN
fi
rm -f /var/lib/calculate/-merge-$PN-*
fi
for fn in /etc/calculate/profile.bashrc.d/*;do
[[ -f $fn ]] && source ${fn} && PROFILE_BASHRC_D=1
done
[[ -z ${PROFILE_BASHRC_D} ]] && source ${BASH_SOURCE}.old

@ -0,0 +1,345 @@
# vim: set syntax=sh
# Automatic patching.
# put PATCH_OVERLAY=/path/to/patches into make.conf and then put patches into
# $PATCH_OVERLAY/cate-gory/package/
#
# As I know history: Initial idea from solar, later
# Ed Catmur added support autoreconf calls then pva rewritten everything...
# Added interval check for version and run .sh hooks by Calculate
#
# don't setup packages by cl-core
check_skip() {
declare -A SKIPPKGS=(
["calculate-install"]="1"
["calculate-lib"]="1"
["calculate-console"]="1"
["calculate-console-gui"]="1"
["calculate-core"]="1"
["calculate-desktop"]="1"
["calculate-client"]="1"
["calculate-update"]="1" )
[[ -z ${SKIPPKGS[$PN]} ]]
}
pkg_checkver() {
PATCH_PV=( `echo $1 | sed 's/[._]/ /g' | sed -r 's/([a-z]+)/ \1 /g'` )
EBUILD_PV=( `echo $2 | sed 's/[._]/ /g' | sed -r 's/([a-z]+)/ \1 /g'` )
for i in $(seq 0 10);
do
# next part of version of patch
if [[ -n ${PATCH_PV[$i]} ]]
then
# if part patch version not equal ebuild version
if [[ ${PATCH_PV[$i]} != ${EBUILD_PV[$i]} ]]
then
# is pv in patch interval
if [[ ${PATCH_PV[$i]} =~ ^([0-9]+)-([0-9]+)$ ]]
then
# check version of ebuild not in interval
if [[ ${EBUILD_PV[$i]} -lt ${BASH_REMATCH[1]} ||
${EBUILD_PV[$i]} -gt ${BASH_REMATCH[2]} ]]
then
return 1
fi
# pv not interval
else
return 1
fi
fi
else
return 0
fi
done
return 0
}
pkg_try2apply() {
local patch=${1}
for l in `seq 0 4`; do
patch -g0 --dry-run -p${l} >/dev/null < "${patch}"
if [ $? = 0 ]; then
echo "auto patching succeeded (-p${l}) ${patch}" > "${S}/.$(basename ${patch})"
#patch -g0 -p${l} < "${patch}" && return 0
patch -g0 -p${l} < "${patch}" > /dev/null && return 0
fi
done
return 1
}
apecho() {
:
#echo "AP: ${@}"
}
pkg_pick_patches() {
apecho " * entering pick_patches ${1}"
pushd "${1}" > /dev/null 2>&1
local VERSION='(-(cvs[.])?[0-9]+([.][0-9]+(-[0-9]+)?)*[a-z]?(_(pre|p|beta|alpha|rc)[0-9]*)*)?'
for f in *${PN}*; do
[[ ! -e ${f} ]] && continue
apecho " > processing file: ${f}."
if [[ ${f} =~ ^(..-)?${PN}${VERSION}(-r[0-9]+)?(_[0-9a-zA-Z-]+_)?([0-9a-zA-Z_.-]+[.](${patch_extens}))?$ ]]; then
local MATCHED_PV=${BASH_REMATCH[2]/-}
local MATCHED_PR=${BASH_REMATCH[7]/-}
local MATCHED_ARCH=${BASH_REMATCH[8]//_}
local MATCHED_EXT=${BASH_REMATCH[10]}
apecho " | parsed: PV=$MATCHED_PV, PR=$MATCHED_PR, ARCH=$MATCHED_ARCH, ext=$MATCHED_EXT."
if [[ -n ${MATCHED_ARCH} && ( ${MATCHED_ARCH} != ${ARCH} && ${MATCHED_ARCH} != all ) ]]; then
apecho " X ARCH does not match. Skipping..."
continue
fi
if [[ -n ${MATCHED_PR} && ${MATCHED_PR} != ${PR} ]]; then
apecho " X PR does not match. Skipping..."
continue
fi
if [[ -n ${MATCHED_PV} ]] && ! pkg_checkver ${MATCHED_PV} ${PV}; then
apecho " X PV=${MATCHED_PV} does not match. Skipping..."
continue
fi
if [[ -d ${f} ]]; then
apecho " -> $f is a direcrory. Delving..."
pkg_pick_patches ${f}
apecho "<- Back. Continuing..."
continue
elif [[ -z ${MATCHED_EXT} ]]; then
apecho " X Is $f a file without patch|diff extension. Skipping."
continue
fi
apecho " + Adding '$(pwd)/${f}' to patches."
patches=( "${patches[@]}" "$(pwd)/${f}")
fi
done
popd > /dev/null
apecho " < ${patches[@]}"
}
pkgpatch() {
local -a patches=()
local -i runautomake=0 runautoconf=0
[[ ! -d "${PATCH_OVERLAY}/${CATEGORY}" ]] && return 0
# only in precompile phase find patches and hooks
if [[ ${EBUILD_PHASE} == compile ]]; then
local patch_extens="diff|patch|sh"
# in other phases find only hooks
else
local patch_extens="sh"
fi
pkg_pick_patches "${PATCH_OVERLAY}/${CATEGORY}"
apecho " ! GRAND RESULT: ${patches[@]}"
# before unpack phase ${S} yet not present
if ! pushd "${S}" &>/dev/null;then
pushd "`pwd`" >/dev/null
fi
for patch in "${patches[@]}"; do
if [[ $patch =~ \.sh$ ]];
then
source $patch
else
ebegin "Trying to apply $(basename ${patch})"
if pkg_try2apply "${patch}"; then
eend 0
else
eend 1
continue
fi
fi
if grep -E '^[+][+][+][[:space:]]+.*Makefile[.]am[[:space:]]+.*$' "${patch}" >/dev/null; then
einfo "Need to rerun automake"
(( ++runautomake ))
fi
if grep -E '^[+][+][+][[:space:]]+.*configure[.](ac|in)[[:space:]]+.*$' "${patch}">/dev/null; then
einfo "Need to rerun autoconf"
(( ++runautoconf ))
fi
done
if [[ ${runautomake} -gt 0 || ${runautoconf} -gt 0 ]]; then
inherit autotools
fi
if [[ ${runautomake} -gt 0 && ${runautoconf} -gt 0 ]]; then
eautoreconf
elif [[ ${runautomake} -gt 0 ]]; then
eautomake
elif [[ ${runautoconf} -gt 0 ]]; then
eautoconf
fi
popd > /dev/null
}
[ -d /var/db/pkg/sys-apps/calculate-core-3.1.[1-9]* ] && calcver=3.1.1
post_pkg_preinst() {
CL_UPDATE_PROG=/usr/lib/calculate-2.2/calculate-lib/bin/cl-update-config
if [ -e ${CL_UPDATE_PROG} ];then
[[ -z ${CONFIG_PROTECT} && -e /etc/profile ]] && source /etc/profile
CONFIG_PROTECT=${CONFIG_PROTECT} ${CL_UPDATE_PROG} --desktop --system --pkg_version ${PVR} --pkg_category ${CATEGORY} --path ${D} $PN
fi
CL_UPDATE_PROG=/usr/sbin/cl-core-setup
if [ -e ${CL_UPDATE_PROG} ] && [[ -z $calcver ]] && check_skip
then
${CL_UPDATE_PROG} --no-progress --pkg-version ${PVR} --pkg-category ${CATEGORY} --pkg-path ${D} --pkg-name ${PN}
fi
}
post_pkg_postinst() {
if [ -e "${PORTAGE_BUILDDIR}/.patched" ];then
rm -f "${PORTAGE_BUILDDIR}/.patched"
fi
if [[ -n $calcver ]] && [[ -f /var/lib/calculate/-postmerge ]] && check_skip
then
CL_UPDATE_PROG=/usr/sbin/cl-core-setup
if [ -e ${CL_UPDATE_PROG} ];then
OLDIFS=$IFS
IFS=/
while read category pkgname;do
[[ -n $pkgname ]] || continue
IFS=$OLDIFS
CTARGET=${CTARGET} GCC_CONFIG_VER=${GCC_CONFIG_VER} ${CL_UPDATE_PROG} --no-progress --pkg-name $pkgname --pkg-category $category --pkg-path "/"
IFS=/
done </var/lib/calculate/-postmerge
IFS=$OLDIFS
fi
fi
rm -f /var/lib/calculate/-postmerge
}
pre_pkg_postinst() {
rm -f /var/lib/calculate/-postmerge
if [[ -n $calcver ]] && check_skip
then
CL_UPDATE_PROG=/usr/sbin/cl-core-setup
if [ -e ${CL_UPDATE_PROG} ];then
CTARGET=${CTARGET} GCC_CONFIG_VER=${GCC_CONFIG_VER} ${CL_UPDATE_PROG} --no-progress --pkg-version ${PVR} --pkg-slot ${SLOT} --pkg-category ${CATEGORY} --pkg-path "/" --pkg-name ${PN}
fi
fi
rm -f /var/lib/calculate/-merge-$PN-*
rm -f /var/lib/calculate/-CONTENTS-*
}
CL_CORE_PATCH=/usr/sbin/cl-core-patch
if [[ ${EBUILD_PHASE} == "compile" ]] && [ -e ${CL_CORE_PATCH} ] &&
[[ -d ${S} ]] && check_skip; then
${CL_CORE_PATCH} --no-progress --pkg-version ${PVR} --pkg-slot ${SLOT} --pkg-category ${CATEGORY} --pkg-path ${S} --pkg-name ${PN} --verbose
else
if [[ `readlink -f /etc/portage/bashrc` != "/usr/calculate/install/bashrc" ]] || [[ ! -f /etc/portage/bashrc ]]
then
PATCH_OVERLAY="/usr/local/portage/layman/calculate/profiles/patches"
[[ -d "/var/lib/layman/calculate/profiles/patches" ]] && \
PATCH_OVERLAY="/var/lib/layman/calculate/profiles/patches"
PATH=${PATH}:/usr/sbin:/usr/bin:/bin:/sbin
if [[ ${EBUILD_PHASE} == compile ]]; then
if [[ ! -f ${PORTAGE_BUILDDIR}/.patched || \
( ${PORTAGE_BUILDDIR}/.unpacked -nt ${PORTAGE_BUILDDIR}/.patched ) ]]; then
touch "${PORTAGE_BUILDDIR}/.patched"
elif [[ "${PORTAGE_BUILDDIR}/.unpacked" -nt "${PORTAGE_BUILDDIR}/.patched" ]]; then
einfo ">>> WORKDIR is up-to-date and patched, keeping..."
fi
fi
pkgpatch
fi
fi
# Update configuration files for package installation
if [[ ${EBUILD_PHASE} == setup ]]; then
userBashrc="/etc/portage/bashrc"
if [[ -f /etc/portage/bashrc ]] &&
grep -q -e "function\s+post_pkg_preinst" -e "post_pkg_preinst\(\)" $userBashrc &&
! grep -q "calculate_post_pkg_preinst" $userBashrc;
then
ewarn ""
ewarn "!!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!"
ewarn "Redeclaration post_pkg_reinst was detected in ${useBashrc}."
ewarn "Remove it for correct package configuration."
inherit eutils
ebeep 5
fi
fi
# added for calculate2.2
# FUNC: change_permissions
# DESC: change permissions for all files and directories into specified
change_permissions() {
local directory=$1
[[ -d $1 ]] || return
# get owner from parent directory
addwrite ${directory}
local dirowner=$(stat -c"%u:%g" ${directory})
local dirmode=0$(stat -c%a ${directory})
# get permissions from parent directory
local dirmode=0$(stat -c%a ${directory})
# turnoff execute for all (permission for files in parent directory)
if which bc &>/dev/null;
then
local filemode=0$(echo "obase=8;$(( $dirmode & 0666 ))" | bc)
elif which printf &>/dev/null;
then
local filemode=$(printf "0%o" $(( $dirmode & 0666 )) )
else
local filemode=
fi
# set for all files and directories dirowner
chown -R ${dirowner} ${directory}
# set permissions for all directories in parent directory
find ${directory} \! -perm ${dirmode} -type d -exec chmod ${dirmode} {} \;
if [[ -n $filemode ]]
then
# set permissions for all files in parent directory
find ${directory} \! -perm ${filemode} -type f -exec chmod ${filemode} {} \;
fi
}
# system has "remote" share
if grep "\[remote\]" /etc/samba/smb.conf &>/dev/null
then
post_src_unpack() {
einfo "Performing permissions change for distdir directory"
change_permissions ${PORTAGE_ACTUAL_DISTDIR}
}
else
post_src_unpack() {
:
}
fi
if grep "\[remote\]" /etc/samba/smb.conf &>/dev/null
then
pre_pkg_preinst() {
einfo "Performing permissions change for packages directory"
change_permissions ${PKGDIR}
}
else
pre_pkg_preinst() {
:
}
fi
# prerm functions
if [[ $EBUILD_PHASE == "preinst" ]]
then
[[ ! -d /var/lib/calculate ]] && mkdir /var/lib/calculate
touch "/var/lib/calculate/-merge-$PN--${SLOT/\//_}-$PPID"
fi
if [[ $EBUILD_PHASE == "postrm" ]]
then
if [[ ! -f /var/lib/calculate/-merge-$PN--${SLOT/\//_}-$PPID ]] && check_skip
then
if [[ -n $calcver ]]
then
CL_UPDATE_PROG=/usr/sbin/cl-core-setup
if [ -e ${CL_UPDATE_PROG} ];then
${CL_UPDATE_PROG} --no-progress --pkg-version ${PVR} --pkg-slot ${SLOT} --pkg-category ${CATEGORY} --pkg-path / --pkg-name ${PN}
fi
fi
else
cp /var/db/pkg/${CATEGORY}/${PF}/CONTENTS /var/lib/calculate/-CONTENTS-$PN
fi
rm -f /var/lib/calculate/-merge-$PN-*
fi

@ -0,0 +1 @@
# Calculate cl_ver>=3.1.9.3&&merge()!=&&pkg()!= path=/etc/calculate name=profile.bashrc.d

@ -0,0 +1,24 @@
# vim: set syntax=sh
#
# Copyright 2014 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
check_skip() {
declare -A SKIPPKGS=(
["calculate-install"]="1"
["calculate-lib"]="1"
["calculate-console"]="1"
["calculate-console-gui"]="1"
["calculate-core"]="1"
["calculate-desktop"]="1"
["calculate-client"]="1"
["calculate-update"]="1" )
[[ -z ${SKIPPKGS[$PN]} ]]
}

@ -0,0 +1,17 @@
# vim: set syntax=sh
#
# Copyright 2014 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
CL_CORE_PATCH=/usr/sbin/cl-core-patch
if [[ ${EBUILD_PHASE} == "compile" ]] && [[ -d ${S} ]] && check_skip; then
${CL_CORE_PATCH} --no-progress --pkg-version ${PVR} \
--pkg-slot ${SLOT} --pkg-category ${CATEGORY} \
--pkg-path ${S} --pkg-name ${PN} --verbose
fi

@ -0,0 +1,31 @@
# vim: set syntax=sh
#
# Copyright 2014 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
CL_UPDATE_PROG=/usr/sbin/cl-core-setup
post_setup_package() {
if [[ -f /var/lib/calculate/-postmerge ]] && check_skip
then
OLDIFS=$IFS
IFS=/
while read category pkgname;do
[[ -n $pkgname ]] || continue
IFS=$OLDIFS
CTARGET=${CTARGET} GCC_CONFIG_VER=${GCC_CONFIG_VER} ${CL_UPDATE_PROG} --no-progress --pkg-name $pkgname --pkg-category $category --pkg-path "/"
IFS=/
done < <(sort /var/lib/calculate/-postmerge | uniq)
IFS=$OLDIFS
fi
rm -f /var/lib/calculate/-postmerge
}
post_pkg_postinst() {
post_setup_package
}

@ -0,0 +1,67 @@
# vim: set syntax=sh
#
# Copyright 2014 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# added for calculate server 2.2
# FUNC: change_permissions
# DESC: change permissions for all files and directories into specified
change_permissions() {
local directory=$1
[[ -d $1 ]] || return
addwrite ${directory}
# get owner from parent directory
local diruid=$(stat -c"%u" ${directory})
local dirgid=$(stat -c"%g" ${directory})
local dirowner="${diruid}:${dirgid}"
# get permissions from parent directory
local dirmode=0$(stat -c%a ${directory})
# turnoff execute for all (permission for files in parent directory)
if type bc &>/dev/null;
then
local filemode=0$(echo "obase=8;$(( $dirmode & 0666 ))" | bc)
elif type printf &>/dev/null;
then
local filemode=$(printf "0%o" $(( $dirmode & 0666 )) )
else
local filemode=
fi
# set for all files and directories dirowner
find ${directory} \! -uid ${diruid} -o \! -gid ${dirgid} -exec chown ${dirowner} {} \;
# set permissions for all directories in parent directory
find ${directory} \! -perm ${dirmode} -type d -exec chmod ${dirmode} {} \;
if [[ -n $filemode ]]
then
# set permissions for all files in parent directory
find ${directory} \! -perm ${filemode} -type f -exec chmod ${filemode} {} \;
fi
}
# system has "remote" share
if grep "\[remote\]" /etc/samba/smb.conf &>/dev/null
then
pre_pkg_preinst() {
einfo "Performing permissions change for packages directory"
change_permissions ${PKGDIR}
}
post_src_unpack() {
einfo "Performing permissions change for distdir directory"
change_permissions ${PORTAGE_ACTUAL_DISTDIR}
}
else
post_src_unpack() {
:
}
pre_pkg_preinst() {
:
}
fi

@ -0,0 +1,68 @@
# vim: set syntax=sh
#
# Copyright 2014 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
CL_UPDATE_PROG=/usr/sbin/cl-core-setup
[[ -d /var/lib/calculate ]] || mkdir /var/lib/calculate
# setup package and create postmerge package list
setup_merge_package() {
rm -f /var/lib/calculate/-postmerge
check_skip && CTARGET=${CTARGET} GCC_CONFIG_VER=${GCC_CONFIG_VER} ${CL_UPDATE_PROG} --no-progress --pkg-version ${PVR} --pkg-slot ${SLOT} --pkg-category ${CATEGORY} --pkg-path "/" --pkg-name ${PN}
}
# remove mark: package updating
clean_update_mark() {
rm -f /var/lib/calculate/-merge-$PN-*
}
# remove contents file which need for cl-core-setup
clean_contents_mark() {
rm -f /var/lib/calculate/-CONTENTS-*
}
# mark: package updating
mark_update_package() {
touch "/var/lib/calculate/-merge-$PN--${SLOT/\//_}-$PPID"
}
# dispatching unmerge or update package
pkg_postrm_dispatch() {
if [[ ! -f /var/lib/calculate/-merge-$PN--${SLOT/\//_}-$PPID ]]
then
pkg_postrm_unmerge
else
pkg_postrm_update
fi
}
# setup package umerging
pkg_postrm_unmerge() {
check_skip && ${CL_UPDATE_PROG} --no-progress --pkg-version ${PVR} --pkg-slot ${SLOT} --pkg-category ${CATEGORY} --pkg-path / --pkg-name ${PN}
}
# save contents file for correct package updating by cl-core-setup
pkg_postrm_update() {
cp /var/db/pkg/${CATEGORY}/${PF}/CONTENTS /var/lib/calculate/-CONTENTS-$PN
}
pre_pkg_postrm() {
pkg_postrm_dispatch
clean_update_mark
}
pre_pkg_postinst() {
setup_merge_package
clean_contents_mark
clean_update_mark
}
pre_pkg_preinst() {
mark_update_package
}

@ -1,2 +0,0 @@
# Calculate merge()!=&&pkg()!= path=/etc/runlevels name=boot

@ -1 +0,0 @@
# Calculate link=/etc/init.d/calculate-builder symbolic force protected

@ -0,0 +1 @@
# Calculate append=skip cl_merge_pkg!=&&cl_ver>=3.1.9.3

@ -0,0 +1 @@
# Calculate append=skip merge(sys-kernel/calculate-sources)!= postmerge=sys-boot/grub

@ -0,0 +1,15 @@
# Calculate format=diff
diff -ruN dracut-034.orig/dracut.sh dracut-034/dracut.sh
--- dracut-034.orig/dracut.sh 2013-12-27 17:19:20.082554927 +0400
+++ dracut-034/dracut.sh 2014-01-09 14:42:53.235039034 +0400
@@ -1270,7 +1270,10 @@
else
dinfo "*** Pre-linking files ***"
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
+ [[ -d $initdir/proc ]] || mkdir $initdir/proc
+ mount -n -t proc none $initdir/proc
chroot "$initdir" "$PRELINK_BIN" -a
+ umount -n $initdir/proc
rm -f -- "$initdir/$PRELINK_BIN"
rm -fr -- "$initdir"/etc/prelink.*
dinfo "*** Pre-linking files done ***"

@ -6,6 +6,11 @@ do
rm -f $i
done
for i in /boot/{initramfs,config,System.map,vmlinuz}-${PV}-calculate
do
rm -f $i
done
echo "Remove modules"
rm -rf /lib/modules/${PV}-calculate
echo "Remove sources"

@ -4,6 +4,7 @@ AUX calculate-core-3.1.8-r2.patch 1287 SHA256 02aedb82b237d82142c18c33ebeba2a957
AUX calculate-core-3.1.9-r1.patch 1577 SHA256 fa7f92eb9fb094f739162e7b0829dddf6de4f2419af0f513005a83a836ac66fa SHA512 043d584425b6f98540445c2570ec653ff50150263c3eaeb547e45cad52b97b59eb42c60cdc6d443b69e4ee5ff7d5a1f532840f997903bde62d0099977768ac78 WHIRLPOOL 777711c0a1214e7bec5bca66b48d69fbe88ea34ca604b583d73c99563be5726d6be2d2f09bd41f926b6f59d586a99489ea1bd6822b72ace0dde8e0fb95f155ab
AUX calculate-core-3.1.9-r2.patch 3989 SHA256 965e2036b890f63eef6623d2049ec18702daa5ea57d38f65ff17d70d3c6aef3a SHA512 78e7f1c7861a833c20a4bf185cf150a0bd5d243078e16a10b62608a488d20b2727a7e6e9551d5d5548a72197ea182c11a54d7c0656d960dbf9a976686d8db876 WHIRLPOOL 502610fd3003a75e17d792e2f1c99caae0d3aca35786564f4cf80a6a82439126435d212ec7f91bbcc99db74517881c148d506f59bd70e89677fa67d13156c7d0
AUX calculate-core-3.1.9-r3.patch 4562 SHA256 336706fa01e19e3797e8134ceb2d1f945054cde199f1a017854606b1fd7069e2 SHA512 f02ae2012590fd582c2668028905616836c587f1fa962d7f483c4dd45ccca9f9659b1818dbd701beecad9a8fc3fa39bee75488f689b70631eb71ad801c64503c WHIRLPOOL 4a1ba5730768a1c279fb29e3dadbdd3c74208f29c7dfc2fdce5c2a900e21cf3eae869bd9f49198f27ad4e7153e41be892445f661b07e217236410c5117c82234
AUX calculate-core-3.1.9-r4.patch 5338 SHA256 ac7374390c65c37785ac42734d177332ca4d36381105ce9cc0ab29b607f07449 SHA512 406fc472e822aefa5aa083891ba15400e89d4fb21dbda24612de67a33afb00f1603457f7f7830ff35be307253b54bd4efe77c3129de96178172a58f26b4f2c6c WHIRLPOOL 676b0bbdfec1aac7d2974c11acb4a45ef0c80241c30fd3153d2c15d7dd9810fcb9da2d47beed6e683984cda857bc401cc1ecec555a79e03214c8e7d10201b57a
DIST calculate-core-3.1.6.tar.bz2 85099 SHA256 d582745a4b211202587cc8eda828bac8d69d5cf533e71ff51e0f3b27b15571a5 SHA512 63f9503be189af52cdcf917ab95841fa7030d181e25ff3910dba68ee0289590867ce1fe865a7c4dba778809ee43311067d4671330e8c5788397c83e162cd54e4 WHIRLPOOL ca9556855388168eb1b2b6cd4e4c7c8c879ac21cd79bede8ca6b2d765e57a52841ad1ac165bdbb9b99a8130942fa2b712bf7f09bb25e9941993225061bce97ab
DIST calculate-core-3.1.8.tar.bz2 83713 SHA256 a9a4e5bfe30ca215b6c5cda5553153de144677bc639057df89f3355168470c68 SHA512 7f5c45c286a45b256e6c89aada1a786be5515209dca1c80fb0d37318120c383409133499cdcf6b9efd37ad32793a199769c580aca2bf77df72e8079d1fda7619 WHIRLPOOL 734fd80772f5c778cdaf6223ab9a650ccf86ffd61a8f5df4cf08f4d9bc5b8420500b68fad53aac48ec42d302e23664445e0b28cb3b5fe72272c88b1ed970ce2c
DIST calculate-core-3.1.9.tar.bz2 83760 SHA256 c7e08d1e127b32196ff55c1c0b2c58d4eb805d06604edae0d76c8bc61e0427c3 SHA512 e0124f3d40cbba1a147a11949c3f57218def6ae37575a059fb1a37c111d1d29d8dcef9a4927c7ce7fce172ca405bcf225800bed3b00d05e3a663db13e7f45e74 WHIRLPOOL 18926257d8cc4a237c08f4354eac0fa5ce82162fb8a13aa5de5d31b53ee9acb4d3b1320edb746cd552fdacbfce30405d0092d9e6be661e04c74384803459a4fc
@ -13,6 +14,7 @@ EBUILD calculate-core-3.1.8-r2.ebuild 1257 SHA256 9e4bd6789ff2215445793a658765db
EBUILD calculate-core-3.1.9-r1.ebuild 1257 SHA256 8166c19b93b011cde0b1cbcb54f248c25887d0eb26946adf61f88a4a79170a81 SHA512 179316bbcf162793cbc9e7dc28a53998dad58254de0db5e740f14e6d6f621bec0b855b176b748628551f55162b3bba830dcdedb020a8a143a64cb9c373b7ec54 WHIRLPOOL f33c0563bb3b294739aaf766467c08ec4ab691f282721c2bdc40df70fea8a362431defd64bd772affe609625f1ff71e73b3315cd66a841c57c214b0812d86cca
EBUILD calculate-core-3.1.9-r2.ebuild 1257 SHA256 d0cb67c9c968a74c9ce747262c164262c12d3b555721fa60ad6b58562ecac38d SHA512 a4f99e827f3dda339b55a2b935313081f56743389224294f39abdb4a9b12d8f5cd9ee12ba534185c11f8cbc299f5f00c365f4357f598966c13911630bf09e1f1 WHIRLPOOL 13b18bed7eeea63fc64a3a5a191b0dba9b00e41c81217355f5a4d5cb6c810fdfa8ec3d2013261f12037e4e5eb63d28db4776cb3cd821e9a363d3bb1b4a420fe5
EBUILD calculate-core-3.1.9-r3.ebuild 1257 SHA256 bb76388b73dfd9bad20a34259d549918eccbe454306845261fb94ca81ecddc18 SHA512 75937e6006b31ee07ae7215a503ad258d415b81992d847198f237ab89347925ebdbfbd0311647edb963c0fb81fe755f37bf8f9c9d490efd466edbc56d9027f9f WHIRLPOOL c6527f0672cb826ebd111c5a87f058616161ef2f5a93e976ca1190d4f1408857d93d141d68550f81d539e720f07eba14d034e470549af6e0a1a7a80c11ac68ac
EBUILD calculate-core-3.1.9-r4.ebuild 1257 SHA256 979158b80a809eae86a33ca7504f1ccb94f980838ffa8328c248ff9f4c94f281 SHA512 676bb9de1ed147fe2d1891702dab5eca9957f77ae3cd4acff52807f63db64b2b26959bec939e7242a6f1212a266762d53e4fb4f0e9d2f4b68ae03aaa255e7d19 WHIRLPOOL df43aead691c3ae9ac23bc8a486a5dfc5bbce58b60c04a55ca8b22ab299edac6ed4ce2c407ca27bbd641dcd2239234e4c281c7d09a50d6116b13652d79fd0561
EBUILD calculate-core-3.1.9.ebuild 1122 SHA256 777fa4d0e6055667d661057ce17d6968ce94677ff7ff645f992c34974f7a7f0a SHA512 908268f3ebac2012d7197e8ad544dfba781100aab062aaa5ed1eacf6fa79b5a68a43e86cb6e0c49122ccfb68229a3a4f4e4120ac5000ebaa74548c053866c7bd WHIRLPOOL c0ba8347578aababe9b5d2711ad5462bc5db6d0c717d6dcac05deb76a6a385ef6a2b4d1cf5473419a92501fb1f05b2dbd5bddcb74545d294d313aede2a129829
EBUILD calculate-core-3.1.9999.ebuild 656 SHA256 475e34d10141354a4c60e029fc1cb74b080c3a1371d9e1e44a5e2936b7130ed4 SHA512 9ba865c5effa56079a3841a96d1a4a89d4bbc27e092042aa4a87d1b4ecde9d3a690c92c73e10b330724258aaf3138d2a58d50d18d2fbea9e657c3c5d2f8395ee WHIRLPOOL 89d3bcc657324d1ffb4265eab3e28e94e3d00fb7530c6654e75b52fe002d70f72998930729cfe3320a3ff571277e6e59c649b0df2fe071bcd9b050f9d42608eb
MISC ChangeLog 382 SHA256 ce74a6d08ec1ea80ee021f5378f705102435abfcd5304d851c3f7932a967065e SHA512 f5531edead30072e8fb8f278cad1d265762b8ecdf146b86cf514704f373f2bd8068b3ed35e68186687f83129814b73c6269024d442fb592515c72a9d0e6d3ca1 WHIRLPOOL 48571b2986c2f8797109a3a3440a43f4f87b601e8e52bd41a470bd077b37eb2b6118e6baf86179df065aa2e4a840d9501b2b2455b990a19dfaa2d4ee7784c922

@ -0,0 +1,51 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="3"
SUPPORT_PYTHON_ABIS="1"
PYTHON_DEPEND="2:2.7"
RESTRICT_PYTHON_ABIS="2.4 2.5 2.6 3.*"
inherit distutils eutils
SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2"
DESCRIPTION="The WSDL core for Calculate 3"
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
LICENSE="Apache-2.0"
SLOT="3"
KEYWORDS="amd64 x86"
IUSE="minimal"
DEPEND="~sys-apps/calculate-lib-3.1.9
>=dev-python/soaplib-1.0
!minimal? ( dev-python/sudsds
net-libs/dslib
dev-python/pyopenssl
dev-libs/openssl
dev-python/m2crypto
dev-python/cherrypy )"
RDEPEND="${DEPEND}"
pkg_preinst() {
dosym /usr/sbin/cl-core /usr/sbin/cl-core-setup
dosym /usr/sbin/cl-core /usr/sbin/cl-core-patch
}
pkg_postinst() {
einfo "For autoconfigure calculate-core for adminuser perform:"
einfo " cl-core --bootstrap <username>"
einfo "For run calculate-core perform:"
einfo " /etc/init.d/calculate-core start"
einfo "Add calcualte core to autorun:"
einfo " rc-update add calculate-core boot"
}
src_unpack() {
unpack "${A}"
cd "${S}"
# apply revision changes
epatch "${FILESDIR}/calculate-core-3.1.9-r4.patch"
}

@ -0,0 +1,143 @@
diff --git core/server/cert_cmd.py core/server/cert_cmd.py
index eeaa33e..4a8fb66 100644
--- core/server/cert_cmd.py
+++ core/server/cert_cmd.py
@@ -177,7 +177,6 @@ def check_server_certificate(cert, key, cert_path, args, port, auto = False):
# send a certificate signing request to another server
elif args.host:
- port = args.port if args.port else 8888
url = "https://%s:%d/?wsdl" %(args.host, port)
print url + '\n' + _("connecting...")
from sudsds.client import Client
@@ -225,7 +224,6 @@ def check_server_certificate(cert, key, cert_path, args, port, auto = False):
req_id = fc.read()
fc.close()
- port = args.port if args.port else 8888
url = "https://%s:%d/?wsdl" %(args.root_host, port)
print url + '\n' + _("connecting...")
@@ -1125,7 +1123,7 @@ def parse(full=False):
'--start', action='store_true', default=False, dest = 'start',
help=_('server started'))
parser.add_argument(
- '-p', '--port', type=int, default = '8888', dest='port',
+ '-p', '--port', type=int, dest='port',
help=_('port number'))
parser.add_argument(
'--pid-file', type=str, dest='pidfile',
diff --git core/server/cl_server.py core/server/cl_server.py
index 8daf7e4..a62d8cd 100644
--- core/server/cl_server.py
+++ core/server/cl_server.py
@@ -74,16 +74,13 @@ def main(*args, **keywords):
key = ob.Get('cl_core_key')
cl_ver = ob.Get('cl_ver')
log_path_var = ob.Get('cl_log_path')
+ cl_core_port = ob.GetInteger('cl_core_port')
if args.version:
print cl_ver
return 0
- if os.getuid():
- if any("sbin" in x for x in sys.argv[0].split('/')):
- print _("User must be root")
- sys.exit(1)
- elif ob.Get('cl_ebuild_phase') == '':
+ if ob.Get('cl_ebuild_phase') == '':
import logging
import logging.handlers
@@ -113,7 +110,7 @@ def main(*args, **keywords):
ob.close()
if not args.method:
try:
- port = args.port
+ port = args.port or cl_core_port
if args.check:
import bootstrap
bootstrap.check(cert, key, cert_path, data_path, certbase, args)
diff --git core/server/func.py core/server/func.py
index c095483..ae69095 100644
--- core/server/func.py
+++ core/server/func.py
@@ -132,7 +132,7 @@ class CommonMethods:
root = '/'
else:
root = root.getDirectory()
- cltFilter=True if cltFilter in (True,"on") else False,
+ cltFilter=True if cltFilter in (True,"on") else False
self.clVars.Set("cl_chroot_path",chroot, True)
self.clVars.Set("cl_root_path",root, True)
# определение каталогов содержащих шаблоны
@@ -148,8 +148,9 @@ class CommonMethods:
printERROR=self.printERROR)
try:
dirsFiles = clTempl.applyTemplates()
- if clTempl.getError():
- raise TemplatesError(clTempl.getError())
+ if clTempl.hasError():
+ if clTempl.getError():
+ raise TemplatesError(clTempl.getError())
finally:
if clTempl:
if clTempl.cltObj:
diff --git core/variables/core.py core/variables/core.py
index 3f0b888..16ec8a1 100644
--- core/variables/core.py
+++ core/variables/core.py
@@ -204,3 +204,10 @@ class VariableClGlobRootCert(Variable):
"""
def get(self):
return path.join(self.Get('cl_core_cert_path'),"sys_ca.crt")
+
+class VariableClCorePort(Variable):
+ """
+ Port for cl-core WSDL server
+ """
+ type = "int"
+ value = "8888"
diff --git core/variables/setup_package.py core/variables/setup_package.py
index 5f45dbd..9a3f3e1 100644
--- core/variables/setup_package.py
+++ core/variables/setup_package.py
@@ -192,10 +192,20 @@ class VariableClCorePkgDesktopSet(Variable):
"""
type = "bool"
- value = "on"
opt = ["--desktop"]
metavalue = "ON/OFF"
+ def get(self):
+ if self.Get('cl_templates_locate') == ["clt"]:
+ return "off"
+ return "on"
+
+ def check(self,value):
+ if self.Get('cl_templates_locate') == ["clt"] and value == "on":
+ raise VariableError(
+ _("You shouldn't choice only clt location "
+ "for desktop templates"))
+
def init(self):
self.label = _("Configure users")
self.help = _("updating desktop (user) configuration files")
diff --git core/wsdl_core.py core/wsdl_core.py
index f9fe2f4..794130b 100644
--- core/wsdl_core.py
+++ core/wsdl_core.py
@@ -76,9 +76,10 @@ class Wsdl(WsdlBase):
normal=('cl_core_pkg_name',),
expert=('cl_core_pkg_category', 'cl_core_pkg_version',
'cl_core_pkg_slot', 'cl_core_pkg_path',
+ 'cl_templates_locate',
'cl_core_pkg_system_set', 'cl_core_pkg_desktop_set',
'cl_core_pkg_root_set',
- 'cl_templates_locate','cl_verbose_set',
+ 'cl_verbose_set',
'cl_dispatch_conf'),
next_label=_("Setup"))]},
#

@ -12,6 +12,7 @@ AUX calculate-install-3.1.8-r9.patch 29911 SHA256 f99b690458835d8561fcdc04c3ea84
AUX calculate-install-3.1.9-r1.patch 774 SHA256 3cf115d79f71f8505f80ca4390ae7e43e58c044d18490ae78bffee49217d8aaa SHA512 49a8b5dd8566a9115e148bdaa157916ac9f7e72e3c59dcc6610639372498146e76b9de8c671406266fbc556780eb518f481e5a508aa18d7d3c49607e7b738e90 WHIRLPOOL 292a426beab159289d04054f8ab5ae3cc14026492b8788418a02483ddad6cb040c13e449301abbea1055a542aa748a3d22dbfab22d53811d4d11cb73a61f05de
AUX calculate-install-3.1.9-r2.patch 1830 SHA256 3c824988d608a0d390639d4244988733525c911edb2457e1815766f9619ba246 SHA512 f97fa46b21e945e0f58cda31a2c5de30e5951aa96bcd97bf176addfc9b347fa38890c43aafd2186b08a8f8ccd56437502b945c74da1b104d9fd3266f1d6f3cfa WHIRLPOOL 2b6bdae69c1e9dd05b22bd7c8eaf37f6917344c0a7cdcfd06d9519b56e43a6da640a9414582e05a4b9f797e41bbbd1abbf60102b803e4d5789ede46b3311a4ce
AUX calculate-install-3.1.9-r3.patch 5207 SHA256 8206f8c0450a5d8b70c2fea85e1321385dac7ddef08250897f91a73104c10395 SHA512 acc60616e0c32f0a30c95a3f251b9b526c5da23e9f039cf1a7c62a74406ce82aaaa779ffa1e79314a2b6348157097516835462d1c7b050bafd0b8a5b4d066761 WHIRLPOOL 2dfe264a75a8bd96226722f01b4cdc1f0cc1986f7c0f51b1a2ef64662a7a119467b82a841cb51c0168c87a3e42e53a69db4a3b9d45dd17ba2d2a2e4abbeed346
AUX calculate-install-3.1.9-r4.patch 6433 SHA256 bb447b6c506daa179ef4062e73ba1dd07694d9219de7783b384ae56838f82f3a SHA512 fbce8d9c89936f396150e7d898192158ac38c43df1af90144d9b588bb4c639fd3f8b0c5ba7a9211961420893276741d59cb037499de173dfb9ff5be1124f6ca2 WHIRLPOOL abd4651ad0769817529a51fc4848915ec7347f06c202334229f6d6dc0cabb53e986800ba190ad589eb29a0414170d09e7f9f785a0ac1876ff294dd2d22706aa0
DIST calculate-install-3.1.6.tar.bz2 77530 SHA256 799a353e4ca01318508183d5e8a1eb205eba071dc60da00788dfc20449fdffbc SHA512 cd824bf699c63aeec3527fb51fa01737d44d5b41d50126b5553ed6d175a2ce8d46fedbbaf0b69a973f951bee559cce38c974c803c171493f0a9a4c76cd174ed4 WHIRLPOOL db65b051b7c354c35484d957d1c5f25ec04dd8be8246d6ee8551bc8c3fee8cfab98cacb8ca3ac653641d81318d17895edfc155aa45b522460be5f538bb357062
DIST calculate-install-3.1.8.tar.bz2 76501 SHA256 316657b710dfd4b84784d88e34ae59cedf88bafea128be7538eef3408d9c1c69 SHA512 06c2c204ef704c7dbefbfb37d9ae994b32f75fe1b51ae9839a30c61a29914ef3cbe722bdfb6d3d049e345687cdffdb00a960d21e64ae7ca9cf39aa2c9bcfb317 WHIRLPOOL 18aef654b09c0fc8be177e34164af79e07c1148f0de23a6febd5f035cc33c76fb61583da8711328f13292d010dd6ab3d69a102002f2899d17d09ddaa59d71711
DIST calculate-install-3.1.9.tar.bz2 77323 SHA256 67613113eddeb61be3c5b25187dfa62caea188a3ac84460e99bb306e07e6f97c SHA512 d680e566b95463c2310f4313fc82ba643404a8dcd6628486a1cc2354f706e44832a023fdea1a9439230d98aa233490b89f3aec2e58d9f28d37746e7cb36ffdd2 WHIRLPOOL a0616b1a7f4434813e1ae9f1df7b0fcdb25120b3736d6ba4957fb53846df01fd1c4219c887d43a9025d700957fa0d205f7091176f870da98c21292d83e42720b
@ -29,6 +30,7 @@ EBUILD calculate-install-3.1.8-r9.ebuild 1043 SHA256 a7386df450112f9452b74adcb4e
EBUILD calculate-install-3.1.9-r1.ebuild 1043 SHA256 7717e300e60731aff78a352c6e0f062d9499fc2f4c5319fde12901b6eb99ccb4 SHA512 391583448b9d342b9b027f5dd508ceff14490060da870ab47d409481a2a30054802987a7daa6932fd436395a0435202208dded9e4b1a544557e6a662a730f4c5 WHIRLPOOL 33e7521b22e4cf02c601a6dd9cf0bf218edb48b13b2bf4b918c915cda4752804ab7a664b2e2555c965a43bd1ee1a89081d4251aa13c2e900b6428d13446db928
EBUILD calculate-install-3.1.9-r2.ebuild 1043 SHA256 c58c63e912fe36ba7b508962021abd266c3419f433c4919187081a2d703b6a45 SHA512 020356b5997a5e98e7efa7bf55d4170d791d1e1bb39f01ed16158f0a4e4ab74cd9c76c3e616e6cd3880669908028a2939527d7a0cf25cb2af0c7c50ac91ec404 WHIRLPOOL 3c8342f245cb8af50223d921ed9adf45866d0efc1c9bede7a758bfb93796d0e99d8faba54e11af759ed60c13833243b13a27056506cc20339311ba60f3c18a27
EBUILD calculate-install-3.1.9-r3.ebuild 1043 SHA256 aac533eae9f9741530c4eaa6b0a329714148bbc49805040844c5573b2eb6215a SHA512 7d86242205439d7143aa1e7cd4e22188fb619b5ced707c2b37ed96b40c9f80de5e9d1ddb073d15438095100a0eddd4dd85b816e5e64f10bd78938788e6d95d6b WHIRLPOOL f04dd65059e4915d66dd9d7490d3249325c7735bdfcbb3b8614defb270a94b57850b7691871a47716f9ca6de62225a83e81965163722f11a9b63b182a7e1602d
EBUILD calculate-install-3.1.9-r4.ebuild 1043 SHA256 5bce6c93d6bcb0c710a0c0c973a4d765175027e6f1cd30846d4390c7252ca0d7 SHA512 c8d9756a07983742ab90065bce5d69e1fe7a76f5d22590da176ff78b7baa329c4cf9bf3a4150831d1cee45cb77b93a60fdb25cf746dcbd60c4614490775c2daf WHIRLPOOL f1ed224612cc85a4ea05434c91491dae1012127094919d3e075be85320ef293ad35faebf2cc6e8e31c8df15ccbbbf4cbe69b2a8333cf8988a78a82e414215b4c
EBUILD calculate-install-3.1.9.ebuild 905 SHA256 edf494d0d331ac48c3ed09876e985e7a7153e8c5ab1d055cc5d24db341697171 SHA512 c61066b8bc37d7084c3914f45ea7c23d58ff4b02bdd7d3a87516aa2e7474caf9b91410ab7912d5b87d8b729a7371c75a1c305096081c7f8faea1928876d67376 WHIRLPOOL c3a5581c4c6b8d1529210ab9f000ba83f9ab8b3aa127b8ecd706590657cd73b891f5ab10cd974eb62116c5a2ff7436187e78508964b9a423a812fda4f5eb2c29
EBUILD calculate-install-3.1.9999.ebuild 683 SHA256 e97dd6f046d54a16eee281fa35790c92507b150bc940f3c2b36117e6f44f0a8d SHA512 c1179c500dcaa48506f6334e9e2ccc3cc70d712b2899d7e1d9265bc202f088ab71baa1aaea462deee56fdd5244bee4ab9b9a9da72f25ec511d4f2fa0c3c35f43 WHIRLPOOL 010d35b929fce496b5f16228688e23a95c9c87ebed0d290eeb454e5c1432b55b3b276dfb5786a27222543446a1090ce2f133d80373649fe72341b508d1e16a78
MISC ChangeLog 33978 SHA256 a1cc544f9763b08b3647d90fac1ec53748016bb23260181315896c8c02431443 SHA512 11a09ba60fbc727bd47b57653b4bb0937d98774eb9ca95680a5b55997c7e22db3976cbd0878d908fa0200e04b6cc9eb0ae9ac6f1623235490e2e46e54cc1f7f4 WHIRLPOOL 50352c2950f301cbb5116b8c9972e592767dcb03bd71d081c75de5e69b2a920331abec4756658faf64e291bf6f4f41df67b8d62946683629a2c99b48274eb2f3

@ -0,0 +1,44 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="3"
SUPPORT_PYTHON_ABIS="1"
PYTHON_DEPEND="2:2.7"
RESTRICT_PYTHON_ABIS="2.4 2.5 2.6 3.*"
inherit distutils eutils
SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2"
DESCRIPTION="The program of installation Calculate Linux"
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
LICENSE="Apache-2.0"
SLOT="3"
KEYWORDS="amd64 x86"
IUSE="pxe minimal"
DEPEND="~sys-apps/calculate-core-3.1.9
!<sys-apps/calculate-install-2.2.29
app-portage/layman
>=virtual/udev-197
!app-misc/livecd-tools
sys-apps/iproute2[-minimal]
!minimal? ( sys-boot/grub
sys-apps/gptfdisk
>=sys-apps/util-linux-2.19.1
sys-fs/dosfstools
sys-fs/squashfs-tools
sys-block/parted )
pxe? ( sys-apps/calculate-server
net-ftp/tftp-hpa
net-misc/dhcp
net-fs/nfs-utils )"
src_unpack() {
unpack "${A}"
cd "${S}"
# apply revision changes
epatch "${FILESDIR}/calculate-install-3.1.9-r4.patch"
}

@ -0,0 +1,128 @@
diff --git install/distr.py install/distr.py
index 88de47f..ae94ddb 100644
--- install/distr.py
+++ install/distr.py
@@ -31,7 +31,8 @@ from functools import partial
from calculate.lib.utils.files import (runOsCommand,isMount,removeDir,
processProgress,countFiles,STDOUT,
typeFile,pathJoin,process,getRunCommands,
- readLinesFile,getProgPath,listDirectory,checkUtils)
+ readLinesFile,getProgPath,listDirectory,checkUtils,
+ MAGIC_COMPRESS,MAGIC_SYMLINK,MAGIC_CONTINUE)
from calculate.lib.utils.common import getTupleVersion,cmpVersion
from calculate.lib.utils.device import (detectDeviceForPartition,
getUdevDeviceInfo, countPartitions,
@@ -114,7 +115,7 @@ class Distributive(object):
def fromFile(cls,filename):
"""Get Distributive object by filename"""
# MAGIC_COMPRESS 0x000004 Check inside compressed files
- tf = typeFile(magic=0x6)
+ tf = typeFile(magic=MAGIC_COMPRESS|MAGIC_SYMLINK|MAGIC_CONTINUE)
ftype = tf.getMType(filename)
if ftype:
if "block special" in ftype:
@@ -1095,7 +1096,7 @@ class IsoDistributive(Distributive):
self.compress = compress
def getType(self):
- tf = typeFile(magic=0x6)
+ tf = typeFile(magic=MAGIC_COMPRESS|MAGIC_SYMLINK|MAGIC_CONTINUE)
ftype = tf.getMType(self.file)
if "block special" in ftype:
return _("live image %s")%self.file
@@ -1116,7 +1117,7 @@ class IsoDistributive(Distributive):
def _mountIso(self,file,directory):
if self.file != self.mdirectory:
self._makeDirectory(directory)
- tf = typeFile(magic=0x6)
+ tf = typeFile(magic=MAGIC_COMPRESS|MAGIC_SYMLINK|MAGIC_CONTINUE)
ftype = tf.getMType(file)
if "block special" in ftype:
mopts = "-o ro"
diff --git install/install.py install/install.py
index fdd6b04..c3e0c7e 100644
--- install/install.py
+++ install/install.py
@@ -28,7 +28,8 @@ from shutil import copy2
from calculate.core.server.func import safetyWrapper
from calculate.lib.utils.files import (runOsCommand,pathJoin,
isMount,process,listDirectory,STDOUT,
- checkUtils,readFile,find,copyWithPath)
+ checkUtils,readFile,find,copyWithPath,
+ readLinesFile)
from calculate.lib.utils.common import (appendProgramToEnvFile,
removeProgramToEnvFile, getTupleVersion,
cmpVersion,getUserPassword,
@@ -350,7 +351,7 @@ class Install:
newModuleName = defaultGL
curModuleName = map(lambda x:x.strip().rpartition('=')[-1].strip('"\''),
filter(lambda x: x.startswith("OPENGL_PROFILE="),
- readFile(openGLenv)))
+ readLinesFile(openGLenv)))
curModuleName = curModuleName[-1] if curModuleName else ""
if curModuleName == newModuleName:
return True
diff --git install/variables/disk.py install/variables/disk.py
index ef0f9e2..14462e7 100644
--- install/variables/disk.py
+++ install/variables/disk.py
@@ -31,7 +31,7 @@ from calculate.lib.utils.device import (getUdevDeviceInfo,getDeviceType,
getUUIDDict,getCommonDeviceName)
from calculate.install.variables.autopartition import Sizes
from calculate.lib.utils.files import (listDirectory,pathJoin,readFile,FStab,
- isMount)
+ isMount,getProgPath)
from calculate.install.distr import PartitionDistributive
from calculate.install.fs_manager import FileSystemManager
@@ -110,7 +110,8 @@ class VariableOsDeviceDev(ReadonlyVariable,DeviceHelper):
"""Get device /dev name"""
if self.master is None:
self.master,slave = pty.openpty()
- self.monitor = Popen(["/sbin/udevadm","monitor","--kernel",
+ udevAdm = getProgPath('/sbin/udevadm')
+ self.monitor = Popen([udevAdm,"monitor","--kernel",
"--subsystem-match=block"],stdout=slave,
close_fds=True)
os.close(slave)
@@ -1834,7 +1835,7 @@ class VariableOsInstallFstabMountConf(ReadonlyVariable,DeviceHelper):
'os_install_disk_mount',
'os_install_disk_format',
'os_install_disk_options',
- 'os_disk_dev'],
+ 'os_install_disk_dev'],
where='os_install_disk_mount',
func=lambda x:x[0] != "" and x[0] != "swap"),
lambda x,y: cmp(self.separateDevice(x[1]),
diff --git install/variables/kernel.py install/variables/kernel.py
index 2e844ac..42ee87a 100644
--- install/variables/kernel.py
+++ install/variables/kernel.py
@@ -19,7 +19,8 @@ import sys
import re
from os import path
from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable
-from calculate.lib.utils.files import typeFile,process,listDirectory
+from calculate.lib.utils.files import (
+ typeFile,process,listDirectory,MAGIC_SYMLINK,MAGIC_COMPRESS)
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_install3',sys.modules[__name__])
@@ -137,7 +138,7 @@ class KernelHelper:
def getFilesByType(self,pathname,descr):
"""Get files from "pathname" has "descr" in descriptions"""
filelist = map(lambda x:path.join(pathname,x),os.listdir(pathname))
- ftype = typeFile(magic=0x4).getMType
+ ftype = typeFile(magic=MAGIC_COMPRESS|MAGIC_SYMLINK).getMType
filesWithType = map(lambda x:(x,ftype(x)), filelist)
return filter(lambda x:descr in x[1],filesWithType)
@@ -150,7 +151,7 @@ class KernelHelper:
return resInitrdVer.groups()[1]
return ""
- ftype = typeFile(magic=0x4).getMType
+ ftype = typeFile(magic=MAGIC_COMPRESS|MAGIC_SYMLINK).getMType
kernelfile = path.join(chroot,'boot',kernel)
typeKernelFile = ftype(kernelfile)
if typeKernelFile == None:

@ -18,6 +18,7 @@ AUX calculate-lib-3.1.9-r3.patch 5775 SHA256 972f7724c55273cd96f9f2adcd2594c9a2b
AUX calculate-lib-3.1.9-r4.patch 6380 SHA256 52b89cdd45270c7784d21c30a6466eb2096955bab98469b8cc67f6e84b7358fb SHA512 5b678292b332275013f8c845e54ea0ab33ec13bb70e27d60f06cb490fc896699c7fda2215c8edfef91b12d1597927a7d0fe9fc848e1d7807d706c2cbf5f14b08 WHIRLPOOL b9d85f021763bbf63f537ae5640c9fa316a97e1f5ef04794f8e09455712d3f0b4d44f10878474028b4d971272dc6b55ec2745d129e7bdf2aad75a38ae4315b0d
AUX calculate-lib-3.1.9-r5.patch 9701 SHA256 c938ff5701c594cfaabe59592b4c9da88fccc1cee393eca547afa2e5e083c01b SHA512 3bc08e98faf3e15a8688ae519536b3810a67c61fe64e36bd77b35ea534a08b74dd4b21fa7487553188a2a4b21249a2873793bc245ec53fc1c93b490a1c8bf94b WHIRLPOOL 223f80a5966271c6fd3c9f590b5b209ac7f2e9ca8775ac4f5c9206cdf7c0eb8402b0f0cc2a8209eb228ea0eecb5658b612a1e92d2e9714cfc3a821df66d7341c
AUX calculate-lib-3.1.9-r6.patch 9705 SHA256 565b7141eeb6ca7fd252f7c894841122448db083949bacdcbbe8afc29a98d3a7 SHA512 5aefd6716dd5cd26a9ca35a27e9ff93473b415653d40a6ebcd0c4c32484ddef5a6237f8ad54e1f68a54de797de202d6f71a482f4636b730dd66fd03df0908c48 WHIRLPOOL 194888e0fee07c163332c73e52b62c7c8f54ac02cb32eae5b4b6b8f45446482b5bb8e9e6d71ddc2ace3d4d9d6e8247026c9c2c282e86007c955e4b9a16392cb9
AUX calculate-lib-3.1.9-r7.patch 21086 SHA256 3fd406dc604d9991d895b59fa8d04c5d61654bff6166600c3e649b1748b0123c SHA512 cdb1ac84ac1d15d4b3b8d63669aca3757ff80efcfb6ee09d49f4bd47c31a5eb251c1859cbf944c6151029fa2ea5188ded90fbd3d3c13472e7441d88a4c7dbb92 WHIRLPOOL b57d61a13de7f6fd4c78951b65f3000d1c81168f946b29929f85fecdcfdc5cdbc2e95a181a5dca2d12faac07ccd9e7b834babbb519eec2b7749e2c37bd3ee9c1
DIST calculate-lib-2.1.11.tar.bz2 61687 SHA256 62976c08d4fb4810389ace6f5a99abb5a962f6c8d9053ff943d0669480fb5599 SHA512 e3bc2168a55367cf19ad3a27921b53e5e845643238bf171209ab29752c91b5d4d338a2120774764ac1c79abd93f2deff8680f8faa1407940984ea9fd6a199e67 WHIRLPOOL 0ced92ea493dd8db02b0ae1514ebbb51ee76dc6f441b4a38c984c39da2121fb81dd1f2e840c4c5b71a117a12817a2a269d85676288202aa9801f69727e3338dc
DIST calculate-lib-2.2.31.tar.bz2 120044 SHA256 ba38052d8b2349a1c60adc589a74eb8a3ffcbf6f3c1124e4c1fb0da3aa777f12 SHA512 902871b9159f2bcf7a0cc767fb6df5b19902fce6cf9468d96f902c383a422738b65debe3094c92d1f82de2124936496f89631c6eb9670da00807b63156b101b7 WHIRLPOOL 5179ee691519f3a7faa3135d040ad64bd6d67c026ebf39bb17f7d641130a2b58641d1fe5da4f6cfbd45d4442d93508f0a5f641ef2cd8c43e1a322aab3d11f4b9
DIST calculate-lib-3.1.6.tar.bz2 121830 SHA256 4dc08cb3246b533466457905d4fe44f7ee75266b66e8450ac7ddcb3d210980ca SHA512 578fa1f731c7b04b061abb68de8ceeb5e7cadac6858a7957f3e57f7249f9692965419da05bf3c16963c397ddbbc10a24ea5c7feda043d067f0274a52d2c56dac WHIRLPOOL ceea0a4719a5c8a0ef645f51f07bb7f813ecdb8fe8ed99f574523cd2c242223eec92c6078a15192d40a366e8231b6ff72acf63954b7f48d0f34e5c006f2eca95
@ -42,6 +43,7 @@ EBUILD calculate-lib-3.1.9-r3.ebuild 824 SHA256 3199d484c3a5ecbaf4d254649cb4e7ee
EBUILD calculate-lib-3.1.9-r4.ebuild 824 SHA256 b1b73001e179931b6444e61520b003c610af89b96b6f4c2aea696783d079852d SHA512 d0911eeda97a7f5a8faec7787b71db43472ea18f1a377e4956db1d9e3b67a684dd4200e56ad8569a52757a4d3ac2ad2725744f5115d680ccb6b304e3242fecb4 WHIRLPOOL 1ac814a74146528810b643edce703f2824b0cf2dda7871f66f1d5a9b3fa1674b86594bdc2b3d19ed39ad15cc895c42edf06952af38c184033fe4665780e7c0d4
EBUILD calculate-lib-3.1.9-r5.ebuild 824 SHA256 95b0ab30ab6bb4da2ebbe0b62528257eeacb3b77aa56dde3d6b3d7b90c666988 SHA512 96b18913a06eab0fa05cf5efb981d3552d28803b8dcf1487f9a41dc959ea88e7f2acc6035a26998f8c09603d504b7d8936003655bd178a13542135d8d6c98867 WHIRLPOOL 1930cb044369c5b191df8a6de376261b6e2499ae102989362c0958edb91e96ab716b5b727c69984df2e06b74c0ec447bbe7208ccad314266f9bb105750ab0169
EBUILD calculate-lib-3.1.9-r6.ebuild 824 SHA256 12909c72551140b63d7a530073997020d429364774c5f1c3c140803b3570434c SHA512 4ca9409ea34afdcc2b09325e1713d3c633d040aa74c1a3baccd8ec80a66eed5ebfcb3703011d6afdafb4399e53f77133f994db8ed5a125a44d41b5557c5138e8 WHIRLPOOL 3579d7c05b698a6f980628686dc8a3a414c0288b2f1e9281fa83228011c92d3ce7808e3e46bfe87e8dbe3de788d48691cb162342fb30597d232c7f41a8984e74
EBUILD calculate-lib-3.1.9-r7.ebuild 824 SHA256 1967eac2bf04c91425eef3213e59b60a6c1284baaeb2c3caed85bdc5872a8991 SHA512 83e5dcfdad930a2676c493e57144ccf51a0aa004d381c510dfcb815475b22b2a0d2ae9ff416f75bb4548eb588e58d915f261bbff020b19cb3b3c84a7d2e8a9f3 WHIRLPOOL d4a26d71c709eb2276955a40da3141b069444e5a92a3bd8f1e716f0f09be379d3f3de13b3867b285cf46aad88a010eb6a17832bd1cf09b3b6b05680f3010a918
EBUILD calculate-lib-3.1.9.ebuild 690 SHA256 c89c29f5de3f70146e98f15035366506933f03e8a5066b1ad55aeccbebdeae2c SHA512 a7277c2e5fa64a5e5840be7fc8d3df9a31f41926386c5fe6a9bed31eeed6321af5881c218d9ce7eeb12aee518edb682b438e10397dcb815cc63645100430e43e WHIRLPOOL 8f19e4d46381e26fec81e20fa35599f4658b3891d6372c921a8b1354ad3b1821ea9c78f71caebf54610e0b5aacfb6e6ded018e155e1979322406a0ac1e823d09
EBUILD calculate-lib-3.1.9999.ebuild 708 SHA256 a1d64b7f014831bf6b0a38928d53cb55758b7a12e5f3e98fffd28025ffacbce1 SHA512 3873859a791941d421e2338b437521955da383ce986408f1a951305e2dd75a1a4f771c9ec2caa096c5c8ea6a1776d6d0ed99e025ffa786ba029cafdbadfa439b WHIRLPOOL 5ac1a10b53f810ab527a0ebe52bc87e8397e61375cf6e0acbed89d8f6b8385e72bf234e0fdce479c3a3f1652bb6e520710ce9356750a97d644c0db0a33f6facb
MISC ChangeLog 29851 SHA256 16ca15c794bce78eefc487ed372c3d4960078fbd4c5fe4524211688d0146ef97 SHA512 be6bdf290f391529dce0deb67bf9d367e42e407601dd581f7c08d082399b5860cff2a76d4d64dd876154d51e84f34499db06c715145ac64f78d168aae7e78dbf WHIRLPOOL 2561ccd1eefe3423d97c67aff5c0fe6c8ca624e527fb885b042c8e812194bb1635d7e7d7d86c534562eb780c6b9144d92e24893f2d0696cf8a34a6a912a45788

@ -0,0 +1,36 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="3"
SUPPORT_PYTHON_ABIS="1"
PYTHON_DEPEND="2:2.7"
RESTRICT_PYTHON_ABIS="2.4 2.5 2.6 3.*"
inherit distutils eutils
SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2"
DESCRIPTION="The library for Calculate 3"
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
LICENSE="Apache-2.0"
SLOT="3"
KEYWORDS="amd64 x86"
IUSE="minimal"
DEPEND="!minimal? ( dev-python/py-smbpasswd )
>=dev-python/pyxml-0.8
sys-apps/iproute2
sys-apps/pciutils
sys-fs/lvm2
sys-fs/mdadm
dev-python/pyinotify
sys-apps/file[python]"
RDEPEND="${DEPEND}"
src_unpack() {
unpack "${A}"
cd "${S}"
# apply revision changes
epatch "${FILESDIR}/calculate-lib-3.1.9-r7.patch"
}

@ -0,0 +1,461 @@
diff --git calculate/lib/cl_template.py calculate/lib/cl_template.py
index 6c98b35..a539c38 100644
--- calculate/lib/cl_template.py
+++ calculate/lib/cl_template.py
@@ -511,7 +511,7 @@ class fileHeader(_terms):
"comment", "append", "force",
"link", "mirror", "symbolic", "chmod", "chown", "name",
"path", "autoupdate","protected", "run","exec","merge",
- "module","env"]
+ "module","env","postmerge"]
# Тип шаблона
fileType = ""
@@ -705,7 +705,7 @@ class dirHeader(_terms):
"""
# Допустимые параметры заголовка
allowParam = ["append", "chmod", "chown", "name", "path", "autoupdate",
- "module","env","merge"]
+ "module","env","merge","postmerge"]
# Тип вставки шаблона
typeAppend = ""
@@ -2492,7 +2492,7 @@ class _shareTemplate:
pwdObj = pwd.getpwnam(userName)
uid = pwdObj.pw_uid
gid = pwdObj.pw_gid
- homeDir = pwdObj.pw_dir
+ homeDir = self.objVar.Get('ur_home_path')
except:
raise TemplatesError(_("User %s not found")%str(userName))
if groupsInfo:
@@ -2795,9 +2795,7 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction):
fileName = pathJoin(self._baseDir,fileName)
replace = ""
if os.path.exists(fileName):
- FD = open(fileName)
- replace = FD.read().strip()
- FD.close()
+ replace = readFile(fileName).strip()
if replace and lenTerms >= 2 and terms[0] == "empty":
replace ="\n".join(filter(lambda x: not self.reEmptyLoad.search(x),
replace.split("\n")))
@@ -3753,7 +3751,12 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction):
uid, gid = getModeFile(self.fileConfigIni, "owner")
if not self.uid in (uid,PORTAGEUID) or \
not self.gid in (gid,PORTAGEGID):
- os.chown(self.fileConfigIni, self.uid, self.gid)
+ try:
+ os.chown(self.fileConfigIni, self.uid, self.gid)
+ except OSError as e:
+ self.setError(_("error") + " " +\
+ "'chown %d:%d %s'"%(self.uid, self.gid,
+ self.fileConfigIni))
return textTemplateTmp
class ChangedFiles:
@@ -3806,6 +3809,9 @@ class Template(_file,_terms,_warning,xmlShare,templateFormat,_shareTemplate):
os.environ["CONFIG_PROTECT"].split(" "))
protectPaths = map(lambda x: os.path.normpath(x), protectPaths)
+ def hasError(self):
+ return self.getError() or self.bHasError
+
def __init__(self, objVar, servDir=False, dirsFilter=[], filesFilter=[],
cltObj=True, cltFilter=True, printWarning=True,
printSUCCESS=lambda x:x,printWARNING=lambda x:x,
@@ -3820,8 +3826,14 @@ class Template(_file,_terms,_warning,xmlShare,templateFormat,_shareTemplate):
self.changedFiles = ChangedFiles()
self.printSUCCESS = printSUCCESS
self.printERROR = printERROR
+ self.postmergePkgs = []
+ self.postmergeFile = "/var/lib/calculate/-postmerge"
+ self.bHasError = False
if printERROR:
- self.setError = self.printERROR
+ def newSetError(s):
+ self.printERROR(s)
+ self.bHasError = True
+ self.setError = newSetError
self.printWARNING = printWARNING
self.askConfirm = askConfirm
self.stop = 0
@@ -3898,7 +3910,8 @@ re.M|re.S)
self.dictProcessedTemplates = {}
if cltObj is True:
# Объект templateClt
- self.cltObj = templateClt(self.objVar,printSUCCESS=self.printSUCCESS,
+ self.cltObj = templateClt(self.objVar,self.postmergePkgs,
+ printSUCCESS=self.printSUCCESS,
printERROR=self.printERROR,
printWARNING=self.printWARNING,
askConfirm=self.askConfirm)
@@ -4253,9 +4266,10 @@ gettext -d cl_template "$*"
"""Check template variable cl_name in first directories and files"""
skipDirs = []
skipTemplates = []
+ debug = self.objVar.Get('cl_env_debug_set') == "on"
for dirsTemplate in dirsTemplates:
filesAndDirs = map(lambda x: os.path.join(dirsTemplate,x),
- os.listdir(dirsTemplate))
+ listDirectory(dirsTemplate))
for dirFile in filesAndDirs:
if os.path.isdir(dirFile):
flagDir = True
@@ -4274,8 +4288,9 @@ gettext -d cl_template "$*"
if textTemplate:
headerLine = self.getHeaderText(textTemplate)
if headerLine:
- if not "cl_name==" in headerLine and \
- not "ac_" in headerLine:
+ if not debug and \
+ not "cl_name==" in headerLine and \
+ not "ac_" in headerLine:
if flagDir:
skipDirs.append(dirFile)
else:
@@ -4567,7 +4582,10 @@ gettext -d cl_template "$*"
os.unlink(fn)
except Exception as e:
self.printWARNING(_("Failed to remove %s")%fn)
- pkgContents.writeContents()
+ try:
+ pkgContents.writeContents()
+ except IOError as e:
+ self.printWARNING(_("Failed to modify %s contents")%pkg)
self.filesApply = map(lambda x:autoUpdateDict.get(x,x),self.filesApply)
if filter(lambda x:"._cfg" in x, self.filesApply):
self.printWARNING(_("Some config files need updating. "
@@ -4600,7 +4618,11 @@ gettext -d cl_template "$*"
self.objVar.Get('cl_autoupdate_set') == 'on'):
optDir["autoupdate"] = True
if flagDir or stat.S_ISDIR(os.lstat(scanDir)[stat.ST_MODE]):
- for fileOrDir in sorted(os.listdir(scanDir)):
+ if not os.access(scanDir,os.R_OK|os.X_OK):
+ self.printWARNING(_("Failed to read templates directory %s")%
+ scanDir)
+ return False
+ for fileOrDir in sorted(listDirectory(scanDir)):
absPath = os.path.join(scanDir,fileOrDir)
if skipTemplates and absPath in skipTemplates:
continue
@@ -4688,6 +4710,9 @@ gettext -d cl_template "$*"
def processingDirectory(self, path, prefix, opt):
"""Обработка в случае директории если возвращаем None то пропуск дир."""
# Файл шаблона директории
+ if not os.access(path,os.R_OK|os.X_OK):
+ self.printWARNING(_("Failed to read templates directory %s")%path)
+ return None
dirInfoFile = os.path.join(path, self.templDirNameFile)
newDir = pathJoin(self._baseDir, path.partition(prefix)[2])
newDir = "/".join(map(lambda x:x.split("?")[0], newDir.split("/")))
@@ -4710,6 +4735,44 @@ gettext -d cl_template "$*"
if path in self.dictTemplates.keys():
self.numberProcessTempl += self.dictTemplates[path]
return None
+
+ def _processMergePostmerge(self,params):
+ """Обработка параметров merge= , postmerge="""
+ if "merge" in params:
+ mergePkgs = params['merge'].split(',')
+ else:
+ mergePkgs = []
+ if "postmerge" in params:
+ postmergePkgs = params['postmerge'].split(',')
+ else:
+ postmergePkgs = []
+
+ if mergePkgs or postmergePkgs:
+ for wrongPkg in (x for x in mergePkgs + postmergePkgs \
+ if not self.functObj.checkCorrectPkgName(x)):
+ self.printWARNING(
+ _("Wrong package '%s' for 'merge' in the template")%
+ wrongPkg + ": " + templateDirFile)
+ if self.objVar.Get('cl_ebuild_phase') == 'postinst':
+ for pkg in postmergePkgs:
+ if not pkg in self.objVar.Get('cl_merge_pkg_pass'):
+ self.objVar.Get('cl_merge_pkg_pass').append(pkg)
+ if not pkg in self.postmergePkgs:
+ try:
+ with open(self.postmergeFile,"a") as f:
+ f.write("%s\n"%pkg)
+ self.postmergePkgs.append(pkg)
+ except:
+ self.printWARNING(
+ _("Failed to reconfigure %s package")%pkg)
+ else:
+ mergePkgs = mergePkgs + postmergePkgs
+
+ for pkg in mergePkgs:
+ if not pkg in self.objVar.Get('cl_merge_pkg_new') and \
+ not pkg in self.objVar.Get('cl_merge_pkg_pass') and \
+ not pkg in self.objVar.Get('cl_merge_pkg'):
+ self.objVar.Get('cl_merge_pkg_new').append(pkg)
def getApplyHeadDir(self, newDir, templateDirFile, optDir):
"""Применяет шаблон к директории (права, владелец, и.т. д)"""
@@ -4810,19 +4873,7 @@ gettext -d cl_template "$*"
return ("", False, [])
# add packeges for reconfigure
- if "merge" in objHead.params:
- mergePkgs = objHead.params['merge'].split(',')
- for wrongPkg in (x for x in mergePkgs \
- if not self.functObj.checkCorrectPkgName(x)):
- self.printWARNING(
- _("Wrong package '%s' for 'merge' in the template")%
- wrongPkg + ": " + templateDirFile)
- for pkg in mergePkgs:
- if not pkg in self.objVar.Get('cl_merge_pkg_new') and \
- not pkg in self.objVar.Get('cl_merge_pkg_pass') and \
- not pkg in self.objVar.Get('cl_merge_pkg'):
- self.objVar.Get('cl_merge_pkg_new').append(pkg)
-
+ self._processMergePostmerge(objHead.params)
# Пропускаем директорию
if objHead.typeAppend == "skip":
applyDir = path
@@ -5145,18 +5196,7 @@ gettext -d cl_template "$*"
return ([], False)
# add packeges for reconfigure
- if "merge" in objHeadNew.params:
- mergePkgs = objHeadNew.params['merge'].split(',')
- for wrongPkg in (x for x in mergePkgs \
- if not self.functObj.checkCorrectPkgName(x)):
- self.printWARNING(
- _("Wrong package '%s' for 'merge' in the template")%
- wrongPkg + ": " + nameFileTemplate)
- for pkg in mergePkgs:
- if not pkg in self.objVar.Get('cl_merge_pkg_new') and \
- not pkg in self.objVar.Get('cl_merge_pkg_pass') and \
- not pkg in self.objVar.Get('cl_merge_pkg'):
- self.objVar.Get('cl_merge_pkg_new').append(pkg)
+ self._processMergePostmerge(objHeadNew.params)
# Родительская директория
path = optFile["path"]
@@ -5294,6 +5334,10 @@ gettext -d cl_template "$*"
if objHeadNew.params.has_key("mirror"):
if objHeadNew.params.has_key("link"):
templateFile = objHeadNew.params['link']
+ if templateFile and templateFile[0] == "~":
+ # Получаем директорию пользователя
+ templateFile = os.path.join(self.homeDir,
+ templateFile.partition("/")[2],"")[:-1]
templateFile = pathJoin(self._baseDir, templateFile)
if not os.path.exists(templateFile):
if os.path.exists(pathOldFile):
@@ -5312,6 +5356,10 @@ gettext -d cl_template "$*"
if objHeadNew.params.has_key("link") and\
not objHeadNew.params.has_key("symbolic"):
templateFile = objHeadNew.params['link']
+ if templateFile and templateFile[0] == "~":
+ # Получаем директорию пользователя
+ templateFile = os.path.join(self.homeDir,
+ templateFile.partition("/")[2],"")[:-1]
templateFile = pathJoin(self._baseDir, templateFile)
foundTemplateFile = os.path.exists(templateFile)
if foundTemplateFile:
@@ -5981,7 +6029,7 @@ class scanDirectoryClt:
if not prefix:
prefix = os.path.realpath(scanDir)
if flagDir or stat.S_ISDIR(os.lstat(scanDir)[stat.ST_MODE]):
- for fileOrDir in sorted(os.listdir(scanDir)):
+ for fileOrDir in sorted(listDirectory(scanDir)):
try:
absPath = os.path.join(scanDir,fileOrDir)
stInfo = os.lstat(absPath)
@@ -6012,9 +6060,10 @@ class scanDirectoryClt:
class templateClt(scanDirectoryClt, Template):
"""Класс для обработки шаблонов c расширением .clt"""
- def __init__(self, objVar,**kwargs):
+ def __init__(self, objVar, postmergePkgs, **kwargs):
self.checkNumberTemplate = True
Template.__init__(self, objVar, cltObj=False,**kwargs)
+ self.postmergePkgs = postmergePkgs
applyPackages = ["calculate-core"]
self.flagApplyTemplates = False
if self.objVar.Get("cl_name") in applyPackages:
@@ -6035,6 +6084,7 @@ class templateClt(scanDirectoryClt, Template):
# Пропуск шаблонов директорийscanningTemplates
if self.templDirNameFile == os.path.split(path)[1]:
return True
+ self.functObj.currentBelong = ""
# Проверка на переменные в названии файла
if not self.getNeedTemplate(path):
if self.getError():
diff --git calculate/lib/utils/files.py calculate/lib/utils/files.py
index e9d19ad..fca4e6e 100644
--- calculate/lib/utils/files.py
+++ calculate/lib/utils/files.py
@@ -44,13 +44,23 @@ def timeout(seconds):
signal.signal(signal.SIGALRM, original_handler)
try:
- from magic import open as type_file, MAGIC_NONE as MAGIC_NONE
-except ImportError:
+ from magic import (open as type_file, MAGIC_NONE, MAGIC_CONTINUE,
+ MAGIC_MIME_TYPE, MAGIC_COMPRESS,
+ MAGIC_MIME_ENCODING, MAGIC_SYMLINK)
+except ImportError as e:
try:
- from magic import open as type_file, NONE as MAGIC_NONE
+ from magic import (open as type_file, NONE as MAGIC_NONE,
+ CONTINUE as MAGIC_CONTNUE, MIME_TYPE as MAGIC_MIME_TYPE,
+ COMPRESS as MAGIC_COMPRESS,MIME_ENCODING as MIME_ENCODING,
+ SYMLINK as MAGIC_SYMLINK)
except:
type_file = None
- MAGIC_NONE = None
+ MAGIC_NONE = 0
+ MAGIC_SYMLINK = 0x002
+ MAGIC_COMPRESS = 0x004
+ MAGIC_CONTINUE = 0x020
+ MAGIC_MIME_TYPE = 0x010
+ MAGIC_MIME_ENCODING = 0x400
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_lib3',sys.modules[__name__])
@@ -273,22 +283,33 @@ class proxy_type_file:
def close(self):
pass
+ def _get_cmd_by_flags(self,flags):
+ """
+ Получить команду для выполнения по флагам
+ """
+ paramdict = {MAGIC_CONTINUE:"-k",
+ MAGIC_SYMLINK:"-L",
+ MAGIC_MIME_TYPE:"--mime-type",
+ MAGIC_MIME_ENCODING:"--mime-encoding",
+ MAGIC_COMPRESS:"-z"}
+ appendParam = map(lambda x:paramdict[x],
+ filter(lambda x:flags & x,
+ sorted(paramdict.keys())))
+ fileCmd = getProgPath('/usr/bin/file')
+ return [fileCmd,'-b']+appendParam
+
def file(self,filename):
if path.exists(filename):
- if self.flags == 0x410:
- processFile = process("file","-bi",filename)
- if processFile.success():
- return processFile.read().rstrip()
- else:
- processFile = process("file","-bz",filename)
- if processFile.success():
- return processFile.read().rstrip()
+ processFile = \
+ process(*(self._get_cmd_by_flags(self.flags)+[filename]))
+ if processFile.success():
+ return processFile.read().rstrip()
return None
class typeFile:
"""Получение типа файла"""
- def __init__(self, magic=0x410):
+ def __init__(self, magic=MAGIC_MIME_ENCODING|MAGIC_MIME_TYPE):
if type_file is None:
self.magicObject = proxy_type_file(MAGIC_NONE)
else:
@@ -318,12 +339,10 @@ class typeFile:
def isBinary(self, filename):
"""является ли файл бинарным"""
mime = self.getMType(filename)
- # В случае ошибки
- if mime.count("`"):
- return mime
- elif mime.count("binary"):
+ if mime.startswith("text"):
+ return False
+ else:
return True
- return False
class scanDirectory:
"""Класс для cканирования директории"""
diff --git calculate/lib/utils/ip.py calculate/lib/utils/ip.py
index 5fd7c18..25d84b5 100644
--- calculate/lib/utils/ip.py
+++ calculate/lib/utils/ip.py
@@ -126,10 +126,17 @@ def intIpToStrIp(addr):
return "{0}.{1}.{2}.{3}".format(
addr>>24,(addr>>16)&0xff,(addr>>8)&0xff,addr&0xff)
+def numMaskToCidr(netmask):
+ """
+ Convert integer mask to cidr
+ """
+ neg_net = ctypes.c_uint32(~netmask).value
+ return 32 - int(math.log(neg_net,2))-1 if neg_net else 32
+
def maskToCidr(mask):
"""Convert mask specified by str to net"""
mask = strIpToIntIp(mask)
- return 32-int(math.log(((~mask) & 0xffffffff)+1,2))
+ return numMaskToCidr(mask)
def cidrToMask(cidr):
"""Convert net to mask specified by str"""
@@ -234,7 +241,7 @@ def getMask(iface):
finally:
sockfd.close()
netmask = socket.ntohl(struct.unpack('16sH2xI8x', res)[2])
- return 32 - int(math.log(ctypes.c_uint32(~netmask).value + 1, 2))
+ return numMaskToCidr(netmask)
def getMac(iface):
"""
diff --git calculate/lib/variables/__init__.py calculate/lib/variables/__init__.py
index 5bd1cf6..1f5bf42 100644
--- calculate/lib/variables/__init__.py
+++ calculate/lib/variables/__init__.py
@@ -41,4 +41,4 @@ class VariableClVer(ReadonlyVariable):
"""
Package version
"""
- value = "3.1.9"
+ value = "3.1.9.3"
diff --git calculate/lib/variables/env.py calculate/lib/variables/env.py
index 6d376e5..83ecdb4 100644
--- calculate/lib/variables/env.py
+++ calculate/lib/variables/env.py
@@ -402,3 +402,10 @@ class VariableClTemplateCltSet(ReadonlyVariable):
"""
def get(self):
return "on" if "clt" in self.Get('cl_templates_locate') else "off"
+
+class VariableClEnvDebugSet(ReadonlyVariable):
+ """
+ Переменная для включения отладки
+ """
+ type = "bool"
+ value = "off"
diff --git calculate/lib/variables/system.py calculate/lib/variables/system.py
index 1e43f15..70749aa 100644
--- calculate/lib/variables/system.py
+++ calculate/lib/variables/system.py
@@ -75,6 +75,20 @@ class VariableOsRootDev(ReadonlyVariable):
return {'none':'/dev/ram0'}.get(root_dev,root_dev)
return ""
+class VariableOsMapperRootDev(ReadonlyVariable):
+ """
+ Название диска через devicemapper если возможно
+ """
+ def get(self):
+ rootdev = self.Get('os_root_dev')
+ devLinks = getUdevDeviceInfo(name=rootdev).get("DEVLINKS","")
+ if devLinks:
+ mapperName = filter(lambda x:"/dev/mapper" in x,
+ devLinks.split())
+ if mapperName:
+ return mapperName[0]
+ return rootdev
+
class VariableOsRootType(ReadonlyVariable):
"""
Root type (ram, hdd, usb-hdd, livecd)

@ -27,6 +27,7 @@ EBUILD calculate-utilities-3.1.9-r10.ebuild 770 SHA256 89627950cd5b55242f10d21b8
EBUILD calculate-utilities-3.1.9-r11.ebuild 770 SHA256 5c9954c9dc5f9a40d7a7c8c93a5fd6d668f210c9ab0c030129dfdc144e9aa3fc SHA512 6c855be7ff517c71478f7eaa4cb46a0057fc8b93cf99c444d51fb8fcec14533fd79ab9e8d8d2f79185fcc69bb4f870a6c8cdef656642a1d65c3c86eabb16e9cf WHIRLPOOL d5747f80d0dbd7a2a7aa59ba80ea043934046d00e8140ae7aaa72f9e5f837887cca438e56915b1f2d0360503824f697b65fca832d9d04ff5add1bff0f7923330
EBUILD calculate-utilities-3.1.9-r12.ebuild 770 SHA256 536e591b62ffadab9997d244c79cb275155c82f7ab706d6128a16d33b9b5acb6 SHA512 ab38107db46546ef9ca9cb3c1e04ce021f4655b9fcbbe91c72e624465e4a3ab514c509c5cea0ea8b1d8ecdbf25fe35e35e008b5c80a91a3c1756143d0464b935 WHIRLPOOL ae6c69b56565a05e1b480707b83092d542e2017eae9afdb70b1cd9093df4bd28f0939672843cc5edb9a15f1c3e1d68f55da8ed7792d7343acfbd6b7b51557347
EBUILD calculate-utilities-3.1.9-r14.ebuild 770 SHA256 5ceac88292b4f811fbaa8db968c8e532f6fb7fd3fd828aea03ca7fd1fc0bb363 SHA512 a3eb6eec46b0fbca4d5dfcbd36cc8d674a0f5929f68516d93cc9053b4727e858e15d7f6cae30e4e4a14628e940120f746013a5b7d28cb6dd0f14cf4fca82fd2d WHIRLPOOL 94e7ed66e770224f2691694bcf2e34801e89378984e4cacdc73363d37810481a4d597da0c7e46c8b0a1a28e56d757e9b3720265663526296cf48961404b55efe
EBUILD calculate-utilities-3.1.9-r15.ebuild 770 SHA256 98888502982efc40c7607a0c65dfe0dadf20420401e94a32603da9333b33ad23 SHA512 7ff883a35e4123cf54fb9e48f02282547faf712239e314522bfd78a27f7b579e272b9bfc636bc4eb7ccd60f6ae0869a7a089316fe0230f9af7e2e41ed1488f4a WHIRLPOOL 468b4c64d7fd72f49eb07d2e18c9e9129113f9505d64f98074acad9ea10346c3cf44c3edcf4416c40145233a925261a647678d6481822b0cfcd381a7f6288333
EBUILD calculate-utilities-3.1.9-r2.ebuild 755 SHA256 d8ddfbab1db607f85edbc87db7010c0ab2c5653d52bec1c45448d0ee73be73a5 SHA512 9915e5edb2cf659f64ac1bb2f495c06b15e3e66f4df04ddef31d6da0cc275778d4ec574fb276ef7999677abd986da40862720f69b44625e699c673ae4dc3d717 WHIRLPOOL deb8fc8969e6c9e2898205762d99e3ce295d53c2b8829ffc3c9590452b0a16b0b003e0d2e19ae8c2d17b9b29c6f74b7c03b878a848f481d1bbe6d4b40ba924ba
EBUILD calculate-utilities-3.1.9-r3.ebuild 758 SHA256 7bdb0132b728c1a0b8ea57f0ea585afdc82f9d80aff5a13909bc152321a7ec28 SHA512 228155e8264c47456a5b375ef160e64557a87aa7e32adcb6136ef0df78f6a5b93c83d1293bf682bb00c7caa39821560ebf7c0c07200c5b65cf385b26e9607e64 WHIRLPOOL a2b35dd15636e6528f7828c9ebc1b1084c8cc3ba5384e68aea826f0c3b0220cd4376b35220eec77b40194c2ba62be1bc652407b45efab5ee999167d6c9cc90c7
EBUILD calculate-utilities-3.1.9-r4.ebuild 761 SHA256 14ec84c6cad91bc692b12b8ba2f3f78698f76a1570faf6cbf84f644aac6baecf SHA512 a51fa4a937eb13eb6ad7048f68e86903fcdbf37531668def216a3f745c253e353b5f893e91982bc16c874bfe82146dea2165c24ef26a9a28164923a772b72f40 WHIRLPOOL 4b185030c44756d36afda759a4d5f83156b42c7b9378f4045ba5cb9cbd3e9a1f1cb337184d642be9f844962fbfe4aa1d40086c07226b8688b7ea1e1078301845

@ -0,0 +1,26 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=4
DESCRIPTION="Calculate Utilities meta package"
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
SRC_URI=""
LICENSE="Apache-2.0"
SLOT="3"
KEYWORDS="amd64 x86"
IUSE="cl_consolegui cl_client cl_desktop cl_console"
RDEPEND="${RDEPEND}
=sys-apps/calculate-install-3.1.9-r4
=sys-apps/calculate-i18n-3.1.9
=sys-apps/calculate-lib-3.1.9-r7
=sys-apps/calculate-core-3.1.9-r4
=sys-apps/calculate-update-3.1.9
cl_client? ( =sys-apps/calculate-client-3.1.9-r2 )
cl_desktop? ( =sys-apps/calculate-desktop-3.1.9-r4 )
cl_consolegui? ( =sys-apps/calculate-console-gui-3.1.9-r1 )
cl_console? ( =sys-apps/calculate-console-3.1.9-r1 )
"
Loading…
Cancel
Save