xbps-src: improve msg_* funcs and update all callers.

This commit is contained in:
Juan RP 2010-12-20 00:22:12 +01:00
parent 24c7ac6808
commit 3da3783333
27 changed files with 184 additions and 173 deletions

View file

@ -46,13 +46,13 @@ pre_configure()
cd ${XBPS_SRCDISTDIR} || return 1 cd ${XBPS_SRCDISTDIR} || return 1
for p in $(seq -w 001 ${_bash_patchlevel}); do for p in $(seq -w 001 ${_bash_patchlevel}); do
[ -f ${XBPS_SRCDISTDIR}/bash41-${p} ] && continue [ -f ${XBPS_SRCDISTDIR}/bash41-${p} ] && continue
msg_normal " Fetching ${url}/bash41-$p ..." msg_normal " Fetching ${url}/bash41-$p ...\n"
$XBPS_FETCH_CMD ${url}/bash41-$p $XBPS_FETCH_CMD ${url}/bash41-$p
done done
fi fi
cd ${wrksrc} cd ${wrksrc}
for p in $(seq -w 001 ${_bash_patchlevel}); do for p in $(seq -w 001 ${_bash_patchlevel}); do
patch -s -Np0 -i ${XBPS_SRCDISTDIR}/bash41-${p} && \ patch -s -Np0 -i ${XBPS_SRCDISTDIR}/bash41-${p} && \
msg_normal "Applying patch bash41-$p." msg_normal " Applying patch bash41-$p.\n"
done done
} }

View file

@ -20,7 +20,7 @@ Add_dependency full ccsm
do_fetch() do_fetch()
{ {
msg_normal "Fetching source from master GIT repository..." msg_normal " Fetching source from master GIT repository...\n"
git clone git://anongit.opencompositing.org/users/crdlb/fusion-icon \ git clone git://anongit.opencompositing.org/users/crdlb/fusion-icon \
${pkgname}-${version} || return 1 ${pkgname}-${version} || return 1
} }

View file

@ -42,7 +42,7 @@ do_build()
# Configure # Configure
if [ -f ${FILESDIR}/$arch-dotconfig ]; then if [ -f ${FILESDIR}/$arch-dotconfig ]; then
msg_normal "Detected a .config file for your arch, using it." msg_normal " Detected a .config file for your arch, using it.\n"
cp -f ${FILESDIR}/$arch-dotconfig ${wrksrc}/.config cp -f ${FILESDIR}/$arch-dotconfig ${wrksrc}/.config
make ${makejobs} oldconfig make ${makejobs} oldconfig
else else

View file

@ -35,13 +35,14 @@ pre_configure()
for p in $(seq -w 001 ${_patch_ver}); do for p in $(seq -w 001 ${_patch_ver}); do
cd ${XBPS_SRCDISTDIR} || return 1 cd ${XBPS_SRCDISTDIR} || return 1
[ -f ${XBPS_SRCDISTDIR}/readline61-${p} ] && continue [ -f ${XBPS_SRCDISTDIR}/readline61-${p} ] && continue
msg_normal " Fetching $url/readline61-$p ...\n"
$XBPS_FETCH_CMD ${url}/readline61-$p $XBPS_FETCH_CMD ${url}/readline61-$p
done done
fi fi
cd ${wrksrc} cd ${wrksrc}
for p in $(seq -w 001 ${_patch_ver}); do for p in $(seq -w 001 ${_patch_ver}); do
patch -s -Np0 -i ${XBPS_SRCDISTDIR}/readline61-${p} && \ patch -s -Np0 -i ${XBPS_SRCDISTDIR}/readline61-${p} && \
msg_normal "Applying patch readline61-$p." msg_normal " Applying patch readline61-$p.\n"
done done
sed -i 's|-Wl,-rpath,$(libdir) ||g' support/shobj-conf sed -i 's|-Wl,-rpath,$(libdir) ||g' support/shobj-conf
} }

View file

@ -35,13 +35,13 @@ pre_configure()
cd ${XBPS_SRCDISTDIR} || return 1 cd ${XBPS_SRCDISTDIR} || return 1
for p in $(seq -w 001 ${_patchver}); do for p in $(seq -w 001 ${_patchver}); do
[ -f ${XBPS_SRCDISTDIR}/${_distver}.${p} ] && continue [ -f ${XBPS_SRCDISTDIR}/${_distver}.${p} ] && continue
msg_normal " Fetching ${url}/${_distver}-$p patch..." msg_normal " Fetching ${url}/${_distver}-$p patch...\n"
$XBPS_FETCH_CMD ${url}/${_distver}.$p 2>&1 $XBPS_FETCH_CMD ${url}/${_distver}.$p 2>&1
done done
fi fi
cd ${wrksrc} cd ${wrksrc}
for p in $(seq -w 001 ${_patchver}); do for p in $(seq -w 001 ${_patchver}); do
patch -s -Np0 -i ${XBPS_SRCDISTDIR}/${_distver}.${p} && \ patch -s -Np0 -i ${XBPS_SRCDISTDIR}/${_distver}.${p} && \
msg_normal "Applied patch ${_distver}.$p." msg_normal " Applied patch ${_distver}.$p.\n"
done done
} }

View file

@ -27,7 +27,7 @@ Add_dependency build openssl-devel
do_fetch() do_fetch()
{ {
msg_normal "Fetching source from http://xbps.googlecode.com/hg..." local url="http://xbps.googlecode.com/hg"
hg clone http://xbps.googlecode.com/hg \ msg_normal " Fetching source from $url ...\n"
${pkgname}-${version} 2>/dev/null || return 1 hg clone $url ${pkgname}-${version} 2>/dev/null
} }

View file

@ -27,9 +27,9 @@ Add_dependency full xorg-server
do_fetch() do_fetch()
{ {
msg_normal "Fetching from master git repository..." msg_normal " Fetching from master git repository...\n"
git clone git://anongit.freedesktop.org/xorg/driver/xf86-video-ati \ git clone git://anongit.freedesktop.org/xorg/driver/xf86-video-ati \
${pkgname}-${version} || return 1 ${pkgname}-${version}
} }
pre_configure() pre_configure()

View file

@ -39,8 +39,8 @@ replace_interpreter()
if [ -f $file ]; then if [ -f $file ]; then
sed -i -e "1s|^#![[:space:]]*${orsb}|#!${trpath}|" $file && \ sed -i -e "1s|^#![[:space:]]*${orsb}|#!${trpath}|" $file && \
msg_normal "Transformed $lang script: ${file##$wrksrc}." msg_normal "Transformed $lang script: ${file##$wrksrc}.\n"
else else
msg_warn "Ignoring unexistent $lang script: ${file##$wrksrc}." msg_warn "Ignoring unexistent $lang script: ${file##$wrksrc}.\n"
fi fi
} }

View file

@ -61,23 +61,21 @@ install_src_phase()
return 0 return 0
fi fi
cd $wrksrc || msg_error "can't change cwd to wrksrc!" cd $wrksrc || msg_error "can't change cwd to wrksrc!\n"
if [ -n "$build_wrksrc" ]; then if [ -n "$build_wrksrc" ]; then
cd $build_wrksrc \ cd $build_wrksrc \
|| msg_error "can't change cwd to build_wrksrc!" || msg_error "can't change cwd to build_wrksrc!\n"
fi fi
# Run pre_install func. # Run pre_install func.
if [ ! -f $XBPS_PRE_INSTALL_DONE ]; then if [ ! -f $XBPS_PRE_INSTALL_DONE ]; then
run_func pre_install run_func pre_install
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
msg_normal "Package '$pkgname': pre_install (destdir) phase done." msg_normal "'$pkgname-$lver': pre_install (destdir) phase done.\n"
touch -f $XBPS_PRE_INSTALL_DONE touch -f $XBPS_PRE_INSTALL_DONE
fi fi
fi fi
msg_normal "Package '$pkgname ($lver)': running install (destdir) phase."
# Type of installation: custom, make or python. # Type of installation: custom, make or python.
case "$build_style" in case "$build_style" in
custom-install) run_func do_install;; custom-install) run_func do_install;;
@ -87,22 +85,22 @@ install_src_phase()
;; ;;
*) run_func make_install;; *) run_func make_install;;
esac esac
cd ${wrksrc} || msg_error "can't change cwd to wrksrc!" cd ${wrksrc} || msg_error "can't change cwd to wrksrc!\n"
msg_normal "Package '$pkgname ($lver)': install (destdir) phase done." msg_normal "'$pkgname-$lver': install (destdir) phase done.\n"
# Run post_install func. # Run post_install func.
if [ ! -f $XBPS_POST_INSTALL_DONE ]; then if [ ! -f $XBPS_POST_INSTALL_DONE ]; then
run_func post_install run_func post_install
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
msg_normal "Package '$pkgname': post_install (destdir) phase done." msg_normal "'$pkgname-$lver': post_install (destdir) phase done.\n"
touch -f $XBPS_POST_INSTALL_DONE touch -f $XBPS_POST_INSTALL_DONE
fi fi
fi fi
# Remove libtool archives by default. # Remove libtool archives by default.
if [ -z "$keep_libtool_archives" ]; then if [ -z "$keep_libtool_archives" ]; then
msg_normal "Package '$pkgname ($lver)': removing libtool archives..." msg_normal "'$pkgname-$lver': removing libtool archives...\n"
find ${DESTDIR} -type f -name \*.la -delete find ${DESTDIR} -type f -name \*.la -delete
fi fi
# Always remove perllocal.pod and .packlist files. # Always remove perllocal.pod and .packlist files.
@ -112,10 +110,10 @@ install_src_phase()
fi fi
# Remove empty directories by default. # Remove empty directories by default.
if [ -z "$keep_empty_dirs" ]; then if [ -z "$keep_empty_dirs" ]; then
msg_normal "Package '$pkgname ($lver)': removing empty dirs..." msg_normal "'$pkgname-$lver': removing empty dirs...\n"
find ${DESTDIR} -depth -type d -exec rmdir 2>/dev/null {} \; find ${DESTDIR} -depth -type d -exec rmdir 2>/dev/null {} \;
fi fi
msg_normal "Package '$pkgname ($lver)': installed into destdir." msg_normal "'$pkgname-$lver': installed into destdir.\n"
if [ "$build_style" != "custom-install" -a -z "$distfiles" ]; then if [ "$build_style" != "custom-install" -a -z "$distfiles" ]; then
touch -f $XBPS_INSTALL_DONE touch -f $XBPS_INSTALL_DONE
@ -133,9 +131,9 @@ install_src_phase()
check_installed_pkg ${spkgrev} check_installed_pkg ${spkgrev}
[ $? -eq 0 ] && continue [ $? -eq 0 ] && continue
msg_normal "Package '${sourcepkg} ($lver)': preparing subpackage '${subpkg}'." msg_normal "'${sourcepkg}-$lver': preparing subpackage '${subpkg}'...\n"
if [ ! -f $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template ]; then if [ ! -f $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template ]; then
msg_error "Cannot find '${subpkg}' subpkg build template!" msg_error "Cannot find '${subpkg}' subpkg build template!\n"
fi fi
. $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template . $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template
pkgname=${subpkg} pkgname=${subpkg}
@ -146,7 +144,7 @@ install_src_phase()
touch -f ${wrksrc}/.xbps_do_install_${pkgname}_done touch -f ${wrksrc}/.xbps_do_install_${pkgname}_done
fi fi
else else
msg_normal "Package '$sourcepkg ($lver)': skipping '$pkgname' subpkg, already installed into destdir." msg_warn "'$sourcepkg-$lver': skipping '$pkgname' subpkg, already installed into destdir.\n"
fi fi
done done
} }

View file

@ -54,7 +54,7 @@ build_src_phase()
[ "$build_style" = "meta-template" -o \ [ "$build_style" = "meta-template" -o \
"$build_style" = "only-install" ] && return 0 "$build_style" = "only-install" ] && return 0
[ ! -d $wrksrc ] && msg_error "unexistent build directory [$wrksrc]" [ ! -d $wrksrc ] && msg_error "unexistent build directory [$wrksrc]\n"
cd $wrksrc || return 1 cd $wrksrc || return 1
if [ -n "$build_wrksrc" ]; then if [ -n "$build_wrksrc" ]; then
@ -80,13 +80,11 @@ build_src_phase()
if [ ! -f $XBPS_PRE_BUILD_DONE ]; then if [ ! -f $XBPS_PRE_BUILD_DONE ]; then
run_func pre_build run_func pre_build
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
msg_normal "$pkgname: pre_build phase done." msg_normal "'$pkgname-$lver': pre_build phase done.\n"
touch -f $XBPS_PRE_BUILD_DONE touch -f $XBPS_PRE_BUILD_DONE
fi fi
fi fi
msg_normal "Package '$pkgname ($lver)': running build phase."
if [ "$build_style" = "custom-install" ]; then if [ "$build_style" = "custom-install" ]; then
[ -n "$XBPS_LDFLAGS" ] && export LDFLAGS="$XBPS_LDFLAGS" [ -n "$XBPS_LDFLAGS" ] && export LDFLAGS="$XBPS_LDFLAGS"
run_func do_build run_func do_build
@ -94,13 +92,13 @@ build_src_phase()
run_func do_make_build run_func do_make_build
fi fi
msg_normal "Package '$pkgname ($lver)': build phase done." msg_normal "'$pkgname-$lver': build phase done.\n"
# Run post_build func. # Run post_build func.
if [ ! -f $XBPS_POST_BUILD_DONE ]; then if [ ! -f $XBPS_POST_BUILD_DONE ]; then
run_func post_build run_func post_build
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
msg_normal "Package '$pkgname': post_build phase done." msg_normal "'$pkgname-l$ver': post_build phase done.\n"
touch -f $XBPS_POST_BUILD_DONE touch -f $XBPS_POST_BUILD_DONE
fi fi
fi fi

View file

@ -44,15 +44,15 @@ install_pkg_deps()
fi fi
if [ -z "$saved_prevpkg" -a -n "${_ORIGINPKG}" ]; then if [ -z "$saved_prevpkg" -a -n "${_ORIGINPKG}" ]; then
msg_normal "Installing '${_ORIGINPKG}' dependency: '$curpkg'." msg_normal "Installing '${_ORIGINPKG}' dependency: '$curpkg'.\n"
else else
msg_normal "Installing '$saved_prevpkg' dependency: '$curpkg'." msg_normal "Installing '$saved_prevpkg' dependency: '$curpkg'.\n"
fi fi
setup_tmpl "$curpkgname" setup_tmpl "$curpkgname"
check_build_depends_pkg check_build_depends_pkg
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
msg_normal "Package dependency '$curpkgname' requires:" msg_normal "Package dependency '$curpkgname' requires:\n"
for j in ${build_depends}; do for j in ${build_depends}; do
jname="$(${XBPS_PKGDB_CMD} getpkgdepname ${j})" jname="$(${XBPS_PKGDB_CMD} getpkgdepname ${j})"
jver="$($XBPS_PKGDB_CMD version ${jname})" jver="$($XBPS_PKGDB_CMD version ${jname})"
@ -79,7 +79,7 @@ install_pkg_deps()
prev_pkg="$j" prev_pkg="$j"
install_pkg_deps "${j}" "${curpkg}" install_pkg_deps "${j}" "${curpkg}"
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
msg_red "install_pkg_deps: cannot install '$curpkg' ($j)." msg_red "install_pkg_deps: cannot install '$curpkg' ($j).\n"
return 1 return 1
fi fi
done done
@ -93,19 +93,19 @@ install_pkg_deps()
# Package not found, build from source. # Package not found, build from source.
install_pkg "${curpkgname}" install_pkg "${curpkgname}"
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
msg_red "cannot install '$curpkgname'!" msg_red "cannot install '$curpkgname'!\n"
return 1 return 1
fi fi
fi fi
else else
if [ -n "$saved_prevpkg" ]; then if [ -n "$saved_prevpkg" ]; then
msg_normal "Installing package '${curpkgname}' required by '${saved_prevpkg}'." msg_normal "Installing package '${curpkgname}' required by '${saved_prevpkg}'.\n"
else else
msg_normal "Installing package: '${curpkg}'." msg_normal "Installing package: '${curpkg}'.\n"
fi fi
install_pkg "${curpkgname}" install_pkg "${curpkgname}"
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
msg_red "install_pkg_deps: cannot install '$curpkgname'!" msg_red "install_pkg_deps: cannot install '$curpkgname'!\n"
return 1 return 1
fi fi
fi fi
@ -132,7 +132,7 @@ install_dependencies_pkg()
fi fi
if [ -n "$build_depends" ]; then if [ -n "$build_depends" ]; then
msg_normal "$pkgname: installing required package dependencies..." msg_normal "'$pkgname-$lver': required package build dependencies...\n"
fi fi
for i in ${build_depends}; do for i in ${build_depends}; do
pkgn="$($XBPS_PKGDB_CMD getpkgdepname ${i})" pkgn="$($XBPS_PKGDB_CMD getpkgdepname ${i})"
@ -140,7 +140,6 @@ install_dependencies_pkg()
check_pkgdep_matched "${i}" check_pkgdep_matched "${i}"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo " ${i}: found '$pkgn-$iver'." echo " ${i}: found '$pkgn-$iver'."
continue
else else
echo " ${i}: not found." echo " ${i}: not found."
notinstalled_deps="$notinstalled_deps $i" notinstalled_deps="$notinstalled_deps $i"
@ -153,7 +152,7 @@ install_dependencies_pkg()
for i in ${notinstalled_deps}; do for i in ${notinstalled_deps}; do
pkgdeplist="${pkgdeplist} \"${i}\" " pkgdeplist="${pkgdeplist} \"${i}\" "
done done
msg_normal "$pkgname: installing required dependencies from binpkgs..." msg_normal "$pkgname-$lver: installing build dependencies from binpkgs...\n"
${fakeroot_cmd} ${fakeroot_cmd_args} ${XBPS_BIN_CMD} \ ${fakeroot_cmd} ${fakeroot_cmd_args} ${XBPS_BIN_CMD} \
-y install ${pkgdeplist} -y install ${pkgdeplist}
rval=$? rval=$?
@ -186,7 +185,7 @@ install_dependencies_pkg()
setup_tmpl "$pkgn" setup_tmpl "$pkgn"
check_build_depends_pkg check_build_depends_pkg
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
msg_normal "Installing '$lpkgname' dependency: '$pkgn'." msg_normal "Installing '$lpkgname' dependency: '$pkgn'.\n"
if [ -n "$XBPS_PREFER_BINPKG_DEPS" ]; then if [ -n "$XBPS_PREFER_BINPKG_DEPS" ]; then
install_pkg_with_binpkg "${j}" install_pkg_with_binpkg "${j}"
rval=$? rval=$?
@ -200,21 +199,21 @@ install_dependencies_pkg()
# package not found, build source. # package not found, build source.
install_pkg "${pkgn}" install_pkg "${pkgn}"
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
msg_red "cannot install '$pkgn'!" msg_red "cannot install '$pkgn'!\n"
return 1 return 1
fi fi
fi fi
else else
install_pkg "${pkgn}" install_pkg "${pkgn}"
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
msg_red "cannot install '$pkgn'!" msg_red "cannot install '$pkgn'!\n"
return 1 return 1
fi fi
fi fi
else else
install_pkg_deps "${j}" "${pkg}" install_pkg_deps "${j}" "${pkg}"
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
msg_red "install_dependencies_pkg: cannot install pkgdeps required by $pkg ($j)." msg_red "cannot install pkgdeps required by $pkg ($j).\n"
return 1 return 1
fi fi
fi fi

View file

@ -29,13 +29,13 @@ check_installed_packages()
{ {
local f lpkgn lpkgver rv srcpkgver local f lpkgn lpkgver rv srcpkgver
msg_normal "Checking for newer packages from srcpkgs, please wait..." msg_normal "Checking for newer packages from srcpkgs, please wait...\n"
for f in $(${XBPS_BIN_CMD} list|awk '{print $1}'); do for f in $(${XBPS_BIN_CMD} list|awk '{print $1}'); do
lpkgn=$(${XBPS_PKGDB_CMD} getpkgname ${f}) lpkgn=$(${XBPS_PKGDB_CMD} getpkgname ${f})
lpkgver=$(${XBPS_PKGDB_CMD} getpkgversion ${f}) lpkgver=$(${XBPS_PKGDB_CMD} getpkgversion ${f})
if [ ! -r ${XBPS_SRCPKGDIR}/${lpkgn}/template ]; then if [ ! -r ${XBPS_SRCPKGDIR}/${lpkgn}/template ]; then
msg_warn "Installed package ${f} not available as source pkg, skipping." msg_warn "Installed package ${f} not available as source pkg, skipping.\n"
continue continue
fi fi
. ${XBPS_SRCPKGDIR}/${lpkgn}/template . ${XBPS_SRCPKGDIR}/${lpkgn}/template
@ -59,5 +59,5 @@ check_installed_packages()
fi fi
reset_tmpl_vars reset_tmpl_vars
done done
msg_normal "done." msg_normal "done.\n"
} }

View file

@ -47,7 +47,7 @@ if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
msg_normal "Entering into the chroot on $XBPS_MASTERDIR." msg_normal "Entering into the chroot on $XBPS_MASTERDIR.\n"
if [ ! -d $XBPS_MASTERDIR/usr/local/etc ]; then if [ ! -d $XBPS_MASTERDIR/usr/local/etc ]; then
mkdir -p $XBPS_MASTERDIR/usr/local/etc mkdir -p $XBPS_MASTERDIR/usr/local/etc
@ -77,7 +77,7 @@ if [ -n "$XBPS_COMPRESS_LEVEL" ]; then
fi fi
echo "# End of configuration file." >> $XBPSSRC_CF echo "# End of configuration file." >> $XBPSSRC_CF
msg_normal "Cleaning up /tmp..." msg_normal "Cleaning up /tmp...\n"
if [ -d $XBPS_MASTERDIR/tmp ]; then if [ -d $XBPS_MASTERDIR/tmp ]; then
rm -rf $XBPS_MASTERDIR/tmp/* rm -rf $XBPS_MASTERDIR/tmp/*
fi fi
@ -166,7 +166,7 @@ prepare_binpkg_repos()
if [ ! -f ${XBPS_PACKAGESDIR}/${xbps_machine}/pkg-index.plist ]; then if [ ! -f ${XBPS_PACKAGESDIR}/${xbps_machine}/pkg-index.plist ]; then
: :
else else
msg_normal "Registering local repository..." msg_normal "Registering local repository...\n"
${chroot_cmd} $XBPS_MASTERDIR \ ${chroot_cmd} $XBPS_MASTERDIR \
${XBPS_REPO_CMD} add /xbps_packagesdir 2>/dev/null ${XBPS_REPO_CMD} add /xbps_packagesdir 2>/dev/null
[ $? -eq 0 ] && touch -f \ [ $? -eq 0 ] && touch -f \
@ -176,7 +176,7 @@ prepare_binpkg_repos()
for repo in ${XBPS_REPO_LIST}; do for repo in ${XBPS_REPO_LIST}; do
${chroot_cmd} ${XBPS_MASTERDIR} ${XBPS_REPO_CMD} \ ${chroot_cmd} ${XBPS_MASTERDIR} ${XBPS_REPO_CMD} \
add ${repo} 2>/dev/null add ${repo} 2>/dev/null
[ $? -ne 0 ] && msg_warn "Failed to sync pkg-index from ${repo}" [ $? -ne 0 ] && msg_warn "Failed to sync pkg-index from ${repo}\n"
done done
} }
@ -268,7 +268,7 @@ xbps_chroot_handler()
fi fi
# Reinstall xbps-src in the chroot # Reinstall xbps-src in the chroot
msg_normal "Installing xbps-src in the masterdir..." msg_normal "Installing xbps-src in the masterdir...\n"
env in_chroot=yes LANG=C PATH=$path \ env in_chroot=yes LANG=C PATH=$path \
${chroot_cmd} $XBPS_MASTERDIR sh -c \ ${chroot_cmd} $XBPS_MASTERDIR sh -c \
"cd /xbps/xbps-src && make IN_CHROOT=1 install clean" \ "cd /xbps/xbps-src && make IN_CHROOT=1 install clean" \
@ -290,7 +290,7 @@ xbps_chroot_handler()
fi fi
rm -f ${XBPS_MASTERDIR}/.xbps_chroot_working rm -f ${XBPS_MASTERDIR}/.xbps_chroot_working
msg_normal "Exiting from the chroot on $XBPS_MASTERDIR." msg_normal "Exiting from the chroot on $XBPS_MASTERDIR.\n"
return $rv return $rv
} }

View file

@ -28,20 +28,32 @@
# #
run_func_error() run_func_error()
{ {
local func="$1" local lver func="$1"
remove_pkgdestdir_sighandler ${pkgname} remove_pkgdestdir_sighandler ${pkgname}
msg_error "${pkgname}-${version}: the $func function didn't complete due to errors or SIGINT!"
if [ -n "${revision}" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
msg_error "'${pkgname}-${lver}': '$func' phase didn't complete due to errors or SIGINT!\n"
} }
remove_pkgdestdir_sighandler() remove_pkgdestdir_sighandler()
{ {
local subpkg _pkgname="$1" local lver subpkg _pkgname="$1"
setup_tmpl ${_pkgname} setup_tmpl ${_pkgname}
[ -z "$sourcepkg" ] && return 0 [ -z "$sourcepkg" ] && return 0
if [ -n "${revision}" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
# If there is any problem in the middle of writting the metadata, # If there is any problem in the middle of writting the metadata,
# just remove all files from destdir of pkg. # just remove all files from destdir of pkg.
@ -57,7 +69,7 @@ remove_pkgdestdir_sighandler()
if [ -d "$XBPS_DESTDIR/${sourcepkg}-${version%_*}" ]; then if [ -d "$XBPS_DESTDIR/${sourcepkg}-${version%_*}" ]; then
rm -rf "$XBPS_DESTDIR/${sourcepkg}-${version%_*}" rm -rf "$XBPS_DESTDIR/${sourcepkg}-${version%_*}"
fi fi
msg_red "Removed '${sourcepkg}-${version}' files from DESTDIR..." msg_red "'${sourcepkg}-${lver}': removed files from DESTDIR...\n"
} }
var_is_a_function() var_is_a_function()
@ -79,10 +91,16 @@ var_is_a_function()
run_func() run_func()
{ {
local func="$1" local func="$1"
local rval logpipe logfile local lver rval logpipe logfile
[ -z "$func" ] && return 1 [ -z "$func" ] && return 1
if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
var_is_a_function $func var_is_a_function $func
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
logpipe=/tmp/logpipe.$$ logpipe=/tmp/logpipe.$$
@ -97,6 +115,7 @@ run_func()
exec 1>"$logpipe" 2>"$logpipe" exec 1>"$logpipe" 2>"$logpipe"
set -e set -e
trap "run_func_error $func" 0 trap "run_func_error $func" 0
msg_normal "'$pkgname-$lver': running $func phase...\n"
$func 2>&1 $func 2>&1
set +e set +e
trap '' 0 trap '' 0
@ -109,14 +128,12 @@ run_func()
msg_red() msg_red()
{ {
[ -z "$1" ] && return 1
# error messages in bold/red # error messages in bold/red
printf "\033[1m\033[31m" printf "\033[1m\033[31m"
if [ -n "$in_chroot" ]; then if [ -n "$in_chroot" ]; then
echo "[chroot] => ERROR: $1" printf "[chroot] => ERROR: $@"
else else
echo "=> ERROR: $1" printf "=> ERROR: $@"
fi fi
printf "\033[m" printf "\033[m"
} }
@ -129,10 +146,8 @@ msg_error()
msg_error_nochroot() msg_error_nochroot()
{ {
[ -z "$1" ] && return 1
printf "\033[1m\033[31m" printf "\033[1m\033[31m"
echo "=> ERROR: $1" printf "=> ERROR: $@"
printf "\033[m" printf "\033[m"
exit 1 exit 1
@ -140,37 +155,36 @@ msg_error_nochroot()
msg_warn() msg_warn()
{ {
[ -z "$1" ] && return 1
# warn messages in bold/yellow # warn messages in bold/yellow
printf "\033[1m\033[33m" printf "\033[1m\033[33m"
if [ -n "$in_chroot" ]; then if [ -n "$in_chroot" ]; then
echo "[chroot] => WARNING: $1" printf "[chroot] => WARNING: $@"
else else
echo "=> WARNING: $1" printf "=> WARNING: $@"
fi fi
printf "\033[m" printf "\033[m"
} }
msg_warn_nochroot() msg_warn_nochroot()
{ {
[ -z "$1" ] && return 1
printf "\033[1m\033[33m" printf "\033[1m\033[33m"
echo "=> WARNING: $1" printf "=> WARNING: $@"
printf "\033[m" printf "\033[m"
} }
msg_normal() msg_normal()
{ {
[ -z "$1" ] && return 1
# normal messages in bold # normal messages in bold
printf "\033[1m" printf "\033[1m"
if [ -n "$in_chroot" ]; then if [ -n "$in_chroot" ]; then
echo "[chroot] => $1" printf "[chroot] => $@"
else else
echo "=> $1" printf "=> $@"
fi fi
printf "\033[m" printf "\033[m"
} }
msg_normal_append()
{
printf "\033[1m$@\033[m"
}

View file

@ -86,13 +86,13 @@ configure_src_phase()
lver="${version}" lver="${version}"
fi fi
cd $wrksrc || msg_error "unexistent build directory [$wrksrc]." cd $wrksrc || msg_error "unexistent build directory [$wrksrc].\n"
# Run pre_configure func. # Run pre_configure func.
if [ ! -f $XBPS_PRECONFIGURE_DONE ]; then if [ ! -f $XBPS_PRECONFIGURE_DONE ]; then
run_func pre_configure run_func pre_configure
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
msg_normal "Package '$pkgname': pre_configure phase done." msg_normal "'$pkgname-$lver': pre_configure phase done.\n"
touch -f $XBPS_PRECONFIGURE_DONE touch -f $XBPS_PRECONFIGURE_DONE
fi fi
fi fi
@ -102,8 +102,6 @@ configure_src_phase()
export "$f" export "$f"
done done
msg_normal "Package '$pkgname ($lver)': running configure phase."
[ -z "$configure_script" ] && configure_script="./configure" [ -z "$configure_script" ] && configure_script="./configure"
cd $wrksrc || return 1 cd $wrksrc || return 1
@ -123,17 +121,17 @@ configure_src_phase()
# #
# Unknown build_style type won't work :-) # Unknown build_style type won't work :-)
# #
msg_error "package '$pkgname': unknown build_style [$build_style]" msg_error "'$pkgname-$lver': unknown build_style [$build_style]\n"
;; ;;
esac esac
msg_normal "Package '$pkgname ($lver)': configure phase done." msg_normal "'$pkgname-$lver': configure phase done.\n"
# Run post_configure func. # Run post_configure func.
if [ ! -f $XBPS_POSTCONFIGURE_DONE ]; then if [ ! -f $XBPS_POSTCONFIGURE_DONE ]; then
run_func post_configure run_func post_configure
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
msg_normal "Package '$pkgname': post_configure phase done." msg_normal "'$pkgname-$lver': post_configure phase done."
touch -f $XBPS_POSTCONFIGURE_DONE touch -f $XBPS_POSTCONFIGURE_DONE
fi fi
fi fi

View file

@ -33,7 +33,7 @@ extract_distfiles()
[ -f $XBPS_EXTRACT_DONE ] && return 0 [ -f $XBPS_EXTRACT_DONE ] && return 0
[ -z "$in_chroot" -a ! -w $XBPS_BUILDDIR ] && \ [ -z "$in_chroot" -a ! -w $XBPS_BUILDDIR ] && \
msg_error "can't extract distfile(s) (permission denied)" msg_error "can't extract distfile(s) (permission denied)\n"
# #
# If we are being called via the target, just extract and return. # If we are being called via the target, just extract and return.
@ -63,7 +63,7 @@ extract_distfiles()
for f in ${distfiles}; do for f in ${distfiles}; do
curfile=$(basename $f) curfile=$(basename $f)
if [ ! -f ${XBPS_SRCDISTDIR}/${curfile} ]; then if [ ! -f ${XBPS_SRCDISTDIR}/${curfile} ]; then
msg_error "cannot find ${curfile}, use 'xbps-src fetch' first." msg_error "cannot find ${curfile}, use 'xbps-src fetch' first.\n"
fi fi
done done
@ -71,7 +71,7 @@ extract_distfiles()
mkdir -p ${wrksrc} || return 1 mkdir -p ${wrksrc} || return 1
fi fi
msg_normal "Package '$pkgname ($lver)': extracting distfile(s), please wait..." msg_normal "'$pkgname-$lver': extracting distfile(s), please wait...\n"
for f in ${distfiles}; do for f in ${distfiles}; do
curfile=$(basename $f) curfile=$(basename $f)
@ -99,7 +99,7 @@ extract_distfiles()
elif $(echo $f|grep -q '.zip'); then elif $(echo $f|grep -q '.zip'); then
cursufx="zip" cursufx="zip"
else else
msg_error "unknown distfile suffix for $curfile." msg_error "unknown distfile suffix for $curfile.\n"
fi fi
if [ -n "$create_wrksrc" ]; then if [ -n "$create_wrksrc" ]; then
@ -111,23 +111,23 @@ extract_distfiles()
case ${cursufx} in case ${cursufx} in
txz) txz)
if ! command -v xz 2>&1 >/dev/null; then if ! command -v xz 2>&1 >/dev/null; then
msg_error "cannot find xz for extraction." msg_error "cannot find xz for extraction.\n"
fi fi
tar xfJ $XBPS_SRCDISTDIR/$curfile -C $extractdir tar xfJ $XBPS_SRCDISTDIR/$curfile -C $extractdir
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR." msg_error "extracting $curfile into $XBPS_BUILDDIR.\n"
fi fi
;; ;;
tbz) tbz)
tar xfj $XBPS_SRCDISTDIR/$curfile -C $extractdir tar xfj $XBPS_SRCDISTDIR/$curfile -C $extractdir
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR." msg_error "extracting $curfile into $XBPS_BUILDDIR.\n"
fi fi
;; ;;
tgz) tgz)
tar xfz $XBPS_SRCDISTDIR/$curfile -C $extractdir tar xfz $XBPS_SRCDISTDIR/$curfile -C $extractdir
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR." msg_error "extracting $curfile into $XBPS_BUILDDIR.\n"
fi fi
;; ;;
gz|bz2) gz|bz2)
@ -141,7 +141,7 @@ extract_distfiles()
tar) tar)
tar xf $XBPS_SRCDISTDIR/$curfile -C $extractdir tar xf $XBPS_SRCDISTDIR/$curfile -C $extractdir
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR." msg_error "extracting $curfile into $XBPS_BUILDDIR.\n"
fi fi
;; ;;
zip) zip)
@ -149,14 +149,14 @@ extract_distfiles()
unzip -q -x $XBPS_SRCDISTDIR/$curfile \ unzip -q -x $XBPS_SRCDISTDIR/$curfile \
-d $extractdir -d $extractdir
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR." msg_error "extracting $curfile into $XBPS_BUILDDIR.\n"
fi fi
else else
msg_error "cannot find unzip bin for extraction" msg_error "cannot find unzip bin for extraction.\n"
fi fi
;; ;;
*) *)
msg_error "cannot guess $curfile extract suffix. ($cursufx)" msg_error "cannot guess $curfile extract suffix. ($cursufx)\n"
;; ;;
esac esac
done done

View file

@ -34,12 +34,12 @@ verify_sha256_cksum()
[ -z "$file" -o -z "$cksum" ] && return 1 [ -z "$file" -o -z "$cksum" ] && return 1
msg_normal "'$pkgname-$lver': verifying checksum for $file... "
filesum=$(${XBPS_DIGEST_CMD} $XBPS_SRCDISTDIR/$file) filesum=$(${XBPS_DIGEST_CMD} $XBPS_SRCDISTDIR/$file)
if [ "$origsum" != "$filesum" ]; then if [ "$origsum" != "$filesum" ]; then
msg_error "SHA256 checksum doesn't match for $file." msg_error "SHA256 checksum doesn't match for $file.\n"
fi fi
msg_normal_append "OK.\n"
msg_normal "Package '$pkgname ($lver)': SHA256 checksum OK for $file."
} }
# #
@ -69,7 +69,6 @@ fetch_distfiles()
fi fi
if [ -n "$nofetch" ]; then if [ -n "$nofetch" ]; then
msg_normal "Package '$pkgname ($lver)': running do_fetch phase."
cd ${XBPS_BUILDDIR} && run_func do_fetch && return $? cd ${XBPS_BUILDDIR} && run_func do_fetch && return $?
fi fi
@ -88,10 +87,9 @@ fetch_distfiles()
done done
if [ -z $found ]; then if [ -z $found ]; then
msg_error "cannot find checksum for $curfile." msg_error "cannot find checksum for $curfile.\n"
fi fi
msg_normal "Package '$pkgname ($lver)': verifying checksum for $curfile..."
verify_sha256_cksum $curfile $cksum verify_sha256_cksum $curfile $cksum
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
unset cksum found unset cksum found
@ -101,7 +99,7 @@ fetch_distfiles()
fi fi
fi fi
msg_normal "Package '$pkgname ($lver)': fetching distfile $curfile." msg_normal "'$pkgname-$lver': fetching distfile $curfile...\n"
if [ -n "$distfiles" ]; then if [ -n "$distfiles" ]; then
localurl="$f" localurl="$f"
@ -113,9 +111,9 @@ fetch_distfiles()
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
unset localurl unset localurl
if [ ! -f $XBPS_SRCDISTDIR/$curfile ]; then if [ ! -f $XBPS_SRCDISTDIR/$curfile ]; then
msg_error "couldn't fetch $curfile." msg_error "couldn't fetch $curfile.\n"
else else
msg_error "there was an error fetching $curfile." msg_error "there was an error fetching $curfile.\n"
fi fi
else else
unset localurl unset localurl
@ -133,7 +131,7 @@ fetch_distfiles()
done done
if [ -z $found ]; then if [ -z $found ]; then
msg_error "cannot find checksum for $curfile." msg_error "cannot find checksum for $curfile.\n"
fi fi
verify_sha256_cksum $curfile $cksum verify_sha256_cksum $curfile $cksum

View file

@ -47,7 +47,7 @@ binpkg_cleanup()
{ {
local pkgdir="$1" binpkg="$2" local pkgdir="$1" binpkg="$2"
printf "\nInterrupted! removing $binpkg file!\n" msg_red "\nInterrupted! removing $binpkg file!\n"
rm -f $pkgdir/$binpkg rm -f $pkgdir/$binpkg
exit 1 exit 1
} }
@ -61,7 +61,7 @@ xbps_make_binpkg_real()
local mfiles binpkg pkgdir arch lver dirs _dirs d clevel local mfiles binpkg pkgdir arch lver dirs _dirs d clevel
if [ ! -d "${DESTDIR}" ]; then if [ ! -d "${DESTDIR}" ]; then
msg_warn "cannot find destdir for $pkgname... skipping!" msg_warn "cannot find destdir for $pkgname... skipping!\n"
return 0 return 0
fi fi
cd ${DESTDIR} cd ${DESTDIR}
@ -82,7 +82,7 @@ xbps_make_binpkg_real()
# Don't overwrite existing binpkgs by default, skip them. # Don't overwrite existing binpkgs by default, skip them.
# #
if [ -f $pkgdir/$binpkg ]; then if [ -f $pkgdir/$binpkg ]; then
echo "=> Skipping existing $binpkg pkg..." msg_normal "Skipping existing $binpkg pkg...\n"
return 0 return 0
fi fi
@ -112,16 +112,16 @@ xbps_make_binpkg_real()
# Remove binpkg if interrupted... # Remove binpkg if interrupted...
trap "binpkg_cleanup $pkgdir $binpkg" INT trap "binpkg_cleanup $pkgdir $binpkg" INT
echo -n "=> Building $binpkg... " msg_normal "Building $binpkg... "
${fakeroot_cmd} ${fakeroot_cmd_args} \ ${fakeroot_cmd} ${fakeroot_cmd_args} \
tar --exclude "var/db/xbps/metadata/*/flist" \ tar --exclude "var/db/xbps/metadata/*/flist" \
-cpf - ${mfiles} ${dirs} | \ -cpf - ${mfiles} ${dirs} | \
$XBPS_COMPRESS_CMD ${clevel} -qf > $pkgdir/$binpkg $XBPS_COMPRESS_CMD ${clevel} -qf > $pkgdir/$binpkg
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "done." msg_normal_append "done.\n"
else else
rm -f $pkgdir/$binpkg rm -f $pkgdir/$binpkg
echo "failed!" msg_normal_append "failed!\n"
fi fi
return $? return $?

View file

@ -50,7 +50,7 @@ xbps_write_metadata_pkg()
[ $? -eq 0 ] && continue [ $? -eq 0 ] && continue
if [ ! -f $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template ]; then if [ ! -f $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template ]; then
msg_error "Cannot find subpkg '${subpkg}' build template!" msg_error "Cannot find subpkg '${subpkg}' build template!\n"
fi fi
setup_tmpl ${sourcepkg} setup_tmpl ${sourcepkg}
unset run_depends conf_files noarch triggers replaces \ unset run_depends conf_files noarch triggers replaces \
@ -94,8 +94,7 @@ xbps_write_metadata_pkg_real()
local fpattern="s|${DESTDIR}||g;s|^\./$||g;/^$/d" local fpattern="s|${DESTDIR}||g;s|^\./$||g;/^$/d"
if [ ! -d "${DESTDIR}" ]; then if [ ! -d "${DESTDIR}" ]; then
echo "ERROR: $pkgname not installed into destdir." msg_error "$pkgname not installed into destdir.\n"
exit 1
fi fi
if [ -n "$noarch" ]; then if [ -n "$noarch" ]; then
@ -125,7 +124,7 @@ xbps_write_metadata_pkg_real()
fi fi
# Add info-files trigger. # Add info-files trigger.
triggers="info-files $triggers" triggers="info-files $triggers"
msg_normal "Package '$pkgname ($lver)': processing info(1) files..." msg_normal "'$pkgname-$lver': processing info(1) files...\n"
find ${DESTDIR}/usr/share/info -type f -follow | while read f find ${DESTDIR}/usr/share/info -type f -follow | while read f
do do
@ -160,7 +159,7 @@ xbps_write_metadata_pkg_real()
# compress all them with gzip. # compress all them with gzip.
# #
if [ -d "${DESTDIR}/usr/share/man" ]; then if [ -d "${DESTDIR}/usr/share/man" ]; then
msg_normal "Package '$pkgname ($lver)': processing manual pages..." msg_normal "'$pkgname-$lver': processing manual pages...\n"
find ${DESTDIR}/usr/share/man -type f -follow | while read f find ${DESTDIR}/usr/share/man -type f -follow | while read f
do do
j=$(echo "$f"|sed -e "$fpattern") j=$(echo "$f"|sed -e "$fpattern")
@ -183,7 +182,7 @@ xbps_write_metadata_pkg_real()
fi fi
cd ${DESTDIR} cd ${DESTDIR}
msg_normal "Package '$pkgname ($lver)': creating package metadata..." msg_normal "'$pkgname-$lver': creating package metadata...\n"
write_metadata_flist_header $TMPFPLIST write_metadata_flist_header $TMPFPLIST
@ -356,7 +355,7 @@ _EOF
if [ ! -d $metadir ]; then if [ ! -d $metadir ]; then
mkdir -p $metadir >/dev/null 2>&1 mkdir -p $metadir >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "ERROR: you don't have enough perms for this." msg_red "you don't have enough perms for this!\n"
rm -f $TMPFLIST $TMPFPROPS rm -f $TMPFLIST $TMPFPROPS
exit 1 exit 1
fi fi
@ -386,5 +385,5 @@ _EOF
xbps_write_metadata_scripts_pkg remove; \ xbps_write_metadata_scripts_pkg remove; \
} || return $? } || return $?
msg_normal "Package '$pkgname ($lver)': successfully created package metadata." msg_normal "'$pkgname-$lver': successfully created package metadata.\n"
} }

View file

@ -218,7 +218,7 @@ _EOF
for f in ${triggers}; do for f in ${triggers}; do
if [ ! -f $XBPS_TRIGGERSDIR/$f ]; then if [ ! -f $XBPS_TRIGGERSDIR/$f ]; then
rm -f $tmpf rm -f $tmpf
msg_error "$pkgname: unknown trigger $f, aborting!" msg_error "$pkgname: unknown trigger $f, aborting!\n"
fi fi
done done
for f in ${triggers}; do for f in ${triggers}; do

View file

@ -1,5 +1,5 @@
#- #-
# Copyright (c) 2008-2009 Juan Romero Pardines. # Copyright (c) 2008-2010 Juan Romero Pardines.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -29,7 +29,7 @@
# #
_process_patch() _process_patch()
{ {
local args _patch i=$1 local lver args _patch i=$1
args="-Np0" args="-Np0"
_patch=$(basename $i) _patch=$(basename $i)
@ -40,6 +40,12 @@ _process_patch()
fi fi
cp -f $i $wrksrc cp -f $i $wrksrc
if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
# Try to guess if its a compressed patch. # Try to guess if its a compressed patch.
if $(echo $i|grep -q '.diff.gz'); then if $(echo $i|grep -q '.diff.gz'); then
gunzip $wrksrc/${_patch} gunzip $wrksrc/${_patch}
@ -58,15 +64,15 @@ _process_patch()
elif $(echo $i|grep -q '.patch'); then elif $(echo $i|grep -q '.patch'); then
: :
else else
msg_warn "unknown patch type: $i." msg_warn "'$pkgname-$lver': unknown patch type: $i.\n"
continue continue
fi fi
cd $wrksrc && patch -s ${args} < ${_patch} 2>/dev/null cd $wrksrc && patch -s ${args} < ${_patch} 2>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
msg_normal "Patch applied: ${_patch}." msg_normal "'$pkgname-$lver': Patch applied: ${_patch}.\n"
else else
msg_error "couldn't apply patch: ${_patch}." msg_error "'$pkgname-$lver': couldn't apply patch: ${_patch}.\n"
fi fi
} }

View file

@ -70,7 +70,7 @@ install_pkg()
# #
unset doing_deps unset doing_deps
setup_tmpl $curpkgn setup_tmpl $curpkgn
msg_normal "Installing '$pkgname'..." msg_normal "Installing '$pkgname'...\n"
fi fi
# #
@ -83,7 +83,7 @@ install_pkg()
. $XBPS_SHUTILSDIR/extract_funcs.sh . $XBPS_SHUTILSDIR/extract_funcs.sh
extract_distfiles extract_distfiles
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_red "cannot extract distfiles for '$pkgname'!" msg_red "cannot extract distfiles for '$pkgname'!\n"
return 1 return 1
fi fi
fi fi
@ -92,7 +92,7 @@ install_pkg()
. $XBPS_SHUTILSDIR/configure_funcs.sh . $XBPS_SHUTILSDIR/configure_funcs.sh
configure_src_phase configure_src_phase
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_red "cannot configure '$pkgname'!" msg_red "cannot configure '$pkgname'!\n"
return 1 return 1
fi fi
fi fi
@ -101,7 +101,7 @@ install_pkg()
. $XBPS_SHUTILSDIR/build_funcs.sh . $XBPS_SHUTILSDIR/build_funcs.sh
build_src_phase build_src_phase
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_red "cannot build '$pkgname'!" msg_red "cannot build '$pkgname'!\n"
return 1 return 1
fi fi
fi fi
@ -112,7 +112,7 @@ install_pkg()
${fakeroot_cmd} ${fakeroot_cmd_args} \ ${fakeroot_cmd} ${fakeroot_cmd_args} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-doinst-helper ${curpkgn} @@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-doinst-helper ${curpkgn}
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_red "xbps-src-doinst-helper failed for '$pkgname'!" msg_red "xbps-src-doinst-helper failed for '$pkgname'!\n"
return 1 return 1
fi fi
@ -127,7 +127,7 @@ install_pkg()
trap 'remove_pkgdestdir_sighandler ${pkgname}' 0 INT trap 'remove_pkgdestdir_sighandler ${pkgname}' 0 INT
xbps_write_metadata_pkg xbps_write_metadata_pkg
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_red "cannot write package metadata for '$pkgname'!" msg_red "cannot write package metadata for '$pkgname'!\n"
trap '' 0 INT trap '' 0 INT
return 1 return 1
fi fi
@ -139,7 +139,7 @@ install_pkg()
. $XBPS_SHUTILSDIR/stow_funcs.sh . $XBPS_SHUTILSDIR/stow_funcs.sh
stow_pkg_handler stow stow_pkg_handler stow
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_red "cannot stow '$pkgname'!" msg_red "cannot stow '$pkgname'!\n"
return 1 return 1
fi fi
@ -159,7 +159,7 @@ install_pkg_with_binpkg()
{ {
local pkgpattern="$1" local pkgpattern="$1"
msg_normal "Installing binary pkg: $pkgpattern" msg_normal "Installing binary pkg: $pkgpattern\n"
${fakeroot_cmd} ${fakeroot_cmd_args} ${XBPS_BIN_CMD} \ ${fakeroot_cmd} ${fakeroot_cmd_args} ${XBPS_BIN_CMD} \
-y install \""$pkgpattern\"" -y install \""$pkgpattern\""
return $? return $?
@ -172,10 +172,10 @@ list_pkg_files()
{ {
local pkg="$1" ver= local pkg="$1" ver=
[ -z $pkg ] && msg_error "unexistent package, aborting." [ -z $pkg ] && msg_error "unexistent package, aborting.\n"
ver=$($XBPS_PKGDB_CMD version $pkg) ver=$($XBPS_PKGDB_CMD version $pkg)
[ -z "$ver" ] && msg_error "$pkg is not installed." [ -z "$ver" ] && msg_error "$pkg is not installed.\n"
cat $XBPS_PKGMETADIR/$pkg/flist cat $XBPS_PKGMETADIR/$pkg/flist
} }
@ -187,10 +187,10 @@ remove_pkg()
{ {
local subpkg ver local subpkg ver
[ -z $pkgname ] && msg_error "unexistent package, aborting." [ -z $pkgname ] && msg_error "unexistent package, aborting.\n"
ver=$($XBPS_PKGDB_CMD version $pkgname) ver=$($XBPS_PKGDB_CMD version $pkgname)
[ -z "$ver" ] && msg_error "$pkgname is not installed." [ -z "$ver" ] && msg_error "$pkgname is not installed.\n"
. $XBPS_SHUTILSDIR/stow_funcs.sh . $XBPS_SHUTILSDIR/stow_funcs.sh
stow_pkg_handler unstow || return $? stow_pkg_handler unstow || return $?

View file

@ -40,7 +40,7 @@ stow_pkg_handler()
[ $? -eq 0 ] && continue [ $? -eq 0 ] && continue
fi fi
if [ ! -f $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template ]; then if [ ! -f $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template ]; then
msg_error "Cannot find $subpkg subpkg build template!" msg_error "Cannot find $subpkg subpkg build template!\n"
fi fi
unset revision pre_install pre_remove post_install \ unset revision pre_install pre_remove post_install \
post_remove post_stow post_remove post_stow
@ -74,7 +74,7 @@ stow_pkg_real()
[ -z "$pkgname" ] && return 2 [ -z "$pkgname" ] && return 2
if [ $(id -u) -ne 0 ] && [ ! -w $XBPS_MASTERDIR ]; then if [ $(id -u) -ne 0 ] && [ ! -w $XBPS_MASTERDIR ]; then
msg_error "cannot stow $pkgname! (permission denied)" msg_error "cannot stow $pkgname! (permission denied)\n"
fi fi
if [ "$build_style" = "meta-template" ]; then if [ "$build_style" = "meta-template" ]; then
@ -90,7 +90,7 @@ stow_pkg_real()
else else
lver="${version}" lver="${version}"
fi fi
msg_normal "Package '${pkgname} ($lver)': stowning files into masterdir, please wait..." msg_normal "'${pkgname}-$lver': stowning files into masterdir, please wait...\n"
# Copy files into masterdir. # Copy files into masterdir.
for i in $(find -print); do for i in $(find -print); do
@ -169,14 +169,14 @@ unstow_pkg_real()
if [ $(id -u) -ne 0 ] && \ if [ $(id -u) -ne 0 ] && \
[ ! -w $XBPS_MASTERDIR ]; then [ ! -w $XBPS_MASTERDIR ]; then
msg_error "cannot unstow $pkgname! (permission denied)" msg_error "cannot unstow $pkgname! (permission denied)\n"
fi fi
setup_tmpl $pkgname setup_tmpl $pkgname
ver=$($XBPS_PKGDB_CMD version $pkgname) ver=$($XBPS_PKGDB_CMD version $pkgname)
if [ -z "$ver" ]; then if [ -z "$ver" ]; then
msg_error "$pkgname is not installed." msg_error "$pkgname is not installed.\n"
fi fi
cd $XBPS_PKGMETADIR/$pkgname || exit 1 cd $XBPS_PKGMETADIR/$pkgname || exit 1
@ -184,9 +184,9 @@ unstow_pkg_real()
# If it's a metapkg, do nothing. # If it's a metapkg, do nothing.
: :
elif [ ! -f ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then elif [ ! -f ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then
msg_error "$pkgname is incomplete, missing flist." msg_error "$pkgname is incomplete, missing flist.\n"
elif [ ! -w ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then elif [ ! -w ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then
msg_error "$pkgname cannot be removed (permission denied)." msg_error "$pkgname cannot be removed (permission denied).\n"
elif [ -s ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then elif [ -s ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then
run_func pre_remove run_func pre_remove
# Remove installed files. # Remove installed files.

View file

@ -55,7 +55,7 @@ strip_files_real()
lver="${version}" lver="${version}"
fi fi
msg_normal "Package '$pkgname ($lver)': stripping files, please wait..." msg_normal "'$pkgname-$lver': stripping files, please wait...\n"
find ${DESTDIR} -type f | while read f; do find ${DESTDIR} -type f | while read f; do
case "$(file -bi "$f")" in case "$(file -bi "$f")" in
application/x-executable*) application/x-executable*)

View file

@ -107,7 +107,7 @@ setup_tmpl()
. $XBPS_SRCPKGDIR/${pkg}/template . $XBPS_SRCPKGDIR/${pkg}/template
prepare_tmpl prepare_tmpl
else else
msg_error "Cannot find $pkg build template file." msg_error "Cannot find $pkg build template file.\n"
fi fi
} }
@ -138,10 +138,10 @@ Add_dependency()
case "$type" in case "$type" in
build|full|run) ;; build|full|run) ;;
*) msg_error "Unknown dependency type for $pkgname." ;; *) msg_error "Unknown dependency type for $pkgname.\n" ;;
esac esac
[ -z "$pkgname" ] && msg_error "Add_dependency: pkgname empty!" [ -z "$pkgname" ] && msg_error "Add_dependency: pkgname empty!\n"
if [ -f $XBPS_SRCPKGDIR/${pkgname}/${pkgname}.depends ]; then if [ -f $XBPS_SRCPKGDIR/${pkgname}/${pkgname}.depends ]; then
. $XBPS_SRCPKGDIR/${pkgname}/${pkgname}.depends . $XBPS_SRCPKGDIR/${pkgname}/${pkgname}.depends
@ -205,7 +205,7 @@ prepare_tmpl()
for i in ${REQ_VARS}; do for i in ${REQ_VARS}; do
eval val="\$$i" eval val="\$$i"
if [ -z "$val" -o -z "$i" ]; then if [ -z "$val" -o -z "$i" ]; then
msg_error "\"$i\" not set on $pkgname template." msg_error "\"$i\" not set on $pkgname template.\n"
fi fi
done done
@ -213,7 +213,7 @@ prepare_tmpl()
[ "$i" = "$xbps_machine" ] && found=si && break [ "$i" = "$xbps_machine" ] && found=si && break
done done
if [ -n "${only_for_archs}" -a -z "$found" ]; then if [ -n "${only_for_archs}" -a -z "$found" ]; then
msg_error "this package is only for: ${only_for_archs}." msg_error "this package is only for: ${only_for_archs}.\n"
fi fi
unset XBPS_EXTRACT_DONE XBPS_APPLYPATCHES_DONE unset XBPS_EXTRACT_DONE XBPS_APPLYPATCHES_DONE
@ -246,7 +246,7 @@ remove_tmpl_wrksrc()
return 1 return 1
fi fi
msg_normal "Cleaning '${sourcepkg}' build directory... " msg_normal "Cleaning '${sourcepkg}' build directory...\n"
rm -rf $lwrksrc rm -rf $lwrksrc
return $? return $?
} }

View file

@ -57,7 +57,7 @@ verify_rundeps()
fi fi
[ -n "$noarch" -o -n "$noverifyrdeps" ] && return 0 [ -n "$noarch" -o -n "$noverifyrdeps" ] && return 0
msg_normal "Package '$pkgname ($lver)': verifying required run dependencies, please wait..." msg_normal "'$pkgname-$lver': verifying required run dependencies, please wait...\n"
depsftmp=$(mktemp -t xbps_src_depstmp.XXXXXXXXXX) || exit 1 depsftmp=$(mktemp -t xbps_src_depstmp.XXXXXXXXXX) || exit 1
find ${PKG_DESTDIR} -type f -perm -u+w > $depsftmp 2>/dev/null find ${PKG_DESTDIR} -type f -perm -u+w > $depsftmp 2>/dev/null
@ -148,7 +148,7 @@ verify_rundeps()
# Print an informative message suggesting what needs to be added # Print an informative message suggesting what needs to be added
# into the build template. # into the build template.
msg_normal "The following code needs to be added into the build template:" msg_normal "The following code needs to be added into the build template:\n"
echo "============ CUT HERE ===============" echo "============ CUT HERE ==============="
for f in ${missing_libs}; do for f in ${missing_libs}; do
@ -194,5 +194,5 @@ verify_rundeps()
done done
echo "============ CUT HERE ===============" echo "============ CUT HERE ==============="
msg_error "Package '${pkgname}-${version}' has wrong dependencies, won't continue..." msg_error "'${pkgname}-${lver}': incorrect run dependencies, won't continue...\n"
} }

View file

@ -149,26 +149,26 @@ check_config_vars()
break break
fi fi
done done
[ -z "$cffound" ] && msg_error "cannot find a config file" [ -z "$cffound" ] && msg_error "cannot find a config file\n"
fi fi
run_file ${XBPS_CONFIG_FILE} run_file ${XBPS_CONFIG_FILE}
export XBPS_CONFIG_FILE=$path_fixed export XBPS_CONFIG_FILE=$path_fixed
if [ ! -f "$XBPS_CONFIG_FILE" ]; then if [ ! -f "$XBPS_CONFIG_FILE" ]; then
msg_error "cannot find configuration file: $XBPS_CONFIG_FILE" msg_error "cannot find configuration file: $XBPS_CONFIG_FILE\n"
fi fi
for f in XBPS_DISTRIBUTIONDIR XBPS_MASTERDIR; do for f in XBPS_DISTRIBUTIONDIR XBPS_MASTERDIR; do
eval val="\$${f}" eval val="\$${f}"
if [ -z "$val" ]; then if [ -z "$val" ]; then
msg_error "'${f}' not set in configuration file!" msg_error "'${f}' not set in configuration file!\n"
fi fi
done done
if [ ! -d "$XBPS_MASTERDIR" ]; then if [ ! -d "$XBPS_MASTERDIR" ]; then
mkdir -p "$val" mkdir -p "$val"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "couldn't create 'XBPS_MASTERDIR' directory" msg_error "couldn't create 'XBPS_MASTERDIR' directory\n"
fi fi
fi fi
[ -z "${_MASTERDIR_FLAG}" ] && export _MASTERDIR="$XBPS_MASTERDIR" [ -z "${_MASTERDIR_FLAG}" ] && export _MASTERDIR="$XBPS_MASTERDIR"
@ -274,13 +274,13 @@ bootstrap)
. $XBPS_SHUTILSDIR/tmpl_funcs.sh . $XBPS_SHUTILSDIR/tmpl_funcs.sh
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh . $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
[ ! -d $XBPS_SRCPKGDIR/xbps-base-chroot ] && \ [ ! -d $XBPS_SRCPKGDIR/xbps-base-chroot ] && \
msg_error "Cannot find $XBPS_SRCPKGDIR/xbps-base-chroot directory!" msg_error "Cannot find $XBPS_SRCPKGDIR/xbps-base-chroot directory!\n"
cd $XBPS_SRCPKGDIR/xbps-base-chroot && _ORIGINPKG="$(basename_cwd)" cd $XBPS_SRCPKGDIR/xbps-base-chroot && _ORIGINPKG="$(basename_cwd)"
setup_tmpl ${_ORIGINPKG} && install_pkg $pkgname setup_tmpl ${_ORIGINPKG} && install_pkg $pkgname
;; ;;
build|configure) build|configure)
. $XBPS_SHUTILSDIR/tmpl_funcs.sh . $XBPS_SHUTILSDIR/tmpl_funcs.sh
[ ! -r ./template ] && msg_error "missing build template in $(pwd)." [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
. ./template . ./template
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
@ -294,7 +294,7 @@ build|configure)
. $XBPS_SHUTILSDIR/builddep_funcs.sh . $XBPS_SHUTILSDIR/builddep_funcs.sh
install_dependencies_pkg "$pkgname-$version" install_dependencies_pkg "$pkgname-$version"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_red "cannot install required deps for $pkgname." msg_red "cannot install required deps for $pkgname.\n"
exit 1 exit 1
fi fi
# All deps were installed, continue with the origin pkg... # All deps were installed, continue with the origin pkg...
@ -333,7 +333,7 @@ build-pkg)
fi fi
done done
else else
[ ! -r ./template ] && msg_error "missing build template in $(pwd)." [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
setup_tmpl $(basename_cwd) setup_tmpl $(basename_cwd)
xbps_make_binpkg xbps_make_binpkg
fi fi
@ -349,13 +349,13 @@ chroot)
;; ;;
clean) clean)
. $XBPS_SHUTILSDIR/tmpl_funcs.sh . $XBPS_SHUTILSDIR/tmpl_funcs.sh
[ ! -r ./template ] && msg_error "missing build template in $(pwd)." [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
setup_tmpl $(basename_cwd) setup_tmpl $(basename_cwd)
remove_tmpl_wrksrc $wrksrc remove_tmpl_wrksrc $wrksrc
;; ;;
extract|fetch|info) extract|fetch|info)
. $XBPS_SHUTILSDIR/tmpl_funcs.sh . $XBPS_SHUTILSDIR/tmpl_funcs.sh
[ ! -r ./template ] && msg_error "missing build template in $(pwd)." [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
setup_tmpl $(basename_cwd) setup_tmpl $(basename_cwd)
if [ "$target" = "info" ]; then if [ "$target" = "info" ]; then
. $XBPS_SHUTILSDIR/tmpl_funcs.sh . $XBPS_SHUTILSDIR/tmpl_funcs.sh
@ -372,7 +372,7 @@ extract|fetch|info)
;; ;;
install|install-destdir) install|install-destdir)
. $XBPS_SHUTILSDIR/tmpl_funcs.sh . $XBPS_SHUTILSDIR/tmpl_funcs.sh
[ ! -r ./template ] && msg_error "missing build template in $(pwd)." [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
. ./template . ./template
install_destdir_target=no install_destdir_target=no
@ -407,21 +407,21 @@ make-repoidx)
;; ;;
remove) remove)
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh . $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
[ ! -r ./template ] && msg_error "missing build template in $(pwd)." [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
setup_tmpl $(basename_cwd) setup_tmpl $(basename_cwd)
remove_pkg remove_pkg
;; ;;
stow) stow)
stow_flag=yes stow_flag=yes
. $XBPS_SHUTILSDIR/tmpl_funcs.sh . $XBPS_SHUTILSDIR/tmpl_funcs.sh
[ ! -r ./template ] && msg_error "missing build template in $(pwd)." [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
setup_tmpl $(basename_cwd) setup_tmpl $(basename_cwd)
. $XBPS_SHUTILSDIR/stow_funcs.sh . $XBPS_SHUTILSDIR/stow_funcs.sh
stow_pkg_handler stow stow_pkg_handler stow
;; ;;
unstow) unstow)
. $XBPS_SHUTILSDIR/tmpl_funcs.sh . $XBPS_SHUTILSDIR/tmpl_funcs.sh
[ ! -r ./template ] && msg_error "missing build template in $(pwd)." [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
setup_tmpl $(basename_cwd) setup_tmpl $(basename_cwd)
. $XBPS_SHUTILSDIR/stow_funcs.sh . $XBPS_SHUTILSDIR/stow_funcs.sh
stow_pkg_handler unstow stow_pkg_handler unstow