xbps-src: multiple improvements to messages and phases.

- Prefix all messages with 'Package 'pkgname (version)': ..." to really
  understand what's going on. Add more messages in some stages...
- Do not run pre/post_{configure,build,install} or do_{build,install} stages
  if they were executed successfully in the past.
This commit is contained in:
Juan RP 2010-05-14 00:07:47 +02:00
parent 85f018289f
commit ceefb18bff
13 changed files with 203 additions and 111 deletions

View file

@ -42,20 +42,22 @@ set_defvars
strip_files() strip_files()
{ {
local lver="$1"
if [ ! -x /usr/bin/strip ]; then if [ ! -x /usr/bin/strip ]; then
return 0 return 0
fi fi
[ -n "$nostrip" ] && return 0 [ -n "$nostrip" ] && return 0
msg_normal "Finding binaries/libraries to strip..." msg_normal "Package '$pkgname ($lver)': stripping files, please wait..."
for f in $(find ${DESTDIR} -type f); do for f in $(find ${DESTDIR} -type f); do
case "$(file -biz $f)" in case "$(file -biz $f)" in
application/x-executable*) application/x-executable*)
/usr/bin/strip $f && \ /usr/bin/strip $f && \
echo "=> Stripped executable: $(basename $f)";; echo " Stripped executable: $(basename $f)";;
application/x-sharedlib*|application/x-archive*) application/x-sharedlib*|application/x-archive*)
/usr/bin/strip -S $f && \ /usr/bin/strip -S $f && \
echo "=> Stripped library: $(basename $f)";; echo " Stripped library: $(basename $f)";;
esac esac
done done
} }
@ -89,25 +91,38 @@ install_src_phase()
fi fi
# Run pre_install func. # Run pre_install func.
if [ ! -f $XBPS_PRE_INSTALL_DONE ]; then
run_func pre_install 2>${wrksrc}/.xbps_pre_install.log run_func pre_install 2>${wrksrc}/.xbps_pre_install.log
if [ $? -ne 0 ]; then if [ $? -ne 0 -a $? -ne 255 ]; then
msg_red "$pkgname: pre_install() failed:" msg_red "Package '$pkgname': pre_install phase failed! errors below"
cat $wrksrc/.xbps_pre_install.log cat $wrksrc/.xbps_pre_install.log
exit 1 exit 1
elif [ $? -eq 0 ]; then
msg_normal "Package '$pkgname': pre_install (destdir) phase done."
touch -f $XBPS_PRE_INSTALL_DONE
fi
fi fi
msg_normal "Running install phase for $pkgname-$lver." 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) custom-install)
run_func do_install 2>${wrksrc}/.xbps_do_install.log \ run_func do_install 2>${wrksrc}/.xbps_do_install.log
|| msg_error "$pkgname: do_install() failed! check $wrksrc/.xbps_do_install.log" if [ $? -ne 0 -a $? -ne 255 ]; then
msg_red "Package '$pkgname': do_install phase failed! errors below:"
cat $wrksrc/.xbps_do_install.log
exit 1
fi
;; ;;
python-module) python-module)
. $XBPS_HELPERSDIR/python-module.sh . $XBPS_HELPERSDIR/python-module.sh
run_func do_install 2>${wrksrc}/.xbps_do_install.log \ run_func do_install 2>${wrksrc}/.xbps_do_install.log
|| msg_error "$pkgname: install failed! check $wrksrc/.xbps_do_install.log" if [ $? -ne 0 -a $? -ne 255 ]; then
msg_red "Package '$pkgname': install phase failed! errors below:"
cat $wrksrc/.xbps_do_install.log
exit 1
fi
;; ;;
*) *)
make_install $lver 2>${wrksrc}/.xbps_make_install.log make_install $lver 2>${wrksrc}/.xbps_make_install.log
@ -115,16 +130,24 @@ install_src_phase()
esac esac
cd ${wrksrc} || msg_error "can't change cwd to wrksrc!" cd ${wrksrc} || msg_error "can't change cwd to wrksrc!"
msg_normal "Package '$pkgname ($lver)': install (destdir) phase done."
# Run post_install func. # Run post_install func.
if [ ! -f $XBPS_POST_INSTALL_DONE ]; then
run_func post_install 2>${wrksrc}/.xbps_post_install.log run_func post_install 2>${wrksrc}/.xbps_post_install.log
if [ $? -ne 0 ]; then if [ $? -ne 0 -a $? -ne 255 ]; then
msg_red "$pkgname: post_install() failed:" msg_red "Package '$pkgname': post_install phase failed! errors below:"
cat ${wrksrc}/.xbps_post_install.log cat ${wrksrc}/.xbps_post_install.log
exit 1 exit 1
elif [ $? -eq 0 ]; then
msg_normal "Package '$pkgname': post_install (destdir) phase done."
touch -f $XBPS_POST_INSTALL_DONE
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..."
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.
@ -134,14 +157,15 @@ 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..."
find ${DESTDIR} -depth -type d -exec rmdir 2>/dev/null {} \; find ${DESTDIR} -depth -type d -exec rmdir 2>/dev/null {} \;
fi fi
# Strip bins/libs. # Strip bins/libs.
if [ -z "$noarch" ]; then if [ -z "$noarch" ]; then
strip_files strip_files "$lver"
fi fi
msg_normal "Installed $pkgname-$lver into $XBPS_DESTDIR." msg_normal "Package '$pkgname ($lver)': installed into destdir."
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
@ -159,18 +183,25 @@ install_src_phase()
check_installed_pkg ${spkgrev} check_installed_pkg ${spkgrev}
[ $? -eq 0 ] && continue [ $? -eq 0 ] && continue
msg_normal "Preparing ${sourcepkg} subpackage: ${subpkg}" msg_normal "Package '${sourcepkg} ($lver)': preparing subpackage '${subpkg}'."
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!"
fi fi
. $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template . $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template
pkgname=${subpkg} pkgname=${subpkg}
set_tmpl_common_vars set_tmpl_common_vars
run_func do_install 2>${wrksrc}/.xbps_do_install_${pkgname}.log if [ ! -f ${wrksrc}/.xbps_do_install_${pkgname}_done ]; then
if [ $? -ne 0 ]; then run_func do_install \
msg_red "$pkgname: do_install() failed:" 2>${wrksrc}/.xbps_do_install_${pkgname}.log
if [ $? -ne 0 -a $? -eq 255 ]; then
msg_red "Package '$pkgname': do_install phase failed! errors below:"
cat ${wrksrc}/.xbps_do_install_${pkgname}.log cat ${wrksrc}/.xbps_do_install_${pkgname}.log
exit 1 exit 1
elif [ $? -eq 0 ]; then
touch -f ${wrksrc}/.xbps_do_install_${pkgname}_done
fi
else
msg_normal "Package '$sourcepkg ($lver)': skipping '$pkgname' subpkg, already installed into destdir."
fi fi
done done
@ -179,7 +210,7 @@ install_src_phase()
# #
if [ -d "$saved_wrksrc" -a "$dontrm_builddir" = "no" ]; then if [ -d "$saved_wrksrc" -a "$dontrm_builddir" = "no" ]; then
rm -rf $saved_wrksrc && \ rm -rf $saved_wrksrc && \
msg_normal "Removed $sourcepkg-$lver build directory." msg_normal "Package '$sourcepkg ($lver)': removed build directory."
fi fi
} }
@ -202,7 +233,7 @@ make_install()
# Install package via make. # Install package via make.
# #
${make_cmd} ${make_install_target} ${make_install_args} \ ${make_cmd} ${make_install_target} ${make_install_args} \
|| msg_error "$pkgname: make install failed!" || msg_error "Package '$pkgname ($lver)': make install failed!"
} }
[ -z "$PKG_TMPLNAME" ] && exit 2 [ -z "$PKG_TMPLNAME" ] && exit 2

View file

@ -29,7 +29,7 @@
# #
build_src_phase() build_src_phase()
{ {
local pkg="$pkgname-$version" pkgparam="$1" f local pkg="$pkgname-$version" pkgparam="$1" f lver
[ -z $pkgparam ] && [ -z $pkgname -o -z $version ] && return 1 [ -z $pkgparam ] && [ -z $pkgname -o -z $version ] && return 1
@ -46,7 +46,12 @@ build_src_phase()
cd $build_wrksrc || return 1 cd $build_wrksrc || return 1
fi fi
[ -n "$revision" ] && pkg="${pkg}_${revision}" if [ -n "$revision" ]; then
lver="${version}_${revision}"
pkg="${pkg}_${revision}"
else
lver="${version}"
fi
if [ "$build_style" = "python-module" ]; then if [ "$build_style" = "python-module" ]; then
make_cmd="python" make_cmd="python"
@ -57,36 +62,50 @@ build_src_phase()
makejobs="-j$XBPS_MAKEJOBS" makejobs="-j$XBPS_MAKEJOBS"
fi fi
# Run pre_build func. # Run pre_build func.
if [ ! -f $XBPS_PRE_BUILD_DONE ]; then
run_func pre_build 2>${wrksrc}/.xbps_pre_build.log run_func pre_build 2>${wrksrc}/.xbps_pre_build.log
if [ $? -ne 0 ]; then if [ $? -ne 0 -a $? -ne 255 ]; then
msg_red "$pkgname: pre_build() failed:" msg_red "$pkgname: pre_build phase failed! errors below:"
cat $wrksrc/.xbps_pre_build.log cat $wrksrc/.xbps_pre_build.log
exit 1 exit 1
elif [ $? -eq 0 ]; then
msg_normal "$pkgname: pre_build phase done."
touch -f $XBPS_PRE_BUILD_DONE
fi
fi fi
. $XBPS_SHUTILSDIR/buildvars_funcs.sh . $XBPS_SHUTILSDIR/buildvars_funcs.sh
set_build_vars set_build_vars
msg_normal "Running build phase for $pkg." msg_normal "Package '$pkgname ($lver)': running build phase."
if [ "$build_style" = "custom-install" ]; then if [ "$build_style" = "custom-install" ]; then
run_func do_build 2>${wrksrc}/.xbps_do_build.log \ run_func do_build 2>${wrksrc}/.xbps_do_build.log
|| msg_error "do_build stage failed!" if [ $? -ne 0 -a $? -ne 255 ]; then
msg_error "Package '$pkgname': do_build phase failed!"
fi
else else
# #
# Build package via make. # Build package via make.
# #
${make_cmd} ${makejobs} ${make_build_args} \ ${make_cmd} ${makejobs} ${make_build_args} \
${make_build_target} || ${make_build_target} ||
msg_error "$pkgname: build phase failed!" msg_error "Package '$pkgname': build phase failed!"
fi fi
msg_normal "Package '$pkgname ($lver)': build phase done."
# Run post_build func. # Run post_build func.
if [ ! -f $XBPS_POST_BUILD_DONE ]; then
run_func post_build 2>${wrksrc}/.xbps_post_build.log run_func post_build 2>${wrksrc}/.xbps_post_build.log
if [ $? -ne 0 ]; then if [ $? -ne 0 -a $? -ne 255 ]; then
msg_red "$pkgname: post_build() failed:" msg_red "Package '$pkgname': post_build phase failed! errors below:"
cat $wrksrc/.xbps_post_build.log cat $wrksrc/.xbps_post_build.log
exit 1 exit 1
elif [ $? -eq 0 ]; then
msg_normal "Package '$pkgname': post_build phase done."
touch -f $XBPS_POST_BUILD_DONE
fi
fi fi
unset makejobs unset makejobs

View file

@ -43,18 +43,22 @@ install_pkg_deps()
curpkgname="$(${XBPS_PKGDB_CMD} getpkgdepname ${curpkg})" curpkgname="$(${XBPS_PKGDB_CMD} getpkgdepname ${curpkg})"
fi fi
msg_normal "Installing $saved_prevpkg dependency: $curpkgname." if [ -z "$saved_prevpkg" -a -n "${_ORIGINPKG}" ]; then
msg_normal "Installing '${_ORIGINPKG}' dependency: '$curpkg'."
else
msg_normal "Installing '$saved_prevpkg' dependency: '$curpkg'."
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 "Dependency $curpkgname requires:" msg_normal "Package dependency '$curpkgname' requires:"
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})"
check_pkgdep_matched "${j}" check_pkgdep_matched "${j}"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo " ${j}: found $jname-$jver." echo " ${j}: found '$jname-$jver'."
else else
echo " ${j}: not found." echo " ${j}: not found."
fi fi
@ -95,9 +99,9 @@ install_pkg_deps()
fi fi
else else
if [ -n "$saved_prevpkg" ]; then if [ -n "$saved_prevpkg" ]; then
msg_normal "Installing ${curpkgname} required by ${saved_prevpkg}." msg_normal "Installing package '${curpkgname}' required by '${saved_prevpkg}'."
else else
msg_normal "Installing ${curpkgname}." msg_normal "Installing package: '${curpkg}'."
fi fi
install_pkg "${curpkgname}" install_pkg "${curpkgname}"
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
@ -128,14 +132,14 @@ install_dependencies_pkg()
fi fi
if [ -n "$build_depends" -o -n "$run_depends" ]; then if [ -n "$build_depends" -o -n "$run_depends" ]; then
msg_normal "Required dependencies for $pkgname-$lver... " msg_normal "$pkgname: installing required package dependencies..."
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})"
iver="$($XBPS_PKGDB_CMD version $pkgn)" iver="$($XBPS_PKGDB_CMD version $pkgn)"
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 continue
else else
echo " ${i}: not found." echo " ${i}: not found."
@ -149,7 +153,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 "Installing required build dependencies from binpkgs..." msg_normal "$pkgname: installing required dependencies from binpkgs..."
${fakeroot_cmd} ${fakeroot_cmd_args} ${XBPS_BIN_CMD} \ ${fakeroot_cmd} ${fakeroot_cmd_args} ${XBPS_BIN_CMD} \
-y install ${pkgdeplist} -y install ${pkgdeplist}
rval=$? rval=$?
@ -182,7 +186,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'."
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=$?

View file

@ -272,7 +272,7 @@ xbps_chroot_handler()
else else
[ "$norm_builddir" = "yes" ] && \ [ "$norm_builddir" = "yes" ] && \
action="-C $action" action="-C $action"
env in_chroot=yes LANG=C PATH=$path \ env in_chroot=yes LANG=C PATH=$path _ORIGINPKG="$pkg" \
${chroot_cmd} $XBPS_MASTERDIR sh -c \ ${chroot_cmd} $XBPS_MASTERDIR sh -c \
"cd /xbps/srcpkgs/$pkg && xbps-src $action" || \ "cd /xbps/srcpkgs/$pkg && xbps-src $action" || \
rv=$? && _umount && return $rv rv=$? && _umount && return $rv

View file

@ -36,6 +36,7 @@ run_func()
$func $func
return $? return $?
fi fi
return 255 # function not found.
} }
msg_red() msg_red()

View file

@ -58,11 +58,16 @@ configure_src_phase()
cd $wrksrc || msg_error "unexistent build directory [$wrksrc]." cd $wrksrc || msg_error "unexistent build directory [$wrksrc]."
# Run pre_configure func. # Run pre_configure func.
if [ ! -f $XBPS_PRECONFIGURE_DONE ]; then
run_func pre_configure 2>${wrksrc}/.xbps_pre_configure.log run_func pre_configure 2>${wrksrc}/.xbps_pre_configure.log
if [ $? -ne 0 ]; then if [ $? -ne 0 -a $? -ne 255 ]; then
msg_red "$pkgname: pre_configure() failed:" msg_red "Package '$pkgname': pre_configure phase failed! errors below:"
cat $wrksrc/.xbps_pre_configure.log cat $wrksrc/.xbps_pre_configure.log
exit 1 exit 1
elif [ $? -eq 0 ]; then
msg_normal "Package '$pkgname': pre_configure phase done."
touch -f $XBPS_PRECONFIGURE_DONE
fi
fi fi
# Export configure_env vars. # Export configure_env vars.
@ -70,7 +75,7 @@ configure_src_phase()
export "$f" export "$f"
done done
msg_normal "Running configure phase for $pkgname-$lver." msg_normal "Package '$pkgname ($lver)': running configure phase."
[ -z "$configure_script" ] && configure_script="./configure" [ -z "$configure_script" ] && configure_script="./configure"
@ -109,21 +114,27 @@ configure_src_phase()
# #
# Unknown build_style type won't work :-) # Unknown build_style type won't work :-)
# #
msg_error "unknown build_style [$build_style]" msg_error "package '$pkgname': unknown build_style [$build_style]"
exit 1 exit 1
;; ;;
esac esac
if [ "$build_style" != "perl_module" -a "$error" -ne 0 ]; then if [ "$build_style" != "perl_module" -a "$error" -ne 0 ]; then
msg_error "$pkgname: configure stage failed!" msg_error "package '$pkgname': configure stage failed!"
fi fi
msg_normal "Package '$pkgname ($lver)': configure phase done."
# Run post_configure func. # Run post_configure func.
if [ ! -f $XBPS_POSTCONFIGURE_DONE ]; then
run_func post_configure 2>${wrksrc}/.xbps_post_configure.log run_func post_configure 2>${wrksrc}/.xbps_post_configure.log
if [ $? -ne 0 ]; then if [ $? -ne 0 -a $? -ne 255 ]; then
msg_red "$pkgname: post_configure() failed:" msg_red "Package '$pkgname': post_configure phase failed! errors below:"
cat $wrksrc/.xbps_post_configure.log cat $wrksrc/.xbps_post_configure.log
exit 1 exit 1
elif [ $? -eq 0 ]; then
msg_normal "Package '$pkgname': post_configure phase done."
touch -f $XBPS_POSTCONFIGURE_DONE
fi
fi fi
# unset configure_env vars. # unset configure_env vars.

View file

@ -71,7 +71,7 @@ extract_distfiles()
mkdir -p ${wrksrc} || return 1 mkdir -p ${wrksrc} || return 1
fi fi
msg_normal "Extracting $pkgname-$lver distfile(s)." msg_normal "Package '$pkgname ($lver)': extracting distfile(s), please wait..."
for f in ${distfiles}; do for f in ${distfiles}; do
curfile=$(basename $f) curfile=$(basename $f)

View file

@ -39,7 +39,7 @@ verify_sha256_cksum()
msg_error "SHA256 checksum doesn't match for $file." msg_error "SHA256 checksum doesn't match for $file."
fi fi
msg_normal "SHA256 checksum OK for $file." msg_normal "Package '$pkgname ($lver)': SHA256 checksum OK for $file."
} }
# #
@ -47,15 +47,9 @@ verify_sha256_cksum()
# #
fetch_distfiles() fetch_distfiles()
{ {
local pkg="$1" local pkg="$1" upcksum="$2" dfiles localurl dfcount=0 ckcount=0 f
local upcksum="$2"
local dfiles=
local localurl=
local dfcount=0
local ckcount=0
local f=
[ -z $pkgname ] && exit 1 [ -z $pkgname ] && return 1
# #
# There's nothing of interest if we are a meta template. # There's nothing of interest if we are a meta template.
@ -70,10 +64,18 @@ fetch_distfiles()
# #
if [ -n "$nofetch" ]; then if [ -n "$nofetch" ]; then
cd ${XBPS_BUILDDIR} && run_func do_fetch 2>/dev/null cd ${XBPS_BUILDDIR} && run_func do_fetch 2>/dev/null
if [ $? -ne 0 && $? -ne 255 ]; then
return $? return $?
fi fi
fi
cd $XBPS_SRCDISTDIR || return 1 cd $XBPS_SRCDISTDIR || return 1
if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
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
@ -91,6 +93,7 @@ fetch_distfiles()
msg_error "cannot find checksum for $curfile." msg_error "cannot find checksum for $curfile."
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
@ -100,7 +103,7 @@ fetch_distfiles()
fi fi
fi fi
msg_normal "Fetching distfile: $curfile." msg_normal "Package '$pkgname ($lver)': fetching distfile $curfile."
if [ -n "$distfiles" ]; then if [ -n "$distfiles" ]; then
localurl="$f" localurl="$f"
@ -145,5 +148,5 @@ fetch_distfiles()
dfcount=$(($dfcount + 1)) dfcount=$(($dfcount + 1))
done done
unset cksum found unset lver cksum found
} }

View file

@ -125,6 +125,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..."
for f in $(find ${DESTDIR}/usr/share/info -type f -follow); do for f in $(find ${DESTDIR}/usr/share/info -type f -follow); do
j=$(echo $f|sed -e "$fpattern") j=$(echo $f|sed -e "$fpattern")
@ -148,7 +149,7 @@ xbps_write_metadata_pkg_real()
ln -s ${lnkat}.gz ${newlnk}.gz ln -s ${lnkat}.gz ${newlnk}.gz
continue continue
fi fi
echo "===> Compressing info file: $j..." echo " Compressing info file: $j..."
gzip -q9 ${DESTDIR}/$j gzip -q9 ${DESTDIR}/$j
done done
fi fi
@ -158,6 +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..."
for f in $(find ${DESTDIR}/usr/share/man -type f -follow); do for f in $(find ${DESTDIR}/usr/share/man -type f -follow); do
j=$(echo $f|sed -e "$fpattern") j=$(echo $f|sed -e "$fpattern")
[ "$j" = "" ] && continue [ "$j" = "" ] && continue
@ -173,13 +175,13 @@ xbps_write_metadata_pkg_real()
ln -s ${lnkat}.gz ${newlnk}.gz ln -s ${lnkat}.gz ${newlnk}.gz
continue continue
fi fi
echo "===> Compressing manpage: $j..." echo " Compressing manpage: $j..."
gzip -q9 ${DESTDIR}/$j gzip -q9 ${DESTDIR}/$j
done done
fi fi
cd ${DESTDIR} cd ${DESTDIR}
msg_normal "Writing package metadata for $pkgname-$lver..." msg_normal "Package '$pkgname ($lver)': creating package metadata..."
write_metadata_flist_header $TMPFPLIST write_metadata_flist_header $TMPFPLIST
@ -378,4 +380,6 @@ _EOF
xbps_write_metadata_scripts_pkg install; \ xbps_write_metadata_scripts_pkg install; \
xbps_write_metadata_scripts_pkg remove; \ xbps_write_metadata_scripts_pkg remove; \
} || return $? } || return $?
msg_normal "Package '$pkgname ($lver)': successfully created package metadata."
} }

View file

@ -85,7 +85,12 @@ stow_pkg_real()
cd ${DESTDIR} || return 1 cd ${DESTDIR} || return 1
msg_normal "Stowning '${pkgname}' into masterdir..." if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
msg_normal "Package '${pkgname} ($lver)': stowning files into masterdir, please wait..."
# Copy files into masterdir. # Copy files into masterdir.
for i in $(find -print); do for i in $(find -print); do
@ -96,10 +101,10 @@ stow_pkg_real()
continue continue
# Skip files that are already in masterdir. # Skip files that are already in masterdir.
elif [ -f "$XBPS_MASTERDIR/$lfile" ]; then elif [ -f "$XBPS_MASTERDIR/$lfile" ]; then
echo "=> Skipping $lfile file, already exists!" echo " Skipping $lfile file, already exists!"
continue continue
elif [ -h "$XBPS_MASTERDIR/$lfile" ]; then elif [ -h "$XBPS_MASTERDIR/$lfile" ]; then
echo "=> Skipping $lfile link, already exists!" echo " Skipping $lfile link, already exists!"
continue continue
elif [ -d "$XBPS_MASTERDIR/$lfile" ]; then elif [ -d "$XBPS_MASTERDIR/$lfile" ]; then
continue continue
@ -145,16 +150,12 @@ stow_pkg_real()
# #
# Register pkg in plist file. # Register pkg in plist file.
# #
if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
$XBPS_PKGDB_CMD register $pkgname $lver "$short_desc" || return $? $XBPS_PKGDB_CMD register $pkgname $lver "$short_desc" || return $?
run_func post_stow 2>/dev/null || msg_error "post_stow failed!" run_func post_stow 2>/dev/null
if [ $? -ne 0 -a $? -ne 255 ]; then
return $? msg_error "Package '$pkgname': post_stow phase failed!"
fi
} }
# #
@ -188,8 +189,10 @@ unstow_pkg_real()
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)."
elif [ -s ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then elif [ -s ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then
run_func pre_remove 2>/dev/null || \ run_func pre_remove 2>/dev/null
msg_error "pre_remove stage failed!" if [ $? -ne 0 -a $? -ne 255 ]; then
msg_error "Package '$pkgname': pre_remove stage failed!"
fi
# Remove installed files. # Remove installed files.
for f in $(cat ${XBPS_PKGMETADIR}/${pkgname}/flist); do for f in $(cat ${XBPS_PKGMETADIR}/${pkgname}/flist); do
@ -211,7 +214,10 @@ unstow_pkg_real()
done done
fi fi
run_func post_remove 2>/dev/null || msg_error "post_remove failed!" run_func post_remove 2>/dev/null
if [ $? -ne 0 -a $? -ne 255 ]; then
msg_error "Package '$pkgname': post_remove phase failed!"
fi
# Remove metadata dir. # Remove metadata dir.
rm -rf $XBPS_PKGMETADIR/$pkgname rm -rf $XBPS_PKGMETADIR/$pkgname

View file

@ -232,8 +232,14 @@ prepare_tmpl()
XBPS_EXTRACT_DONE="$wrksrc/.xbps_extract_done" XBPS_EXTRACT_DONE="$wrksrc/.xbps_extract_done"
XBPS_APPLYPATCHES_DONE="$wrksrc/.xbps_applypatches_done" XBPS_APPLYPATCHES_DONE="$wrksrc/.xbps_applypatches_done"
XBPS_CONFIGURE_DONE="$wrksrc/.xbps_configure_done" XBPS_CONFIGURE_DONE="$wrksrc/.xbps_configure_done"
XBPS_PRECONFIGURE_DONE="$wrksrc/.xbps_pre_configure_done"
XBPS_POSTCONFIGURE_DONE="$wrksrc/.xbps_post_configure_done"
XBPS_BUILD_DONE="$wrksrc/.xbps_build_done" XBPS_BUILD_DONE="$wrksrc/.xbps_build_done"
XBPS_PRE_BUILD_DONE="$wrksrc/.xbps_pre_build_done"
XBPS_POST_BUILD_DONE="$wrksrc/.xbps_post_build_done"
XBPS_INSTALL_DONE="$wrksrc/.xbps_install_done" XBPS_INSTALL_DONE="$wrksrc/.xbps_install_done"
XBPS_PRE_INSTALL_DONE="$wrksrc/.xbps_pre_install_done"
XBPS_POST_INSTALL_DONE="$wrksrc/.xbps_post_install_done"
set_tmpl_common_vars set_tmpl_common_vars

View file

@ -44,14 +44,20 @@ find_rundep()
verify_rundeps() verify_rundeps()
{ {
local j i f nlib verify_deps maplib found_dup igndir local j i f nlib verify_deps maplib found_dup igndir lver
local missing missing_libs rdep builddep rdep_list builddep_list local missing missing_libs rdep builddep rdep_list builddep_list
PKG_DESTDIR="$1" PKG_DESTDIR="$1"
maplib="$XBPS_COMMONVARSDIR/mapping_shlib_binpkg.txt" maplib="$XBPS_COMMONVARSDIR/mapping_shlib_binpkg.txt"
if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
[ -n "$noarch" -o "$nostrip" -o "$noverifyrdeps" ] && return 0 [ -n "$noarch" -o "$nostrip" -o "$noverifyrdeps" ] && return 0
msg_normal "Verifying required $pkgname run dependencies..." msg_normal "Package '$pkgname ($lver)': verifying required run dependencies, please wait..."
for f in $(find ${PKG_DESTDIR} -type f); do for f in $(find ${PKG_DESTDIR} -type f); do
# Don't check dirs specified in ignore_vdeps_dir. # Don't check dirs specified in ignore_vdeps_dir.
@ -94,14 +100,14 @@ verify_rundeps()
rdep="$(grep "$f" $maplib|awk '{print $2}')" rdep="$(grep "$f" $maplib|awk '{print $2}')"
rdepcnt="$(grep "$f" $maplib|awk '{print $2}'|wc -l)" rdepcnt="$(grep "$f" $maplib|awk '{print $2}'|wc -l)"
if [ -z "$rdep" ]; then if [ -z "$rdep" ]; then
msg_error_nochroot "unknown rundep for $f" echo " UNKNOWN PACKAGE FOR SHLIB DEPENDENCY '$f', PLEASE FIX!"
fi fi
# Ignore libs by current pkg # Ignore libs by current pkg
[ "$rdep" = "$pkgname" ] && continue [ "$rdep" = "$pkgname" ] && continue
# Check if shlib is provided by multiple pkgs. # Check if shlib is provided by multiple pkgs.
if [ "$rdepcnt" -gt 1 ]; then if [ "$rdepcnt" -gt 1 ]; then
echo "=> Required $f is provided by these pkgs: " echo " shlib dependency '$f' is provided by these pkgs: "
for j in ${rdep}; do for j in ${rdep}; do
printf "\t$j\n" printf "\t$j\n"
done done
@ -109,7 +115,7 @@ verify_rundeps()
fi fi
# Warn if rundep is not in template. # Warn if rundep is not in template.
if find_rundep "$rdep"; then if find_rundep "$rdep"; then
msg_warn_nochroot "required $f from $rdep (MISSING)" echo " REQUIRED SHLIB DEPENDENCY '$f' FROM PACKAGE '$rdep' MISSING, PLEASE FIX!"
missing=1 missing=1
if [ -z "$missing_libs" ]; then if [ -z "$missing_libs" ]; then
missing_libs="$f" missing_libs="$f"
@ -126,7 +132,7 @@ verify_rundeps()
unset found_dup unset found_dup
continue continue
fi fi
echo "=> Requires $f from $rdep (OK)" echo " shlib dependency '$f' provided by the '$rdep' package (OK)."
unset rdep unset rdep
done done

View file

@ -203,8 +203,8 @@ bootstrap)
. $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!"
cd $XBPS_SRCPKGDIR/xbps-base-chroot && setup_tmpl $(basename_cwd) cd $XBPS_SRCPKGDIR/xbps-base-chroot && _ORIGINPKG="$(basename_cwd)"
install_pkg $pkgname setup_tmpl ${_ORIGINPKG} && install_pkg $pkgname
;; ;;
build|configure) build|configure)
. $XBPS_SHUTILSDIR/tmpl_funcs.sh . $XBPS_SHUTILSDIR/tmpl_funcs.sh
@ -215,8 +215,8 @@ build|configure)
. $XBPS_SHUTILSDIR/chroot.sh . $XBPS_SHUTILSDIR/chroot.sh
xbps_chroot_handler $target $(basename_cwd) xbps_chroot_handler $target $(basename_cwd)
else else
originpkg="$(basename_cwd)" _ORIGINPKG="$(basename_cwd)"
setup_tmpl $originpkg setup_tmpl ${_ORIGINPKG}
# If pkg has dependencies, install them first. # If pkg has dependencies, install them first.
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh . $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
. $XBPS_SHUTILSDIR/builddep_funcs.sh . $XBPS_SHUTILSDIR/builddep_funcs.sh
@ -226,7 +226,7 @@ build|configure)
exit 1 exit 1
fi fi
# All deps were installed, continue with the origin pkg... # All deps were installed, continue with the origin pkg...
setup_tmpl $originpkg setup_tmpl ${_ORIGINPKG}
. $XBPS_SHUTILSDIR/fetch_funcs.sh . $XBPS_SHUTILSDIR/fetch_funcs.sh
fetch_distfiles fetch_distfiles
if [ ! -f "$XBPS_EXTRACT_DONE" ]; then if [ ! -f "$XBPS_EXTRACT_DONE" ]; then
@ -293,12 +293,13 @@ install|install-destdir)
install_destdir_target=no install_destdir_target=no
[ "$target" = "install-destdir" ] && install_destdir_target=yes [ "$target" = "install-destdir" ] && install_destdir_target=yes
_ORIGINPKG="$(basename_cwd)"
if [ -z "$in_chroot" -a -z "$base_chroot" ]; then if [ -z "$in_chroot" -a -z "$base_chroot" ]; then
. $XBPS_SHUTILSDIR/chroot.sh . $XBPS_SHUTILSDIR/chroot.sh
xbps_chroot_handler $target $(basename_cwd) $dontrm_builddir xbps_chroot_handler $target ${_ORIGINPKG} $dontrm_builddir
else else
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh . $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
setup_tmpl $(basename_cwd) setup_tmpl ${_ORIGINPKG}
install_pkg $pkgname install_pkg $pkgname
fi fi
;; ;;