[IMPROVED] Support for systems in which pkgng is the default or legacy package tools are abandoned is improved.
[BUG FIX] The execution was terminated by error when /etc/make.conf does not exist.
[BUG FIX] The execution was terminated by error when there is no INDEX file for the current OS version is prepared.
[BUG FIX] Some meaningless warnings are suppressed.
[BUG FIX] Comments at termination during building the temporary database were inconsistent.
modified: README
modified: bin/portsreinstall
modified: lib/libconf.sh
modified: lib/libmessage.sh
modified: lib/liboptions.sh
modified: lib/libpkgsys.sh
modified: lib/libtemp.sh
modified: man/portsreinstall.8
================================================================================
portsreinstall - ports upgrading utility for massive forced reinstallation
- Version 3.0.3, August 2, 2013
+ Version 3.0.4, November ?, 2013
Copyright (C) 2010-2013 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
================================================================================
# MYVERSION=3.0.3
# COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+)$'
# Template for development versions
-MYVERSION=3.0.3+toward_3.0.4_20131107220944
+MYVERSION=3.0.3+toward_3.0.4_20131115074959
COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+\+toward_3\.0\.[0-9]+_[0-9]+|3\.0\.[0-9]+)$'
MYPREFIX=`dirname "\`dirname \"$0\"\`" | sed 's|/bin$||'`
MYPREFIX=${MYPREFIX:-/usr/local}
need_msg=no
rm -rf "${DBDIR}/conf"
mkdir -p "${DBDIR}/conf"
- [ "x`options_get_effective_opt_load_pkgtoolsconf`" != xno -a $opt_batch_mode = no ] \
+ [ "x`options_get_effective_opt_load_pkgtoolsconf 2> /dev/null`" != xno -a $opt_batch_mode = no ] \
&& need_msg=yes
[ $need_msg = yes ] && \
message_section_title "Parsing pkgtools.conf (by using installed portupgrade)"
reinstall_exec ports-mgmt/pkg
reinstall_restore_conflicts
rm -f "${DBDIR}/target_all"
+ temp_set_msg_current_stage
message_echo
}
program_exec_and_record_completion UPGRADE_PKGNG
reinstall_exec ports-mgmt/dialog4ports
reinstall_restore_conflicts
rm -f "${DBDIR}/target_all"
+ temp_set_msg_current_stage
message_echo
}
program_exec_and_record_completion UPGRADE_DIALOG4PORTS
reinstall_exec "$MYPORTORIGIN"
reinstall_restore_conflicts
rm -f "${DBDIR}/target_all"
+ temp_set_msg_current_stage
message_echo
}
program_exec_and_record_completion UPGRADE_SELF
program_exec_and_record_completion LIST_DEINST_PKGS
# Collect entire distfiles list
-if [ $opt_suppress_inspect_entire_distinfo = yes ]
+if [ $opt_inspect_entire_distinfo = yes ]
then
PROGRAM_DEPENDS=''
_program_exec_and_record_completion__operation ()
message_section_title "Reinstallation"
program_exec_restartable_loop_operation reinst_todo
reinstall_restore_conflicts
+ temp_set_msg_current_stage
message_echo
}
program_exec_and_record_completion REINSTALLATION
{
PORTS_MOVED_DB=${PORTSDIR}/MOVED
PORTS_INDEX_DB=${PORTSDIR}/INDEX-`uname -r | cut -d . -f 1`
+ if [ ! -e "${PORTS_INDEX_DB}" ]
+ then
+ message_echo "INFO: The ports index for the current OS version is not found, so fetching it now."
+ if ! make -C "${PORTSDIR}" fetchindex || [ ! -e "${PORTS_INDEX_DB}" ]
+ then
+ message_echo "WARNING: Failed to fetch the ports index, so trying to build it locally." >&2
+ make -C "${PORTSDIR}" index
+ fi
+ fi
}
# ============= Set up environment variables =============
conf_setup_envs ()
{
local tmp_work
- tmp_work=${TMPDIR}/pkgsys_def_pkgtools:work
+ tmp_work=${TMPDIR}/conf_setup_envs:work
rm -rf "$tmp_work"
mkdir "$tmp_work"
- PORTSDIR=${PORTSDIR:-`make -C "$tmp_work" -f /etc/make.conf -V PORTSDIR`}
+ PORTSDIR=${PORTSDIR:-`[ -e /etc/make.conf ] && make -C "$tmp_work" -f /etc/make.conf -V PORTSDIR 2> /dev/null`} || :
PORTSDIR=${PORTSDIR:-/usr/ports}
for var in LOCALBASE PORT_DBDIR LINUXBASE DISTDIR PACKAGES PKGREPOSITORYSUBDIR PKGREPOSITORY
do
- val=`make -C "$tmp_work" -f "${PORTSDIR}/Mk/bsd.port.mk" -V $var`
+ val=`pkgsys_sysvar $var`
eval $var=\$val
done
PKGREPOSITORY=${PKG_PATH:-${PKGREPOSITORY}}
# ============= Output the version =============
message_version ()
{
- [ $opt_batch_mode = no ] && echo -n "${APPNAME} version "
+ [ "x$opt_batch_mode" = xno ] && echo -n "${APPNAME} version "
echo "${MYVERSION}"
}
# ============= Output a message except for the batch mode =============
message_echo ()
{
- [ $opt_batch_mode = yes ] && return
+ [ "x$opt_batch_mode" = xyes ] && return
echo "$@" | fold -s -w `misc_get_console_column_size`
}
message_cat ()
{
local ncolumns
- [ $opt_batch_mode = yes ] && return
+ [ "x$opt_batch_mode" = xyes ] && return
ncolumns=`misc_get_console_column_size`
if [ $# -eq 0 ]
then
message_credit ()
{
local ncolumns
- [ $opt_batch_mode = yes ] && return
+ [ "x$opt_batch_mode" = xyes ] && return
ncolumns=`misc_get_console_column_size`
message_version | fold -s -w $ncolumns
fold -s -w $ncolumns << eof
message_opening_notice ()
{
local ncolumns
- [ $opt_batch_mode = yes ] && return
+ [ "x$opt_batch_mode" = xyes ] && return
ncolumns=`misc_get_console_column_size`
fold -s -w $ncolumns << eof
# ============= Output the relation of the current port with specified targets =============
message_target_relations ()
{
- [ $opt_batch_mode = yes ] && return
+ [ "x$opt_batch_mode" = xyes ] && return
( set -e
origin=$1
database_query_get_target_attributes it "$origin"
k suppress-self-upadte opt_suppress_self_upadte no yes
g suppress-pkgtools-upadte opt_suppress_pkgtools_upadte no yes
c suppress-clean-obsolete-database opt_suppress_obsolete_db_clean no yes
-D suppress-entire-inspection-distinfo opt_suppress_inspect_entire_distinfo yes no
+D suppress-entire-inspection-distinfo opt_inspect_entire_distinfo yes no
n dry-run opt_dry_run no yes
X deselect-all opt_dialog_auto no none
Y select-all opt_dialog_auto no all
tmp_work=${TMPDIR}/pkgsys_sysvar:work
rm -rf "$tmp_work"
mkdir "$tmp_work"
- make -C "$tmp_work" -f "${PORTSDIR}/Mk/bsd.port.mk" -V "$var"
+ make -C "$tmp_work" -f "${PORTSDIR}/Mk/bsd.port.mk" -V "$var" 2> /dev/null
}
# ============= Get the file name of package check sum file =============
:
}
+# ============= Check whether legacy package tools are available =============
+pkgsys_is_legacy_tool_available ()
+{
+ which -s pkg_info
+}
+
# ============= Define wrapper commands for hiding the differences between pkg_* tools and pkgng =============
pkgsys_def_pkgtools ()
{
PKGSYS_CMD_PKG_ADD='pkg add'
pkg_is_tool_available ()
{
- which -a pkg | grep -v '^/usr/sbin/pkg$' | grep -q '/sbin/pkg$'
+ which -a pkg | grep -v '^/usr/sbin/pkg$' | grep -q '/sbin/pkg$' && return
+ [ -x /usr/sbin/pkg ] || return
+ /usr/sbin/pkg
+ pkg_is_tool_available
}
pkg_info_Ea ()
{
then
pkg_inst_remote "$pkg" "$mode" && return
fi
+ pkgsys_is_legacy_tool_available || return
message_echo "INFO: Trying to use a legacy package and convert it to pkgng."
pkgsys_fetch_legacy_remote "$pkg" || return
pkgarc=`pkgsys_fetch_legacy_remote__fetched_pkg`
local packagepath checksumpath pkgname
packagepath=`pkgsys_get_backup_pkg ports-mgmt/pkg` && \
pkg_add_tools "$packagepath" && return
- [ -x /usr/local/sbin/pkg ] && return
- message_echo "WARNING: WITH_PKGNG is set, but pkgng is missing. It is installed now." >&2
- [ -x /usr/sbin/pkg ] && /usr/sbin/pkg && return
+ pkg_is_tool_available && return
+ message_echo "WARNING: WITH_PKGNG is set, but pkgng is still missing. It is installed now." >&2
pkgsys_ready_checksum_file || return
checksumpath=`pkgsys_ready_checksum_file__fetched_file`
pkgname=`sed 's/^MD5[[:space:]]*(//;s/\.tbz)[[:space:]]*=[^=]*$//' "$checksumpath" \
PKGSYS_CMD_PKG_ADD='pkg_add'
pkg_is_tool_available ()
{
- :
+ pkgsys_is_legacy_tool_available
}
pkg_info_Ea ()
{
ambsuffix=
norigins=0
len_pkg=`echo -n "$pkg" | wc -c`
- while [ $len_pkg -gt 0 ]
- do
- pkg_regexp=`str_escape_regexp "$pkg"`$ambsuffix
- grep -E "^${pkg_regexp}[[:space:]]" "${DBDIR}/installed_ports:pkg_vs_origin.tbl" 2> /dev/null \
- | cut -f 2 > $tmporigin
- norigins=`wc -l < $tmporigin`
- [ $norigins -gt 0 ] && break
- len_pkg=$(($len_pkg-1))
- pkg=`echo -n "$pkg" | head -c $len_pkg`
- ambsuffix='[a-zA-Z0-9.,_+-]*'
- done
+ if [ $len_pkg -gt 0 ]
+ then
+ while :
+ do
+ pkg_regexp=`str_escape_regexp "$pkg"`$ambsuffix
+ grep -E "^${pkg_regexp}[[:space:]]" "${DBDIR}/installed_ports:pkg_vs_origin.tbl" 2> /dev/null \
+ | cut -f 2 > $tmporigin
+ norigins=`wc -l < $tmporigin`
+ [ $norigins -gt 0 ] && break
+ ambsuffix='[a-zA-Z0-9.,_+-]*'
+ len_pkg=$(($len_pkg-1))
+ [ $len_pkg -gt 0 ] || break
+ pkg=`echo -n "$pkg" | head -c $len_pkg`
+ done
+ fi
[ $norigins -eq 1 ] || return
cat "$tmporigin"
}
# ============= Creation of temporary work directories =============
temp_trap_init ()
{
- trap 'errno=$?; temp_warn_obsolete_temp_db; temp_warn_obsolete_temp_db () { :; }; temp_terminate_process; temp_terminate_process () { :; }; rm -rf "${TMPDIR}" 2> /dev/null; [ x`cat "${DBDIR}/.lock" 2> /dev/null` = x$$ ] && rm -f "${DBDIR}/.lock"; [ $errno -gt 0 -a $errno -ne 130 ] && message_echo "(Error exit by $errno)" >&2; exit $errno' 0 1 2 3 9 15 17 18
+ trap 'errno=$?; temp_warn_obsolete_temp_db; temp_warn_obsolete_temp_db () { :; }; temp_terminate_process; temp_terminate_process () { :; }; rm -rf "${TMPDIR}" 2> /dev/null; [ -n "${DBDIR}" -a x`cat "${DBDIR}/.lock" 2> /dev/null` = x$$ ] && rm -f "${DBDIR}/.lock"; [ $errno -gt 0 -a $errno -ne 130 ] && message_echo "(Error exit by $errno)" >&2; exit $errno' 0 1 2 3 9 15 17 18
{ until TMPDIR=`mktemp -dq /tmp/"${APPNAME}".XXXXXXXX` ; do : ; done ; }
chgrp "`id -gn`" "${TMPDIR}"
}
.\" ports reinstall installation guide
.\" Copyright (C) 2010-2013 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
.\" ==================================================================================
-.TH PORTSREINSTALL 8 "2 August 2013" "FreeBSD" "FreeBSD System Manager's Manual"
+.TH PORTSREINSTALL 8 "? November 2013" "FreeBSD" "FreeBSD System Manager's Manual"
.SH NAME
portsreinstall \- ports upgrading utility for massive forced reinstallation
.SH SYNOPSIS
.SH HISTORY
\fBportsreinstall\fR has been developed as below.
.TP
-3.0.4 (? August 2013)
+3.0.4 (? November 2013)
.RS
+[IMPROVED] Support for systems in which pkgng is the default or legacy package tools are abandoned is improved.
+.PP
[IMPROVED] Changes are made so that MAKE_JOBS_UNSAFE=yes is set in retrials of build and installation.
.PP
-[BUG FIX] Commands of \fBforget\fR and \fBreconf\fR and option \fB\-L\fR could have caused error ends in following \fBshow failure\fR command and the part showing the failure list at the end of commands of \fBdo\fR and \fBredo\fR.
+[BUG FIX] Commands of \fBforget\fR and \fBreconf\fR and option \fB\-L\fR could have caused error ends in following \fBshow failure\fR command and the part showing the failure list at the end of execution of \fBdo\fR and \fBredo\fR commands.
+.PP
+[BUG FIX] The execution was terminated by error when /etc/make.conf does not exist.
+.PP
+[BUG FIX] The execution was terminated by error when there is no INDEX file for the current OS version is prepared.
+.PP
+[BUG FIX] Some meaningless warnings are suppressed.
+.PP
+[BUG FIX] Comments at termination during building the temporary database were inconsistent.
.RE
.TP
3.0.3 (2 August 2013)