OSDN Git Service

[BUG FIX] Restoration of backup packages after failed installation was not working...
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Sun, 18 Nov 2012 02:51:57 +0000 (11:51 +0900)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Sun, 18 Nov 2012 02:51:57 +0000 (11:51 +0900)
modified:   portsreinstall
modified:   portsreinstall.8
modified:   portsreinstall.8~
modified:   portsreinstall~

portsreinstall
portsreinstall.8
portsreinstall.8~
portsreinstall~

index b63cc37..9493bb3 100755 (executable)
@@ -10,7 +10,7 @@
 # ================================================
 
 APPNAME=`basename "$0"`
-MYVERSION=2.0.0+toward_2.0.1_20121117194301
+MYVERSION=2.0.0+toward_2.0.1_20121118115119
 
 PREFIX=${PREFIX:-/usr/local}
 CONFFILE=${PREFIX}/etc/${APPNAME}.conf
@@ -2179,7 +2179,13 @@ then
                        newpkg=
                fi
                currentpkg=`pkg_info -qO "$origin" 2> /dev/null || :`
-               pkgtag=$currentpkg
+               if [ -n "$currentpkg" ]
+               then
+                       origpkg=$currentpkg
+               else
+                       origpkg=`cat "${DBDIR}/requires/$origin/backedup_version" 2> /dev/null || :`
+               fi
+               pkgtag=$origpkg
                [ -n "$pkgtag" ] || pkgtag=$newpkg
                if [ -z "$pkgtag" ]
                then
@@ -2417,6 +2423,7 @@ then
                                echo "WARNING: Failed to create the backup package, but ignored by hoping success." >&2
                        }
                        cd "${PORTSDIR}/$origin"
+                       echo $currentpkg > ${DBDIR}/requires/$origin/backedup_version
                        touch "${DBDIR}/requires/$origin/status/COMPLETE_PKG_BACKUP"
                fi
                if [ -n "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPLETE_BEFOREDEINSTALL" ]
@@ -2472,17 +2479,18 @@ then
                                        fi
                                        echo "*** Trying to deinstall by ports to make sure. (This usually ends up with warnings)"
                                        env ${MAKE_ENVS} make deinstall ${MAKE_ARGS} || :
-                                       if [ -n "$currentpkg" ]
+                                       backedup_version=`cat "${DBDIR}/requires/$origin/backedup_version" 2> /dev/null || :`
+                                       if [ -n "$backedup_version" ]
                                        then
-                                               echo "*** Restoring the backup..."
-                                               if [ -e "${DBDIR}/backup_failure/$currentpkg.tbz" ]
+                                               echo "*** Restoring the backup of $backedup_version..."
+                                               if [ -e "${DBDIR}/backup_failure/$backedup_version.tbz" ]
                                                then
                                                        echo "WARNING: No backup exists, gave up." >&2
-                                               elif pkg_add -fF "${DBDIR}/backup_failure/$currentpkg.tbz"
+                                               elif pkg_add -fF "${DBDIR}/backup_failure/$backedup_version.tbz"
                                                then
                                                        :
                                                else
-                                                       echo "WARNING: Failed to restore $currentpkg. Note that your system may experience troubles by this error." >&2
+                                                       echo "WARNING: Failed to restore $backedup_version. Note that your system may experience troubles by this error." >&2
                                                fi
                                        fi
                                        touch "${DBDIR}/requires/$origin/status/COMPETE.FAILED_INSTALL.RECOVER"
index 331a784..6408466 100644 (file)
@@ -275,8 +275,10 @@ Configuration file of portupgrade(1).
 .SH HISTORY
 \fBportsreinstall\fR has been developed as below.
 .TP
-2.0.1 (17 November 2012)
+2.0.1 (18 November 2012)
 [IMPROVED] A countermeasure for a build failure in a restarted build from a terminated build is implemented.
+
+[BUG FIX] Restoration of backup packages after failed installation was not working correctly.
 .TP
 2.0.0 (12 August 2012)
 [NEW] Options \fB\-X\fR, \fB\-r\fR and \fB\-R\fR are added so as to compensate a fact that \fB\-x\fR, \fB\-t\fR and \fB\-T\fR cannot specify package names with commas.
index 825be14..155f357 100644 (file)
@@ -275,6 +275,10 @@ Configuration file of portupgrade(1).
 .SH HISTORY
 \fBportsreinstall\fR has been developed as below.
 .TP
+2.0.1 (18 November 2012)
+[IMPROVED] A countermeasure for a build failure in a restarted build from a terminated build is implemented.
+[BUG FIX] Restoration of backup packages after failed installation was not working correctly.
+.TP
 2.0.0 (12 August 2012)
 [NEW] Options \fB\-X\fR, \fB\-r\fR and \fB\-R\fR are added so as to compensate a fact that \fB\-x\fR, \fB\-t\fR and \fB\-T\fR cannot specify package names with commas.
 
index 3bb9caf..64ad798 100755 (executable)
@@ -10,7 +10,7 @@
 # ================================================
 
 APPNAME=`basename "$0"`
-MYVERSION=2.0.0+toward_2.0.1_20121117185829
+MYVERSION=2.0.0+toward_2.0.1_20121118115001
 
 PREFIX=${PREFIX:-/usr/local}
 CONFFILE=${PREFIX}/etc/${APPNAME}.conf
@@ -2179,7 +2179,13 @@ then
                        newpkg=
                fi
                currentpkg=`pkg_info -qO "$origin" 2> /dev/null || :`
-               pkgtag=$currentpkg
+               if [ -n "$currentpkg" ]
+               then
+                       origpkg=$currentpkg
+               else
+                       origpkg=`cat "${DBDIR}/requires/$origin/backedup_version" 2> /dev/null || :`
+               fi
+               pkgtag=$origpkg
                [ -n "$pkgtag" ] || pkgtag=$newpkg
                if [ -z "$pkgtag" ]
                then
@@ -2417,6 +2423,7 @@ then
                                echo "WARNING: Failed to create the backup package, but ignored by hoping success." >&2
                        }
                        cd "${PORTSDIR}/$origin"
+                       echo $currentpkg > ${DBDIR}/requires/$origin/backedup_version
                        touch "${DBDIR}/requires/$origin/status/COMPLETE_PKG_BACKUP"
                fi
                if [ -n "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPLETE_BEFOREDEINSTALL" ]
@@ -2472,17 +2479,18 @@ then
                                        fi
                                        echo "*** Trying to deinstall by ports to make sure. (This usually ends up with warnings)"
                                        env ${MAKE_ENVS} make deinstall ${MAKE_ARGS} || :
-                                       if [ -n "$currentpkg" ]
+                                       backedup_version=`cat "${DBDIR}/requires/$origin/backedup_version" 2> /dev/null || :`
+                                       if [ -n "$backedup_version" ]
                                        then
-                                               echo "*** Restoring the backup..."
-                                               if [ -e "${DBDIR}/backup_failure/$currentpkg.tbz" ]
+                                               echo "*** Restoring the backup of $backedup_version..."
+                                               if [ -e "${DBDIR}/backup_failure/$backedup_version.tbz" ]
                                                then
                                                        echo "WARNING: No backup exists, gave up." >&2
-                                               elif pkg_add -fF "${DBDIR}/backup_failure/$currentpkg.tbz"
+                                               elif pkg_add -fF "${DBDIR}/backup_failure/$backedup_version.tbz"
                                                then
                                                        :
                                                else
-                                                       echo "WARNING: Failed to restore $currentpkg. Note that your system may experience troubles by this error." >&2
+                                                       echo "WARNING: Failed to restore $backedup_version. Note that your system may experience troubles by this error." >&2
                                                fi
                                        fi
                                        touch "${DBDIR}/requires/$origin/status/COMPETE.FAILED_INSTALL.RECOVER"