[MacPorts] Migration modified

Scott Haneda talklists at newgeo.com
Thu Jan 21 15:07:56 PST 2010


On Jan 21, 2010, at 1:06 PM, Dan Ports wrote:

> I'll take your word on this particular shell script (I haven't looked
> at it) -- but I think that such a script, if done right, would be a
> great thing to have.

I agree.  I just looked at it, comments below the script, for what they are worth.

#!/bin/sh
# instructions found @ http://trac.macports.org/wiki/Migration
#written by Liquan Tan

set -e

echo "***** 1. Self updating Macport"
sudo port selfupdate

echo "***** 1. Saving the list of installed ports: ***** "
port installed > ~/myports.txt

echo "***** 2. Uninstalling all installed ports: ***** "
sudo port -f uninstall installed

echo "***** 3. Clean any partially-completed builds and remove any archives: *****"
sudo port clean --work --archive all

echo "***** 4. Reinstalling previous active ports: *****"
REINSTALL_LIST=`cat ~/myports.txt | awk '/(active)/ {print $1}' | tr '\n' ' '`
echo $REINSTALL_LIST
sudo port install $REINSTALL_LIST

-- ** -- 
port installed > ~/myports.txt
I would at least put this in ~/tmp/.macports or similar
You never know what people have in their home dir, and you never want to take the chance of writing over their data.  This does not append >> but overwrites > and there are plenty of other places it can be stored where the chances of writing over someones data is less likely, even though this is not all that likely.

Step #4, I just can not see this going without trouble.  At that point, what state is the user left in?  If anything, this needs to be more interactive.

Just running a quick test:
port installed >> ~/Desktop/myports.txt
cat ~/Desktop/myports.txt | awk '/(active)/ {print $1}' | tr '\n' ' '

There is just no way that I am going to get a clean install of the list of 100 or so ports in the myports.txt file.  If this script were more interactive, and stepped me through each one:
-- About to install $portname, do you want to continue
-- $portname installed clean, with no errors, do you want to continue
-- $portname failed, myports.txt has been edited to list only the remaining 
   ports that need installing, fix the error with $portname, and run the script again

That is the only simple way I see this being helpful to people.  There are just too many reasons a port is not going to install, and far too little error checking in this script.

My .02.  

* Not bashing the effort here, I just do not think in the long run this will do more than cause more of of a support burden.  At least when doing this by hand, it is something you can work on an issue until solved, and then move on.

I would still like a text file archive of all the ports I have installed, in the order they were installed, which would list my posts, and not the variants and dependencies that they installed along with the parent port.  

There is also the issue of local port files that I am working on myself.  They may have been installed at one time, and even working, but there is no guarantee that my local postfiles even exist any longer, which would generate error for this script to tell me that the port does not even exist.

With some work, I think it would be valuable, as it stands, I agree with some of the other sentiments here.  Perhaps look to a different approach.
-- 
Scott * If you contact me off list replace talklists@ with scott@ * 



More information about the macports-dev mailing list