OSDN Git Service

Newly added portsreinstall show moved and fixed packupgrade create to delete all...
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Wed, 12 Sep 2018 11:38:34 +0000 (19:38 +0800)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Wed, 12 Sep 2018 11:38:34 +0000 (19:38 +0800)
 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

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

index 3b42c0d..6d73424 100644 (file)
@@ -273,6 +273,7 @@ command_pkgs_packupgrade_create__prepare ()
                message_section_title "Preparation"
                mkdir -p "${PACKAGES}/${PKGREPOSITORYSUBDIR}"
                cp "${DBDIR}/reinst_order.list" "${DBDIR}/stage.loop_list/command_packupgrade_pack"
+               cat "${DBDIR}/moved_ports" "${DBDIR}/stage.loop_list/ports_to_delete" > ${DBDIR}/stage.loop_list/command_packupgrade_delete 2> /dev/null
                dstdir=${DBDIR}/command_packupgrade
                rm -rf "$dstdir" "$dstdir.tar.gz"
                mkdir -p "$dstdir"
@@ -284,6 +285,26 @@ command_pkgs_packupgrade_create__prepare ()
        program_exec_and_record_completion COMMAND_PACKUPGRADE_PREPARE
 }
 
+# ============= Stage of creating the manifest of deletion in operation of packupgrade create command =============
+command_pkgs_packupgrade_create__manifest_delete ()
+{
+       local PROGRAM_DEPENDS
+       PROGRAM_DEPENDS='COMMAND_PACKUPGRADE_PREPARE'
+       _program_exec_restartable_loop_operation__routine ()
+       {
+               local origin
+               origin=$1
+               printf '%s\t%s\t%s\n' delete "$pkgname" "$origin" >> ${DBDIR}/command_packupgrade/etc/manifest.lst.delete
+       }
+       _program_exec_and_record_completion__operation ()
+       {
+               message_section_title "Create manifest of deletion"
+               program_exec_restartable_loop_operation command_packupgrade_delete
+               message_echo
+       }
+       program_exec_and_record_completion COMMAND_PACKUPGRADE_MANIFEST_DELETE
+}
+
 # ============= Stage of creating the manifest of reinstallation in operation of packupgrade create command =============
 command_pkgs_packupgrade_create__manifest_reinst ()
 {
@@ -345,7 +366,7 @@ command_pkgs_packupgrade_create__manifest_reinst ()
                        done
                        printf '%s\t%s\t%s\n' add "$pkgname" null >> $tmp_manifest
                fi
-               cat "$tmp_manifest" >> $dstdir/etc/manifest.lst
+               cat "$tmp_manifest" >> $dstdir/etc/manifest.lst.update
        }
        _program_exec_and_record_completion__operation ()
        {
@@ -355,32 +376,11 @@ command_pkgs_packupgrade_create__manifest_reinst ()
                mkdir -p "${PACKAGESDIR}"
                PACKAGESDIR=`realpath "${PACKAGESDIR}"`
                program_exec_restartable_loop_operation command_packupgrade_pack
-               cp "${DBDIR}/stage.loop_list/ports_to_delete" "${DBDIR}/stage.loop_list/command_packupgrade_delete"
                message_echo
        }
        program_exec_and_record_completion COMMAND_PACKUPGRADE_MANIFEST_REINST
 }
 
-# ============= Stage of creating the manifest of deletion in operation of packupgrade create command =============
-command_pkgs_packupgrade_create__manifest_delete ()
-{
-       local PROGRAM_DEPENDS
-       PROGRAM_DEPENDS='COMMAND_PACKUPGRADE_MANIFEST_REINST'
-       _program_exec_restartable_loop_operation__routine ()
-       {
-               local origin
-               origin=$1
-               printf '%s\t%s\t%s\n' delete "$pkgname" "$origin" >> ${DBDIR}/command_packupgrade/etc/manifest.lst
-       }
-       _program_exec_and_record_completion__operation ()
-       {
-               message_section_title "Create manifest of deletion"
-               program_exec_restartable_loop_operation command_packupgrade_delete
-               message_echo
-       }
-       program_exec_and_record_completion COMMAND_PACKUPGRADE_MANIFEST_DELETE
-}
-
 # ============= Stage of packing in operation of packupgrade create command =============
 command_pkgs_packupgrade_create__pack ()
 {
@@ -391,6 +391,7 @@ command_pkgs_packupgrade_create__pack ()
                local dstdir
                message_section_title "Packing for the upgrade at the target systems"
                dstdir=${DBDIR}/command_packupgrade
+               cat "$dstdir/etc/manifest.lst.delete" "$dstdir/etc/manifest.lst.update" > $dstdir/etc/manifest.lst
                install -m 444 "${DBDIR}"/WITH_PKGNG "${DBDIR}"/conf/complete_setup.sh "${DBDIR}"/conf/setenv.sh "$dstdir/etc"
                install "${SHAREDIR}/bin/${APPNAME}-upgrade" "$dstdir"
                install -d "$dstdir/lib/upgrade" "$dstdir/man/man8"
@@ -415,10 +416,10 @@ command_pkgs_packupgrade_create ()
        fi
        # Preparation
        command_pkgs_packupgrade_create__prepare
-       # Create manifest of (re)installation and package archives
-       command_pkgs_packupgrade_create__manifest_reinst
        # Create manifest of deletion
        command_pkgs_packupgrade_create__manifest_delete
+       # Create manifest of (re)installation and package archives
+       command_pkgs_packupgrade_create__manifest_reinst
        # Packing for the upgrade at the target systems
        command_pkgs_packupgrade_create__pack
 }
index e1f0435..165ade3 100644 (file)
@@ -17,7 +17,7 @@ command_show ()
        [ -n "$COMMAND_SHOW_LEVEL" ] || COMMAND_SHOW_LEVEL=`options_get_dependency_level`
        dbsuffix=$COMMAND_SHOW_DEPTAG.$COMMAND_SHOW_LEVEL
        case $COMMAND_SHOW_SUBJECT in
-       todo | done | redo | resolved | inst_by_pkg | inst_built_default | inst_built_custom | failure | taboo | freeze | need | noneed | deleted | restored | fossil |conflict )
+       todo | done | redo | resolved | inst_by_pkg | inst_built_default | inst_built_custom | failure | taboo | freeze | need | noneed | deleted | restored | fossil |conflict | moved )
                database_query_show_single_list_exec "$COMMAND_SHOW_SUBJECT" \
                        "$COMMAND_SHOW_DEPTAG" "$COMMAND_SHOW_LEVEL" || :
                ;;
index ce40aeb..6cdb5d9 100644 (file)
@@ -45,6 +45,7 @@ database_build_convert_and_register_origin_if_obsolete ()
        if [ `wc -l < ${TMPDIR}/moved.info` -eq 0 ]
        then
                fileedit_add_a_line_if_new "$origin" "${DBDIR}/obsolete_ports"
+               fileedit_rm_a_line "$origin" "${DBDIR}/moved_ports"
                if [ -n "$recursedb_in" ]
                then
                        message_echo "${DEPTH_INDEX}  ===> Disappeared port (MOVED broken?)"
@@ -62,10 +63,13 @@ database_build_convert_and_register_origin_if_obsolete ()
                then
                        message_echo "${DEPTH_INDEX}  ===> Moved to $origin_new at $date_moved because \"$why_moved\""
                        fileedit_add_a_line_if_new "$origin" "${TMPDIR}/database_build_convert_and_register_origin_if_obsolete:origins_old"
+                       fileedit_add_a_line_if_new "$origin" "${DBDIR}/moved_ports"
+                       fileedit_rm_a_line "$origin" "${DBDIR}/obsolete_ports"
                        database_build_convert_and_register_origin_if_obsolete "$origin_new" "${TMPDIR}/MOVED.DB" || return 1
                else
                        message_echo "${DEPTH_INDEX}  ===> Deleted at $date_moved because \"$why_moved\""
                        fileedit_add_a_line_if_new "$origin" "${DBDIR}/obsolete_ports"
+                       fileedit_rm_a_line "$origin" "${DBDIR}/moved_ports"
                        return 1
                fi
        fi
@@ -296,6 +300,7 @@ database_build_is_port_already_inspected_in_required_level ()
        inspected_level=`database_build_get_inspected_level "$origin_actual" "$origin_dependent"`
        {
                cat "${DBDIR}/ports.inspected.${inspected_level}.list" || :
+               cat "${DBDIR}/moved_ports" || :
                cat "${DBDIR}/obsolete_ports" || :
        }  2> /dev/null | grep -q -Fx "$origin_actual" || return
        fileedit_rm_a_line "$origin" "${DBDIR}/stage.loop_list/ports_to_inspect.remain"
@@ -556,6 +561,7 @@ database_build_inspect_dependencies ()
                        if ! grep -qFx "$origin" "${DBDIR}/done_required_ports_to_inspect" 2> /dev/null
                        then
                                fileedit_rm_a_line "$origin" "${DBDIR}/obsolete_ports"
+                               fileedit_rm_a_line "$origin" "${DBDIR}/moved_ports"
                                dbpath=${DBDIR}/requires/$origin
                                dbpath_prev=${DBDIR}/prevset/requires/$origin
                                if [ ! -e "$dbpath/complete_as_node" ] || \
@@ -1083,6 +1089,7 @@ _database_build_reset_a_port_confdb ()
                fileedit_rm_a_line "$origin" "${DBDIR}/ports.inspected.${level}.list"
        done
        fileedit_rm_a_line "$origin" "${DBDIR}/obsolete_ports"
+       fileedit_rm_a_line "$origin" "${DBDIR}/moved_ports"
        fileedit_rm_a_line "$origin" "${DBDIR}/ports.inspected.list"
        cat "${DBDIR}/replace/$origin/origin" 2> /dev/null || :
 }
index 6ce890a..807ee2a 100644 (file)
@@ -585,6 +585,40 @@ database_query_is_necessary_upgrade ()
        fileedit_exists_old_lines "$tmpfile_old" "$tmpfile_new"
 }
 
+# ============= Show moved or replaced ports to alternatives =============
+database_query_show_list_moved ()
+{
+       cat "${DBDIR}/moved_ports" 2> /dev/null | while read origin
+       do
+               lastorigin=$origin
+               while [ -n "$lastorigin" -a -e "${DBDIR}/replace/$lastorigin/origin" ]
+               do
+                       lastorigin=`cat "${DBDIR}/replace/$lastorigin/origin"`
+               done
+               [ -n "$lastorigin" ] || continue
+               pkg=
+               for table in $pkgnamedb
+               do
+                       pkg=`cat "${DBDIR}/$table/$origin/pkgtag" 2> /dev/null` || :
+                       [ -n "$pkg" ] && break
+               done
+               [ -n "$pkg" ] || pkg='not installed'
+               lastpkg=
+               for table in moved_from obsolete initial
+               do
+                       lastpkg=`cat "${DBDIR}/$table/$lastorigin/pkgtag" 2> /dev/null` || :
+                       [ -n "$lastpkg" ] && break
+               done
+               [ -n "$lastpkg" ] || lastpkg='not installed'
+               if [ $opt_batch_mode = no ]
+               then
+                       echo "$origin ($pkg) => $lastorigin ($lastpkg)"
+               else
+                       printf '%s\t%s\t%s\t%s\n' "$origin" "$pkg" "$lastorigin" "$lastpkg"
+               fi
+       done
+}
+
 # ============= Actual operations of "show" command for a single list =============
 database_query_show_single_list_exec ()
 {
@@ -661,6 +695,12 @@ database_query_show_single_list_exec ()
                database_query_show_list_failed_conflicts_restoration
                return
                ;;
+       moved )
+               message_echo "The following ports are moved/replaced to new alternatives:"
+               message_echo
+               database_query_show_list_moved
+               return
+               ;;
        taboo )
                message_echo "The following ports are registered as taboo:"
                message_echo
index 0a00d41..ca253df 100644 (file)
@@ -12,7 +12,7 @@ main_set_version ()
        MYVERSION=4.1.0
        COMPATIBLE_VERSIONS='^(4\.[1]\.[0-9])$'
        # Template for development versions
-       MYVERSION=4.0.0+toward_4.1.0_20180912000219
+       MYVERSION=4.0.0+toward_4.1.0_20180912193809
        COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
 }
 
index eb03756..dc455d4 100644 (file)
@@ -234,7 +234,7 @@ command_all_parse_args ()
                        shift || :
                fi
                case $COMMAND_SHOW_SUBJECT in
-               todo | done | redo | resolved | inst_by_pkg | inst_built_default | inst_built_custom | failure | taboo | freeze | need | noneed | restored | deleted | fossil | conflict )
+               todo | done | redo | resolved | inst_by_pkg | inst_built_default | inst_built_custom | failure | taboo | freeze | need | noneed | restored | deleted | fossil | conflict | moved )
                        _command_parse_args__chk_no_arg $#
                        ;;
                leaves | obsolete )
index b1dbb7b..8ef2c67 100644 (file)
@@ -82,7 +82,7 @@ USAGE: portsreinstall [OPTIONS] [--] [command]
           | show todo | show done | show resolved | show failure | show redo
           | show inst_by_pkg | show inst_built_default | show inst_built_custom
           | show taboo | show need | show noneed | show restored | show deleted
-          | show fossil | show conflict
+          | show fossil | show conflict | show moved
           | show build_conflict_pkgs | show inst_conflict_pkgs
           | show leaves [selected | unselected] | show obsolete [selected | unselected]
           | show requirements glob... | show dependents glob...
index af9e791..f252444 100644 (file)
@@ -319,6 +319,10 @@ With \fB\-a\fR option, the first and second columns denote the flavored origin a
 Conflicting ports which are temporarily deleted.
 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.
 .TP
+\fBmoved\fR
+Moved or replaced ports.
+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.
+.TP
 \fBbuild_conflict_pkgs\fR \fIglob\fR [\fIglob2\fR...]
 Installed packages which conflict with ports matching \fIglob\fRs in the build.
 The package names are listed in a single column.
@@ -1151,7 +1155,7 @@ Configuration file of \fBportupgrade\fR(1).
 .PP
 [NEW] \fBauto\fR and \fBdestroy\fR commands are added to \fBportsreinstall\-chroot\fR(8).
 .PP
-[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.
+[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.
 .PP
 [NEW] Command \fBshow status\fR newly supports \fBinst_by_pkg\fR, \fBinst_built_default\fR, \fBinst_built_custom\fR and \fBfossil\fR.
 .PP