OSDN Git Service

[IMPROVED] The message at the exit from portsreinstall-chroot(8) builder chroot envir...
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Sun, 29 Jul 2018 12:50:34 +0000 (20:50 +0800)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Sun, 29 Jul 2018 12:50:34 +0000 (20:50 +0800)
The bugs of portsreinstall-chroot -s option is fixed.

 Changes to be committed:
modified:   lib/chroot/libcommand_do.sh
modified:   lib/chroot/libfs.sh
modified:   lib/libmain.sh
modified:   lib/libpkgsys.sh
modified:   man/portsreinstall.8

lib/chroot/libcommand_do.sh
lib/chroot/libfs.sh
lib/libmain.sh
lib/libpkgsys.sh
man/portsreinstall.8

index 167e2f3..daafe33 100644 (file)
@@ -137,15 +137,15 @@ command_do_chroot_postprocess ()
 {
                if ! command_do_chk_build_completion
                then
-                       message_echo "ERROR: Exited from the builder chroot environment without completing the build." >&2
-                       exit 1
+                       message_echo "INFO: Exited from the builder chroot environment without completing the build." >&2
+                       exit 130
                fi
                message_echo "INFO: The package build completed."
                message_echo "Is it OK to apply the upgrade to the host environment? ([y]/n)"
                if ! message_query_yn_default_yes
                then
                        message_echo "INFO: Terminated because the continuation is stopped by the user."
-                       exit 1
+                       exit 130
                fi
 }
 
index 5185055..b1e6d5d 100644 (file)
@@ -98,7 +98,8 @@ fs_build_chroot ()
                echo "$PORTSNAP_WORKDIR"
                echo "$PKGNG_PKG_CACHEDIR"
        fi | str_regularize_df_path_filter | grep -v '^[[:space:]]*$' | sort -u > ${DBDIR}/shared_dirs.lst
-       str_escape_regexp_filter < ${DBDIR}/shared_dirs.lst | sed 's|^|^|;s|$|\/|' > ${TMPDIR}/fs_build_chroot:shared_dirs.regexp
+       str_escape_regexp_filter < ${DBDIR}/shared_dirs.lst | sed 's|^|^|;s|$|\/|' > ${TMPDIR}/fs_build_chroot:shared_dirs.regexp.tmp
+       paste "${DBDIR}/shared_dirs.lst" "${TMPDIR}/fs_build_chroot:shared_dirs.regexp.tmp" > ${TMPDIR}/fs_build_chroot:shared_dirs.regexp
        cp /dev/null "${TMPDIR}/fs_build_chroot:shared_dirs:added"
        # Build target directories and the manifest for mounting
        cp /dev/null "${DBDIR}/mount_manifest.tmp"
@@ -123,51 +124,56 @@ fs_build_chroot ()
                                        fs=`echo "$srcline" | cut -f 1`
                                        mp=`echo "$srcline" | cut -f 2 | str_regularize_df_path_filter`
                                        relative=`echo "$srcline" | cut -f 3 | str_regularize_df_path_filter`
+                                       fullpath=`str_regularize_df_path "/$directory/$relative"`
                                        rm -f "${TMPDIR}/fs_build_chroot:shared_dirs:is_under"
-                                       while read -r shared_path_regexp
+                                       rm -f "${TMPDIR}/fs_build_chroot:shared_dirs:is_itself"
+                                       while read -r shared_path shared_path_regexp
                                        do
-                                               echo "/$directory/$relative/" | grep -qE "$shared_path_regexp" || continue
-                                               grep -qFx "/$directory/$relative/" "${DBDIR}/shared_dirs.lst" || continue
-                                               if  ! grep -qFx "/$directory/$relative/" "${TMPDIR}/fs_build_chroot:shared_dirs:added"
-                                               then
-                                                       echo "/$directory/$relative/" >> ${TMPDIR}/fs_build_chroot:shared_dirs:added
-                                                       mp_share=`realpath "$systembase/$directory/$relative"`
-                                                       printf '%s\t%s\t%s\t%s\n' nullfs "$mp_share" "$directory/$relative" rw >> ${DBDIR}/mount_manifest.tmp
-                                               fi
+                                               echo "$fullpath/" | grep -qE "$shared_path_regexp" || continue
+                                               echo "$shared_path"$'\n'"$fullpath" | while read mpath
+                                               do
+                                                       if  ! grep -qFx "$mpath" "${TMPDIR}/fs_build_chroot:shared_dirs:added"
+                                                       then
+                                                               echo "$mpath" >> ${TMPDIR}/fs_build_chroot:shared_dirs:added
+                                                               mp_share=`realpath "$systembase/$mpath"`
+                                                               printf '%s\t%s\t%s\t%s\n' nullfs "$mp_share" "$mpath" rw >> ${DBDIR}/mount_manifest.tmp
+                                                       fi
+                                               done
                                                touch "${TMPDIR}/fs_build_chroot:shared_dirs:is_under"
                                        done < ${TMPDIR}/fs_build_chroot:shared_dirs.regexp
+                                       [ -e "${TMPDIR}/fs_build_chroot:shared_dirs:is_under" ] && continue
                                        case $fs in
                                                normal )
-                                                       masktarget=$systembase/$opt_basedir/mask/$directory/$relative
+                                                       masktarget=`str_regularize_df_path "$systembase/$opt_basedir/mask/$fullpath"`
                                                        mkdir -p "$masktarget"
-                                                       if [ -e "${TMPDIR}/fs_build_chroot:shared_dirs:is_under" ]
-                                                       then
-                                                               printf '%s\t%s\t%s\t%s\n' nullfs "$mp" "$directory/$relative" rw >> ${DBDIR}/mount_manifest.tmp
-                                                       else
-                                                               printf '%s\t%s\t%s\t%s\n' nullfs "$mp" "$directory/$relative" ro >> ${DBDIR}/mount_manifest.tmp
-                                                               printf '%s\t%s\t%s\t%s\n' unionfs "$masktarget" "$directory/$relative" rw,noatime >> ${DBDIR}/mount_manifest.tmp
-                                                       fi
+                                                       printf '%s\t%s\t%s\t%s\n' nullfs "$mp" "$fullpath" ro >> ${DBDIR}/mount_manifest.tmp
+                                                       printf '%s\t%s\t%s\t%s\n' unionfs "$masktarget" "$fullpath" rw,noatime >> ${DBDIR}/mount_manifest.tmp
                                                        ;;
                                                devfs )
-                                                       printf '%s\t%s\t%s\t%s\n' devfs devfs "$directory/$relative" rw >> ${DBDIR}/mount_manifest.tmp
+                                                       printf '%s\t%s\t%s\t%s\n' devfs devfs "$fullpath" rw >> ${DBDIR}/mount_manifest.tmp
                                                        ;;
                                                fdescfs )
-                                                       printf '%s\t%s\t%s\t%s\n' fdescfs fdesc "$directory/$relative" rw >> ${DBDIR}/mount_manifest.tmp
+                                                       printf '%s\t%s\t%s\t%s\n' fdescfs fdesc "$fullpath" rw >> ${DBDIR}/mount_manifest.tmp
                                                        ;;
                                                procfs )
-                                                       printf '%s\t%s\t%s\t%s\n' procfs proc "$directory/$relative" rw >> ${DBDIR}/mount_manifest.tmp
+                                                       printf '%s\t%s\t%s\t%s\n' procfs proc "$fullpath" rw >> ${DBDIR}/mount_manifest.tmp
                                                        ;;
                                                linprocfs )
-                                                       printf '%s\t%s\t%s\t%s\n' linprocfs linproc "$directory/$relative" rw >> ${DBDIR}/mount_manifest.tmp
+                                                       printf '%s\t%s\t%s\t%s\n' linprocfs linproc "$fullpath" rw >> ${DBDIR}/mount_manifest.tmp
                                                        ;;
                                                tmpfs )
-                                                       printf '%s\t%s\t%s\t%s\n' tmpfs tmpfs "$directory/$relative" rw,mode=1777 >> ${DBDIR}/mount_manifest.tmp
+                                                       printf '%s\t%s\t%s\t%s\n' tmpfs tmpfs "$fullpath" rw,mode=1777 >> ${DBDIR}/mount_manifest.tmp
                                                        ;;
                                        esac
                                done < ${TMPDIR}/fs_build_chroot:descendant/$directory/list
                                ;;
                        esac
                done < ${TMPDIR}/fs_build_chroot:directories
+               grep -Ev -f "${TMPDIR}/fs_build_chroot:shared_dirs:added" "${DBDIR}/shared_dirs.lst" | while read shared_dir
+               do
+                       mp_share=`realpath "$systembase$shared_dir"`
+                       printf '%s\t%s\t%s\t%s\n' nullfs "$mp_share" "/$shared_dir" rw >> ${DBDIR}/mount_manifest.tmp
+               done
                for directory in dev proc tmp 
                do
                        [ -e $directory ] || mkdir $directory
index 4e5ca22..c30750d 100644 (file)
@@ -12,8 +12,8 @@ main_set_version ()
        MYVERSION=4.1.0
        COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9])$'
        # Template for development versions
-       MYVERSION=4.0.0+toward_4.1.0_20180729172016
-       COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0]\.[1]+_[0-9]+))$'
+       MYVERSION=4.0.0+toward_4.1.0_20180729205008
+       COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
 }
 
 # ============= Parse options, arguments and control parameters =============
index 5db9637..eda7c43 100644 (file)
@@ -303,10 +303,10 @@ pkgsys_load_portsnap_conf ()
 {
        if which -s portsnap
        then
-               PORTSNAP_WORKDIR=`sed '/^[[:space:]]*WORKDIR[[:space:]]*=[[:space:]]*\([^[:space:]#]*\)/s//\1/' /etc/portsnap.conf || :`
-               PORTSNAP_WORKDIR=${PORTSNAP_WORKDIR-:/var/db/portsnap}
-               PORTSNAP_PORTSDIR=`sed '/^[[:space:]]*PORTSDIR[[:space:]]*=[[:space:]]*\([^[:space:]#]*\)/s//\1/' /etc/portsnap.conf || :`
-               PORTSNAP_PORTSDIR=${PORTSNAP_PORTSDIR-:/usr/ports}
+               PORTSNAP_WORKDIR=`sed -n '/^[[:space:]]*WORKDIR[[:space:]]*=[[:space:]]*\([^[:space:]#]*\)/s//\1/p' /etc/portsnap.conf || :`
+               PORTSNAP_WORKDIR=${PORTSNAP_WORKDIR:-/var/db/portsnap}
+               PORTSNAP_PORTSDIR=`sed -n '/^[[:space:]]*PORTSDIR[[:space:]]*=[[:space:]]*\([^[:space:]#]*\)/s//\1/p' /etc/portsnap.conf || :`
+               PORTSNAP_PORTSDIR=${PORTSNAP_PORTSDIR:-/usr/ports}
        else
                PORTSNAP_WORKDIR=
                PORTSNAP_PORTSDIR=
index dddcabb..e93d5d5 100644 (file)
@@ -1111,6 +1111,8 @@ Configuration file of \fBportupgrade\fR(1).
 .PP
 [IMPROVED] It is changed to unlock in all error termination.
 .PP
+[IMPROVED] The message at the exit from \fBportsreinstall\-chroot\fR(8) builder chroot environment is modified to be less shocking.
+.PP
 [BUG FIX] \fBreset\fR command discarded the information of the initially installed packages.
 .PP
 [BUG FIX] Dependency inspection might have terminated with error when obsolete ports exist.