• R/O
  • HTTP
  • SSH
  • HTTPS

current: Commit

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


Commit MetaInfo

Revision891fdc422384308ad475d9b376a29f05f7774498 (tree)
Time2018-09-12 20:38:34
AuthorMamoru Sakaue / MwGhennndo <glmwghennndo@user...>
CommiterMamoru Sakaue / MwGhennndo

Log Message

Newly added portsreinstall show moved and fixed packupgrade create to delete all moved ports.

Changes to be committed:

modified: lib/libcommand_pkgs.sh
modified: lib/libcommand_show.sh
modified: lib/libdatabase_build.sh
modified: lib/libdatabase_query.sh
modified: lib/libmain.sh
modified: lib/main/libcommand.sh
modified: lib/main/libusage.sh
modified: man/portsreinstall.8

Change Summary

Incremental Difference

--- a/lib/libcommand_pkgs.sh
+++ b/lib/libcommand_pkgs.sh
@@ -273,6 +273,7 @@ command_pkgs_packupgrade_create__prepare ()
273273 message_section_title "Preparation"
274274 mkdir -p "${PACKAGES}/${PKGREPOSITORYSUBDIR}"
275275 cp "${DBDIR}/reinst_order.list" "${DBDIR}/stage.loop_list/command_packupgrade_pack"
276+ cat "${DBDIR}/moved_ports" "${DBDIR}/stage.loop_list/ports_to_delete" > ${DBDIR}/stage.loop_list/command_packupgrade_delete 2> /dev/null
276277 dstdir=${DBDIR}/command_packupgrade
277278 rm -rf "$dstdir" "$dstdir.tar.gz"
278279 mkdir -p "$dstdir"
@@ -284,6 +285,26 @@ command_pkgs_packupgrade_create__prepare ()
284285 program_exec_and_record_completion COMMAND_PACKUPGRADE_PREPARE
285286 }
286287
288+# ============= Stage of creating the manifest of deletion in operation of packupgrade create command =============
289+command_pkgs_packupgrade_create__manifest_delete ()
290+{
291+ local PROGRAM_DEPENDS
292+ PROGRAM_DEPENDS='COMMAND_PACKUPGRADE_PREPARE'
293+ _program_exec_restartable_loop_operation__routine ()
294+ {
295+ local origin
296+ origin=$1
297+ printf '%s\t%s\t%s\n' delete "$pkgname" "$origin" >> ${DBDIR}/command_packupgrade/etc/manifest.lst.delete
298+ }
299+ _program_exec_and_record_completion__operation ()
300+ {
301+ message_section_title "Create manifest of deletion"
302+ program_exec_restartable_loop_operation command_packupgrade_delete
303+ message_echo
304+ }
305+ program_exec_and_record_completion COMMAND_PACKUPGRADE_MANIFEST_DELETE
306+}
307+
287308 # ============= Stage of creating the manifest of reinstallation in operation of packupgrade create command =============
288309 command_pkgs_packupgrade_create__manifest_reinst ()
289310 {
@@ -345,7 +366,7 @@ command_pkgs_packupgrade_create__manifest_reinst ()
345366 done
346367 printf '%s\t%s\t%s\n' add "$pkgname" null >> $tmp_manifest
347368 fi
348- cat "$tmp_manifest" >> $dstdir/etc/manifest.lst
369+ cat "$tmp_manifest" >> $dstdir/etc/manifest.lst.update
349370 }
350371 _program_exec_and_record_completion__operation ()
351372 {
@@ -355,32 +376,11 @@ command_pkgs_packupgrade_create__manifest_reinst ()
355376 mkdir -p "${PACKAGESDIR}"
356377 PACKAGESDIR=`realpath "${PACKAGESDIR}"`
357378 program_exec_restartable_loop_operation command_packupgrade_pack
358- cp "${DBDIR}/stage.loop_list/ports_to_delete" "${DBDIR}/stage.loop_list/command_packupgrade_delete"
359379 message_echo
360380 }
361381 program_exec_and_record_completion COMMAND_PACKUPGRADE_MANIFEST_REINST
362382 }
363383
364-# ============= Stage of creating the manifest of deletion in operation of packupgrade create command =============
365-command_pkgs_packupgrade_create__manifest_delete ()
366-{
367- local PROGRAM_DEPENDS
368- PROGRAM_DEPENDS='COMMAND_PACKUPGRADE_MANIFEST_REINST'
369- _program_exec_restartable_loop_operation__routine ()
370- {
371- local origin
372- origin=$1
373- printf '%s\t%s\t%s\n' delete "$pkgname" "$origin" >> ${DBDIR}/command_packupgrade/etc/manifest.lst
374- }
375- _program_exec_and_record_completion__operation ()
376- {
377- message_section_title "Create manifest of deletion"
378- program_exec_restartable_loop_operation command_packupgrade_delete
379- message_echo
380- }
381- program_exec_and_record_completion COMMAND_PACKUPGRADE_MANIFEST_DELETE
382-}
383-
384384 # ============= Stage of packing in operation of packupgrade create command =============
385385 command_pkgs_packupgrade_create__pack ()
386386 {
@@ -391,6 +391,7 @@ command_pkgs_packupgrade_create__pack ()
391391 local dstdir
392392 message_section_title "Packing for the upgrade at the target systems"
393393 dstdir=${DBDIR}/command_packupgrade
394+ cat "$dstdir/etc/manifest.lst.delete" "$dstdir/etc/manifest.lst.update" > $dstdir/etc/manifest.lst
394395 install -m 444 "${DBDIR}"/WITH_PKGNG "${DBDIR}"/conf/complete_setup.sh "${DBDIR}"/conf/setenv.sh "$dstdir/etc"
395396 install "${SHAREDIR}/bin/${APPNAME}-upgrade" "$dstdir"
396397 install -d "$dstdir/lib/upgrade" "$dstdir/man/man8"
@@ -415,10 +416,10 @@ command_pkgs_packupgrade_create ()
415416 fi
416417 # Preparation
417418 command_pkgs_packupgrade_create__prepare
418- # Create manifest of (re)installation and package archives
419- command_pkgs_packupgrade_create__manifest_reinst
420419 # Create manifest of deletion
421420 command_pkgs_packupgrade_create__manifest_delete
421+ # Create manifest of (re)installation and package archives
422+ command_pkgs_packupgrade_create__manifest_reinst
422423 # Packing for the upgrade at the target systems
423424 command_pkgs_packupgrade_create__pack
424425 }
--- a/lib/libcommand_show.sh
+++ b/lib/libcommand_show.sh
@@ -17,7 +17,7 @@ command_show ()
1717 [ -n "$COMMAND_SHOW_LEVEL" ] || COMMAND_SHOW_LEVEL=`options_get_dependency_level`
1818 dbsuffix=$COMMAND_SHOW_DEPTAG.$COMMAND_SHOW_LEVEL
1919 case $COMMAND_SHOW_SUBJECT in
20- todo | done | redo | resolved | inst_by_pkg | inst_built_default | inst_built_custom | failure | taboo | freeze | need | noneed | deleted | restored | fossil |conflict )
20+ todo | done | redo | resolved | inst_by_pkg | inst_built_default | inst_built_custom | failure | taboo | freeze | need | noneed | deleted | restored | fossil |conflict | moved )
2121 database_query_show_single_list_exec "$COMMAND_SHOW_SUBJECT" \
2222 "$COMMAND_SHOW_DEPTAG" "$COMMAND_SHOW_LEVEL" || :
2323 ;;
--- a/lib/libdatabase_build.sh
+++ b/lib/libdatabase_build.sh
@@ -45,6 +45,7 @@ database_build_convert_and_register_origin_if_obsolete ()
4545 if [ `wc -l < ${TMPDIR}/moved.info` -eq 0 ]
4646 then
4747 fileedit_add_a_line_if_new "$origin" "${DBDIR}/obsolete_ports"
48+ fileedit_rm_a_line "$origin" "${DBDIR}/moved_ports"
4849 if [ -n "$recursedb_in" ]
4950 then
5051 message_echo "${DEPTH_INDEX} ===> Disappeared port (MOVED broken?)"
@@ -62,10 +63,13 @@ database_build_convert_and_register_origin_if_obsolete ()
6263 then
6364 message_echo "${DEPTH_INDEX} ===> Moved to $origin_new at $date_moved because \"$why_moved\""
6465 fileedit_add_a_line_if_new "$origin" "${TMPDIR}/database_build_convert_and_register_origin_if_obsolete:origins_old"
66+ fileedit_add_a_line_if_new "$origin" "${DBDIR}/moved_ports"
67+ fileedit_rm_a_line "$origin" "${DBDIR}/obsolete_ports"
6568 database_build_convert_and_register_origin_if_obsolete "$origin_new" "${TMPDIR}/MOVED.DB" || return 1
6669 else
6770 message_echo "${DEPTH_INDEX} ===> Deleted at $date_moved because \"$why_moved\""
6871 fileedit_add_a_line_if_new "$origin" "${DBDIR}/obsolete_ports"
72+ fileedit_rm_a_line "$origin" "${DBDIR}/moved_ports"
6973 return 1
7074 fi
7175 fi
@@ -296,6 +300,7 @@ database_build_is_port_already_inspected_in_required_level ()
296300 inspected_level=`database_build_get_inspected_level "$origin_actual" "$origin_dependent"`
297301 {
298302 cat "${DBDIR}/ports.inspected.${inspected_level}.list" || :
303+ cat "${DBDIR}/moved_ports" || :
299304 cat "${DBDIR}/obsolete_ports" || :
300305 } 2> /dev/null | grep -q -Fx "$origin_actual" || return
301306 fileedit_rm_a_line "$origin" "${DBDIR}/stage.loop_list/ports_to_inspect.remain"
@@ -556,6 +561,7 @@ database_build_inspect_dependencies ()
556561 if ! grep -qFx "$origin" "${DBDIR}/done_required_ports_to_inspect" 2> /dev/null
557562 then
558563 fileedit_rm_a_line "$origin" "${DBDIR}/obsolete_ports"
564+ fileedit_rm_a_line "$origin" "${DBDIR}/moved_ports"
559565 dbpath=${DBDIR}/requires/$origin
560566 dbpath_prev=${DBDIR}/prevset/requires/$origin
561567 if [ ! -e "$dbpath/complete_as_node" ] || \
@@ -1083,6 +1089,7 @@ _database_build_reset_a_port_confdb ()
10831089 fileedit_rm_a_line "$origin" "${DBDIR}/ports.inspected.${level}.list"
10841090 done
10851091 fileedit_rm_a_line "$origin" "${DBDIR}/obsolete_ports"
1092+ fileedit_rm_a_line "$origin" "${DBDIR}/moved_ports"
10861093 fileedit_rm_a_line "$origin" "${DBDIR}/ports.inspected.list"
10871094 cat "${DBDIR}/replace/$origin/origin" 2> /dev/null || :
10881095 }
--- a/lib/libdatabase_query.sh
+++ b/lib/libdatabase_query.sh
@@ -585,6 +585,40 @@ database_query_is_necessary_upgrade ()
585585 fileedit_exists_old_lines "$tmpfile_old" "$tmpfile_new"
586586 }
587587
588+# ============= Show moved or replaced ports to alternatives =============
589+database_query_show_list_moved ()
590+{
591+ cat "${DBDIR}/moved_ports" 2> /dev/null | while read origin
592+ do
593+ lastorigin=$origin
594+ while [ -n "$lastorigin" -a -e "${DBDIR}/replace/$lastorigin/origin" ]
595+ do
596+ lastorigin=`cat "${DBDIR}/replace/$lastorigin/origin"`
597+ done
598+ [ -n "$lastorigin" ] || continue
599+ pkg=
600+ for table in $pkgnamedb
601+ do
602+ pkg=`cat "${DBDIR}/$table/$origin/pkgtag" 2> /dev/null` || :
603+ [ -n "$pkg" ] && break
604+ done
605+ [ -n "$pkg" ] || pkg='not installed'
606+ lastpkg=
607+ for table in moved_from obsolete initial
608+ do
609+ lastpkg=`cat "${DBDIR}/$table/$lastorigin/pkgtag" 2> /dev/null` || :
610+ [ -n "$lastpkg" ] && break
611+ done
612+ [ -n "$lastpkg" ] || lastpkg='not installed'
613+ if [ $opt_batch_mode = no ]
614+ then
615+ echo "$origin ($pkg) => $lastorigin ($lastpkg)"
616+ else
617+ printf '%s\t%s\t%s\t%s\n' "$origin" "$pkg" "$lastorigin" "$lastpkg"
618+ fi
619+ done
620+}
621+
588622 # ============= Actual operations of "show" command for a single list =============
589623 database_query_show_single_list_exec ()
590624 {
@@ -661,6 +695,12 @@ database_query_show_single_list_exec ()
661695 database_query_show_list_failed_conflicts_restoration
662696 return
663697 ;;
698+ moved )
699+ message_echo "The following ports are moved/replaced to new alternatives:"
700+ message_echo
701+ database_query_show_list_moved
702+ return
703+ ;;
664704 taboo )
665705 message_echo "The following ports are registered as taboo:"
666706 message_echo
--- a/lib/libmain.sh
+++ b/lib/libmain.sh
@@ -12,7 +12,7 @@ main_set_version ()
1212 MYVERSION=4.1.0
1313 COMPATIBLE_VERSIONS='^(4\.[1]\.[0-9])$'
1414 # Template for development versions
15- MYVERSION=4.0.0+toward_4.1.0_20180912000219
15+ MYVERSION=4.0.0+toward_4.1.0_20180912193809
1616 COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
1717 }
1818
--- a/lib/main/libcommand.sh
+++ b/lib/main/libcommand.sh
@@ -234,7 +234,7 @@ command_all_parse_args ()
234234 shift || :
235235 fi
236236 case $COMMAND_SHOW_SUBJECT in
237- todo | done | redo | resolved | inst_by_pkg | inst_built_default | inst_built_custom | failure | taboo | freeze | need | noneed | restored | deleted | fossil | conflict )
237+ todo | done | redo | resolved | inst_by_pkg | inst_built_default | inst_built_custom | failure | taboo | freeze | need | noneed | restored | deleted | fossil | conflict | moved )
238238 _command_parse_args__chk_no_arg $#
239239 ;;
240240 leaves | obsolete )
--- a/lib/main/libusage.sh
+++ b/lib/main/libusage.sh
@@ -82,7 +82,7 @@ USAGE: portsreinstall [OPTIONS] [--] [command]
8282 | show todo | show done | show resolved | show failure | show redo
8383 | show inst_by_pkg | show inst_built_default | show inst_built_custom
8484 | show taboo | show need | show noneed | show restored | show deleted
85- | show fossil | show conflict
85+ | show fossil | show conflict | show moved
8686 | show build_conflict_pkgs | show inst_conflict_pkgs
8787 | show leaves [selected | unselected] | show obsolete [selected | unselected]
8888 | show requirements glob... | show dependents glob...
--- a/man/portsreinstall.8
+++ b/man/portsreinstall.8
@@ -319,6 +319,10 @@ With \fB\-a\fR option, the first and second columns denote the flavored origin a
319319 Conflicting ports which are temporarily deleted.
320320 With \fB\-a\fR option, the first, second and third columns denote the flavored origin, initial/new/current package name, and opponent ports concatenated by comma, respectively.
321321 .TP
322+\fBmoved\fR
323+Moved or replaced ports.
324+With \fB\-a\fR option, the first, second, third and fourth columns denote the flavored initial origin, initial package name, flavored alternative origin and alternative package name, respectively.
325+.TP
322326 \fBbuild_conflict_pkgs\fR \fIglob\fR [\fIglob2\fR...]
323327 Installed packages which conflict with ports matching \fIglob\fRs in the build.
324328 The package names are listed in a single column.
@@ -1151,7 +1155,7 @@ Configuration file of \fBportupgrade\fR(1).
11511155 .PP
11521156 [NEW] \fBauto\fR and \fBdestroy\fR commands are added to \fBportsreinstall\-chroot\fR(8).
11531157 .PP
1154-[NEW] \fBpkg\fR, \fBmake\fR, \fBshow build_conflict_pkgs\fR, \fBshow inst_conflict_pkgs\fR, \fBshow errormessage\fR, \fBshow inst_by_pkg\fR, \fBshow inst_built_default\fR, \fBshow inst_built_custom\fR, \fBshow fossil\fR, \fBshow leaves\fR and \fBshow obsolete\fR commands are added.
1158+[NEW] \fBpkg\fR, \fBmake\fR, \fBshow build_conflict_pkgs\fR, \fBshow inst_conflict_pkgs\fR, \fBshow errormessage\fR, \fBshow inst_by_pkg\fR, \fBshow inst_built_default\fR, \fBshow inst_built_custom\fR, \fBshow fossil\fR, \fBshow moved\fR, \fBshow leaves\fR and \fBshow obsolete\fR commands are added.
11551159 .PP
11561160 [NEW] Command \fBshow status\fR newly supports \fBinst_by_pkg\fR, \fBinst_built_default\fR, \fBinst_built_custom\fR and \fBfossil\fR.
11571161 .PP
Show on old repository browser