• R/O
  • HTTP
  • SSH
  • HTTPS

current: Commit

This is for active development.
New funtionalities are to be added actively.


Commit MetaInfo

Revision802e6293b38ca05a3d2e4309b8e3a7a951e891d3 (tree)
Time2022-04-13 07:56:59
AuthorMamoru Sakaue <sakaue.mamoru@mwgh...>
CommiterMamoru Sakaue

Log Message

[BUG FIX] Packages of the same origin with different flavors were not processed correctly.

Changes to be committed:

modified: HISTORY
modified: lib/libcommand_do.sh
modified: lib/libcommand_pkgs.sh
modified: lib/libdatabase_build.sh
modified: lib/libpkgsys.sh
modified: lib/libreinstall.sh

Change Summary

Incremental Difference

--- a/HISTORY
+++ b/HISTORY
@@ -6,6 +6,7 @@
66 [BUG FIX] Restarted runs failed if paths set to option values or their parent paths are symbolic links.
77 [BUG FIX] The mount command of portsreinstall-chroot(8) failed to detect mounted and unmounted file systems on mount points under symbolic links.
88 [BUG FIX] Command reselect ended up with "missing argument" error.
9+[BUG FIX] Packages of the same origin with different flavors were not processed correctly.
910 4.1.0 (22 September 2018)
1011 [NEW] Options -j and -x are added.
1112 [NEW] Option -J is added to the all utilities.
@@ -38,7 +39,7 @@
3839 [BUG FIX] Failure in unmounting of file systems by portsreinstall-chroot(8) left the privilege lock.
3940 [BUG FIX] Conflict was not correctly escaped in package installation.
4041 [BUG FIX] Evaluation of globs was incorrect for the regular expression form.
41-[BUG FIX] Flavored requirements were incorrectly inspected. This also caused disability of the use of default packages for flavord ports with the default configuration.
42+[BUG FIX] Flavored requirements were incorrectly inspected. This also caused disability of the use of default packages for flavored ports with the default configuration.
4243 [BUG FIX] The message about the evaluated dependency level in show command was wrong.
4344 [BUG FIX] Unselected leaf ports were skipped in (re)installtion.
4445 [BUG FIX] Some upgrading operations by portsreinstall-upgrade(8) were imperfect.
--- a/lib/libcommand_do.sh
+++ b/lib/libcommand_do.sh
@@ -224,7 +224,7 @@ command_do_reset_changed_portdb ()
224224 {
225225 local tmp_ls
226226 program_chk_stage_complete INSPECT_DEPENDENTS || return
227- pkgsys_exists_saved_port_oprions_timestamps || return
227+ pkgsys_exists_saved_port_options_timestamps || return
228228 message_section_title "Inspecting changes of port options"
229229 tmp_ls=${TMPDIR}/command_do_reset_changed_portdb
230230 rm -f "$tmp_ls.updated"
@@ -232,9 +232,9 @@ command_do_reset_changed_portdb ()
232232 then
233233 message_echo "WARNING: ${PORT_DBDIR} is missing. All port options are recognized as default."
234234 fi
235- pkgsys_get_saved_port_oprions_timestamps_all > $tmp_ls.db
236- pkgsys_get_current_port_oprions_timestamp > $tmp_ls.log
237- pkgsys_get_changed_port_oprions "$tmp_ls.db" "$tmp_ls.log" > $tmp_ls.diff
235+ pkgsys_get_saved_port_options_timestamps_all > $tmp_ls.db
236+ pkgsys_get_current_port_options_timestamp > $tmp_ls.log
237+ pkgsys_get_changed_port_options "$tmp_ls.db" "$tmp_ls.log" > $tmp_ls.diff
238238 if ! [ `wc -l < $tmp_ls.diff` -gt 0 ]
239239 then
240240 message_echo
@@ -270,7 +270,7 @@ command_do_reset_changed_portdb ()
270270 fi
271271 done
272272 message_echo "INFO: Recording for not inspected ports..."
273- pkgsys_conv_portorigin_to_port_oprion_timestamp_logname < $tmp_ls.uninspected.origin > $tmp_ls.uninspected.logname
273+ pkgsys_conv_portorigin_to_port_option_timestamp_logname < $tmp_ls.uninspected.origin > $tmp_ls.uninspected.logname
274274 str_escape_regexp_filter < $tmp_ls.uninspected.dbfile | sed 's/^/^/;s/$/[[:space:]]/' > $tmp_ls.uninspected.dbfile_ptn
275275 paste "$tmp_ls.uninspected.dbfile_ptn" "$tmp_ls.uninspected.logname" | while read -r dbfile_ptn logname
276276 do
--- a/lib/libcommand_pkgs.sh
+++ b/lib/libcommand_pkgs.sh
@@ -210,32 +210,34 @@ command_pkgs_pkgsanity ()
210210 do
211211 pkg=`sed -n ${iline}p "$tmp_list.pkgs"`
212212 iline=$((${iline}+1))
213- origin=`pkg_info_flavored_origin "$pkg"`
214- [ -n "$origin" ] || continue
215- env LANG=C grep -q -Fx "$origin" "${DBDIR}/damaged_package" 2>/dev/null && continue
216- pkgsys_sanitychk_pkgcontents "$pkg" is_reinstall_encouraged && continue
217- port_path=`pkgsys_get_portpath_from_origin "$origin"`
218- if [ ! -d "$port_path" ]
219- then
220- message_echo "WARNING: $pkg ($origin) is obsolete." >&2
221- message_echo >&2
222- continue
223- fi
224- if [ $is_reinstall_encouraged = no ]
225- then
226- if [ $opt_batch_mode = no ]
213+ for origin in `pkg_info_flavored_origins "$pkg"`
214+ do
215+ [ -n "$origin" ] || continue
216+ env LANG=C grep -q -Fx "$origin" "${DBDIR}/damaged_package" 2>/dev/null && continue
217+ pkgsys_sanitychk_pkgcontents "$pkg" is_reinstall_encouraged && continue
218+ port_path=`pkgsys_get_portpath_from_origin "$origin"`
219+ if [ ! -d "$port_path" ]
227220 then
228- message_echo "Do you want to reinstall it? (y/[n])"
229- message_query_yn_default_no || continue
221+ message_echo "WARNING: $pkg ($origin) is obsolete." >&2
222+ message_echo >&2
223+ continue
230224 fi
231- else
232- if [ $opt_batch_mode = no ]
225+ if [ $is_reinstall_encouraged = no ]
233226 then
234- message_echo "Do you want to reinstall it? ([y]/n)"
235- message_query_yn_default_yes || continue
227+ if [ $opt_batch_mode = no ]
228+ then
229+ message_echo "Do you want to reinstall it? (y/[n])"
230+ message_query_yn_default_no || continue
231+ fi
232+ else
233+ if [ $opt_batch_mode = no ]
234+ then
235+ message_echo "Do you want to reinstall it? ([y]/n)"
236+ message_query_yn_default_yes || continue
237+ fi
238+ database_record_reconf_recover_sanity "$origin"
236239 fi
237- database_record_reconf_recover_sanity "$origin"
238- fi
240+ done
239241 done
240242 }
241243
--- a/lib/libdatabase_build.sh
+++ b/lib/libdatabase_build.sh
@@ -632,7 +632,7 @@ database_build_inspect_dependencies ()
632632 else
633633 cp /dev/null "$dbpath/ports_options.current"
634634 fi
635- pkgsys_save_port_oprion_timestamp "$origin"
635+ pkgsys_save_port_option_timestamp "$origin"
636636 # Get the lists of requirements in the flavored form
637637 database_build_create_pkgtag "$origin"
638638 for variable in PKG_DEPENDS EXTRACT_DEPENDS PATCH_DEPENDS FETCH_DEPENDS BUILD_DEPENDS LIB_DEPENDS
--- a/lib/libpkgsys.sh
+++ b/lib/libpkgsys.sh
@@ -438,20 +438,29 @@ pkgsys_def_pkgtools ()
438438 # Return the total storage space occupied by the installed files in bytes
439439 pkg info -qs "$@" 2> /dev/null | sed 's/KiB$/*1024/;s/MiB$/*1024^2/;s/GiB$/*1024^3/;s/B$//' | tr '\n' + | sed 's/+$//' | bc -l
440440 }
441- pkg_info_flavor ()
441+ pkg_info_flavors ()
442+ # For an unflavored pattern, all matching flavors are returned.
442443 {
443444 local glob_unflavored
444445 glob_unflavored=$1
445446 pkg query -g '%At\t%Av' "$glob_unflavored" 2> /dev/null | env LANG=C grep -E '^flavor[[:space:]]' | cut -f 2
446447 }
447- pkg_info_flavored_origin ()
448+ pkg_info_flavored_origins ()
449+ # For an unflavored pattern, all matching flavors are returned.
448450 {
449451 local glob_unflavored origin_unflavored
450452 glob_unflavored=$1
451453 origin_unflavored=`pkg_info_qo "$glob_unflavored" 2> /dev/null || :`
452- flavor=`pkg_info_flavor "$glob_unflavored" 2> /dev/null || :`
453- [ -z "$flavor" ] || flavor=@$flavor
454- echo "$origin_unflavored$flavor"
454+ flavors=`pkg_info_flavors "$glob_unflavored" 2> /dev/null || :`
455+ if [ -z "$flavors" ]
456+ then
457+ echo "$origin_unflavored"
458+ else
459+ for flavor in $flavors
460+ do
461+ echo "$origin_unflavored@$flavor"
462+ done
463+ fi
455464 }
456465 pkg_info_all_flavored_origins ()
457466 {
@@ -866,7 +875,7 @@ pkgsys_def_pkgtools ()
866875 # Return the total storage space occupied by the installed files in bytes
867876 pkg_info -qs "$@" 2> /dev/null | sed 's/[^0-9]*/*1024/' | tr '\n' + | sed 's/+$//' | bc -l
868877 }
869- pkg_info_flavor ()
878+ pkg_info_flavors ()
870879 {
871880 pkg_info -qe "$@" 2> /dev/null && echo
872881 :
@@ -1105,15 +1114,22 @@ pkgsys_get_installed_pkg_from_origin ()
11051114 origin=$1
11061115 origin_unflavored=`pkgsys_get_unflavored_origin "$origin"`
11071116 flavor_origin=`pkgsys_get_flavor_from_origin "$origin"`
1108- pkg_info_qO "$origin_unflavored" 2> /dev/null | while read pkgname
1109- do
1110- flavor_pkg=`pkg_info_flavor "$pkgname"`
1111- if [ "x$flavor_origin" = "x$flavor_pkg" ]
1112- then
1113- echo "$pkgname"
1114- break
1115- fi
1116- done
1117+ if [ -n "$flavor_origin" ]
1118+ then
1119+ for pkgname in `pkg_info_qO "$origin_unflavored" 2> /dev/null`
1120+ do
1121+ for flavor_pkg in `pkg_info_flavors "$pkgname"`
1122+ do
1123+ if [ "x$flavor_origin" = "x$flavor_pkg" ]
1124+ then
1125+ echo "$pkgname"
1126+ return
1127+ fi
1128+ done
1129+ done
1130+ else
1131+ pkg_info_qO "$origin_unflavored" 2> /dev/null
1132+ fi
11171133 :
11181134 }
11191135
@@ -1141,8 +1157,11 @@ pkgsys_exists_from_orig ()
11411157 origin_unflavored=`pkgsys_get_unflavored_origin "$origin"`
11421158 pkg_info_eO "$origin_unflavored" 2> /dev/null || return
11431159 flavor_origin=`pkgsys_get_flavor_from_origin "$origin"`
1144- flavor_pkg=`pkg_info_flavor "$origin_unflavored"`
1145- [ "x$flavor_origin" = "x$flavor_pkg" ]
1160+ for flavor_pkg in `pkg_info_flavors "$origin_unflavored"`
1161+ do
1162+ [ "x$flavor_origin" = "x$flavor_pkg" ] && return
1163+ done
1164+ false
11461165 }
11471166
11481167 # ============= Generate the package names vs origins table at the initial state =============
@@ -1178,14 +1197,16 @@ pkgsys_get_init_pkg_from_orig ()
11781197 else
11791198 origin_unflavored=`pkgsys_get_unflavored_origin "$origin"`
11801199 flavor_origin=`pkgsys_get_flavor_from_origin "$origin"`
1181- pkg_info_qO "$origin_unflavored" 2> /dev/null | while read pkgname
1200+ for pkgname in `pkg_info_qO "$origin_unflavored" 2> /dev/null`
11821201 do
1183- flavor_pkg=`pkg_info_flavor "$pkgname"`
1184- if [ "x$flavor_origin" = "x$flavor_pkg" ]
1185- then
1186- echo "$pkgname"
1187- break
1188- fi
1202+ for flavor_pkg in `pkg_info_flavors "$pkgname"`
1203+ do
1204+ if [ "x$flavor_origin" = "x$flavor_pkg" ]
1205+ then
1206+ echo "$pkgname"
1207+ return
1208+ fi
1209+ done
11891210 done
11901211 fi
11911212 :
@@ -1671,13 +1692,13 @@ pkgsys_sanitychk_pkgcontents ()
16711692 }
16721693
16731694 # ============= Check whether the port options database is once saved =============
1674-pkgsys_exists_saved_port_oprions_timestamps ()
1695+pkgsys_exists_saved_port_options_timestamps ()
16751696 {
16761697 [ -d "${DBDIR}/ls_dbdir" ]
16771698 }
16781699
16791700 # ============= Get the current all timestamp information of port options =============
1680-pkgsys_get_current_port_oprions_timestamp ()
1701+pkgsys_get_current_port_options_timestamp ()
16811702 {
16821703 local portdb_needle_regexp
16831704 portdb_needle_regexp=`str_escape_regexp "$1"`
@@ -1700,20 +1721,20 @@ pkgsys_get_current_port_oprions_timestamp ()
17001721 }
17011722
17021723 # ============= Get the saved all timestamp information of port options =============
1703-pkgsys_get_saved_port_oprions_timestamps_all ()
1724+pkgsys_get_saved_port_options_timestamps_all ()
17041725 {
17051726 mkdir -p "${DBDIR}/ls_dbdir"
17061727 cat "${DBDIR}/ls_dbdir/"*.log 2> /dev/null || :
17071728 }
17081729
17091730 # ============= Convert a list of port origins to port options timestamp log names =============
1710-pkgsys_conv_portorigin_to_port_oprion_timestamp_logname ()
1731+pkgsys_conv_portorigin_to_port_option_timestamp_logname ()
17111732 {
17121733 sed 's|/|_|'
17131734 }
17141735
17151736 # ============= Get the file name of the port options database of a port =============
1716-pkgsys_get_port_oprion_database ()
1737+pkgsys_get_port_option_database ()
17171738 {
17181739 local origin
17191740 origin=$1
@@ -1726,23 +1747,23 @@ pkgsys_get_port_oprion_database ()
17261747 }
17271748
17281749 # ============= Save the timestamp information of port options of a port =============
1729-pkgsys_save_port_oprion_timestamp ()
1750+pkgsys_save_port_option_timestamp ()
17301751 {
17311752 local origin portoptlog portoptdb
17321753 origin=$1
1733- portoptlog=`echo "$origin" | pkgsys_conv_portorigin_to_port_oprion_timestamp_logname`
1734- portoptdb=`pkgsys_get_port_oprion_database "$origin"`
1754+ portoptlog=`echo "$origin" | pkgsys_conv_portorigin_to_port_option_timestamp_logname`
1755+ portoptdb=`pkgsys_get_port_option_database "$origin"`
17351756 mkdir -p "${DBDIR}/ls_dbdir"
1736- pkgsys_get_current_port_oprions_timestamp "$portoptdb" > ${DBDIR}/ls_dbdir/$portoptlog.log 2> /dev/null || :
1757+ pkgsys_get_current_port_options_timestamp "$portoptdb" > ${DBDIR}/ls_dbdir/$portoptlog.log 2> /dev/null || :
17371758 }
17381759
17391760 # ============= Get changed port options from the saved point =============
1740-pkgsys_get_changed_port_oprions ()
1761+pkgsys_get_changed_port_options ()
17411762 {
17421763 local saved_log current_log tmp_log
17431764 saved_log=$1
17441765 current_log=$2
1745- tmp_log=${TMPDIR}/pkgsys_get_changed_port_oprions.log
1766+ tmp_log=${TMPDIR}/pkgsys_get_changed_port_options.log
17461767 {
17471768 env LANG=C grep -vxF -f "$current_log" "$saved_log" || :
17481769 env LANG=C grep -vxF -f "$saved_log" "$current_log" || :
--- a/lib/libreinstall.sh
+++ b/lib/libreinstall.sh
@@ -249,41 +249,43 @@ reinstall_backup_and_delete_conflicts ()
249249 message_echo "INFO: Deinstalling conflicting packages for $REINSTALL_ORIGPKGTAG."
250250 while read pkg
251251 do
252- origin=`pkg_info_flavored_origin "$pkg"`
253- origin_equiv=`database_query_get_equivalent_orgin "$origin"`
254- message_echo "INFO: Backing up and deleting a conflict, $origin ($pkg)."
255- origin_regexp_esc=`str_escape_regexp "$origin"`
256- origin_equiv_regexp_esc=`str_escape_regexp "$origin_equiv"`
257- if [ -d "${DBDIR}/requires/$origin" ]
258- then
259- backup_pkgdir=${DBDIR}/backup_packages
260- else
261- backup_pkgdir=${PKGREPOSITORY}
262- fi
263- mkdir -p "$backup_pkgdir"
264- if backup_pkg=`pkgsys_get_backup_pkg "$origin"` || backup_pkg=`pkgsys_get_backup_pkg "$origin_equiv"`
265- then
266- message_echo "INFO: backup package already exists as $backup_pkg"
267- elif ! backup_pkg=`pkgsys_create_backup_pkg "$pkg" "$backup_pkgdir"`
268- then
269- message_echo "WARNING: Failed to create the backup package, the conflict is kept installed." >&2
270- continue
271- fi
272- env LANG=C grep -v -E "^${origin_regexp_esc}[[:space:]]" "${DBDIR}/deleted_conflicts" \
273- > ${DBDIR}/deleted_conflicts.tmp 2> /dev/null || :
274- if [ -n "$origin_equiv_regexp_esc" ]
275- then
276- env LANG=C grep -v -E "^${origin_equiv_regexp_esc}[[:space:]]" "${DBDIR}/deleted_conflicts.tmp" \
277- > ${DBDIR}/deleted_conflicts.tmp2 2> /dev/null || :
278- mv "${DBDIR}/deleted_conflicts.tmp2" "${DBDIR}/deleted_conflicts.tmp"
279- fi
280- printf '%s\t%s\n' "$origin" "$pkg" >> ${DBDIR}/deleted_conflicts.tmp
281- [ -n "$origin_equiv" ] && printf '%s\t%s\n' "$origin_equiv" "$pkg" >> ${DBDIR}/deleted_conflicts.tmp
282- mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts"
283- pkg_delete_f "$pkg" || \
284- {
285- message_echo "WARNING: Failed to deinstall $pkg by $PKGSYS_CMD_PKG_DELETE." >&2
286- }
252+ for origin in `pkg_info_flavored_origins "$pkg"`
253+ do
254+ origin_equiv=`database_query_get_equivalent_orgin "$origin"`
255+ message_echo "INFO: Backing up and deleting a conflict, $origin ($pkg)."
256+ origin_regexp_esc=`str_escape_regexp "$origin"`
257+ origin_equiv_regexp_esc=`str_escape_regexp "$origin_equiv"`
258+ if [ -d "${DBDIR}/requires/$origin" ]
259+ then
260+ backup_pkgdir=${DBDIR}/backup_packages
261+ else
262+ backup_pkgdir=${PKGREPOSITORY}
263+ fi
264+ mkdir -p "$backup_pkgdir"
265+ if backup_pkg=`pkgsys_get_backup_pkg "$origin"` || backup_pkg=`pkgsys_get_backup_pkg "$origin_equiv"`
266+ then
267+ message_echo "INFO: backup package already exists as $backup_pkg"
268+ elif ! backup_pkg=`pkgsys_create_backup_pkg "$pkg" "$backup_pkgdir"`
269+ then
270+ message_echo "WARNING: Failed to create the backup package, the conflict is kept installed." >&2
271+ continue
272+ fi
273+ env LANG=C grep -v -E "^${origin_regexp_esc}[[:space:]]" "${DBDIR}/deleted_conflicts" \
274+ > ${DBDIR}/deleted_conflicts.tmp 2> /dev/null || :
275+ if [ -n "$origin_equiv_regexp_esc" ]
276+ then
277+ env LANG=C grep -v -E "^${origin_equiv_regexp_esc}[[:space:]]" "${DBDIR}/deleted_conflicts.tmp" \
278+ > ${DBDIR}/deleted_conflicts.tmp2 2> /dev/null || :
279+ mv "${DBDIR}/deleted_conflicts.tmp2" "${DBDIR}/deleted_conflicts.tmp"
280+ fi
281+ printf '%s\t%s\n' "$origin" "$pkg" >> ${DBDIR}/deleted_conflicts.tmp
282+ [ -n "$origin_equiv" ] && printf '%s\t%s\n' "$origin_equiv" "$pkg" >> ${DBDIR}/deleted_conflicts.tmp
283+ mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts"
284+ pkg_delete_f "$pkg" || \
285+ {
286+ message_echo "WARNING: Failed to deinstall $pkg by $PKGSYS_CMD_PKG_DELETE." >&2
287+ }
288+ done
287289 done
288290 cat "${DBDIR}/deleted_conflicts" 2> /dev/null | sort -u > ${DBDIR}/deleted_conflicts.tmp
289291 mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts"
@@ -325,12 +327,14 @@ reinstall_backup_and_delete_remaining_install_conflicts ()
325327 pkg=`pkg_which "$filepath" || :`
326328 [ -z "$pkg" ] && continue
327329 env LANG=C grep -qFx "$pkg" "$tmp_conflicts.pkgs" && continue
328- origin=`pkg_info_flavored_origin "$pkg"`
329- [ x"$origin" = x"$REINSTALL_ORIGIN" ] && continue
330- [ x"$origin" = x"$REINSTALL_ORIGIN_equiv" ] && continue
331- origin_equiv=`database_query_get_equivalent_orgin "$origin"`
332- [ x"$origin_equiv" = x"$REINSTALL_ORIGIN" ] && continue
333- printf '%s\t%s\n' "$pkg" "$filepath" >> $db_conflict.tmp
330+ for origin in `pkg_info_flavored_origins "$pkg"`
331+ do
332+ [ x"$origin" = x"$REINSTALL_ORIGIN" ] && continue
333+ [ x"$origin" = x"$REINSTALL_ORIGIN_equiv" ] && continue
334+ origin_equiv=`database_query_get_equivalent_orgin "$origin"`
335+ [ x"$origin_equiv" = x"$REINSTALL_ORIGIN" ] && continue
336+ printf '%s\t%s\n' "$pkg" "$filepath" >> $db_conflict.tmp
337+ done
334338 done
335339 if [ -e "$db_conflict.tmp" ]
336340 then
@@ -620,9 +624,11 @@ reinstall_pkg_backup ()
620624 }
621625
622626 # ============= Deinstallation of the currently installed package =============
627+# For a flavored package, its unflavored one is also deinstalled if existing.
628+# For an unflavored package, its all flavored ones are also deinstalled if existing.
623629 reinstall_deinstall ()
624630 {
625- local tmp_installedpkg REINSTALL_ORIGIN_equiv installed_pkgs dev_out dev_err
631+ local tmp_installedpkg REINSTALL_ORIGIN_equiv installed_pkgs dev_out dev_err flavor
626632 dev_out=/dev/stdout
627633 dev_err=/dev/stderr
628634 if [ $opt_batch_mode = yes ]
@@ -643,6 +649,12 @@ reinstall_deinstall ()
643649 message_echo "WARNING: Failed to deinstall." >&2
644650 }
645651 else
652+ flavor=`pkgsys_get_flavor_from_origin "$REINSTALL_ORIGIN"`
653+ if [ -n "$flavor" ]
654+ then
655+ pkgsys_get_unflavored_origin "$REINSTALL_ORIGIN" >> $tmp_installedpkg
656+ else
657+ fi
646658 while read pkg
647659 do
648660 message_echo "INFO: Deinstalling $pkg by $PKGSYS_CMD_PKG_DELETE." >&2
Show on old repository browser