[MacPorts] Migration modified

Clemens Lang cal at macports.org
Wed Oct 30 17:40:44 PDT 2013


Hi,

On Thu, Oct 31, 2013 at 12:17:00AM +0000, MacPorts wrote:
> Page "Migration" was changed by elatllat at gmail.com
> Diff URL: <https://trac.macports.org/wiki/Migration?action=diff&version=62>
> Revision 62

Are you sure those changes are entirely correct?

> -------8<------8<------8<------8<------8<------8<------8<------8<--------
> Index: Migration
> =========================================================================
> --- Migration (version: 61)
> +++ Migration (version: 62)
> @@ -29,13 +32,19 @@
>  
>  Several other settings in macports.conf have changed their defaults over the years. Take a moment to compare each line of your macports.conf with the corresponding line in macports.conf.default in the same directory. Unless you know a reason why a line your settings file should be different from the defaults, adopt the line from the defaults file.
>  
> +{{{
> +cp /opt/local/etc/macports/macports.conf.default /opt/local/etc/macports/macports.conf
> +}}}
> +
> +

Copying the default over your configuration might fulfill your specific
needs, but it might not be a good solution for everybody. Some people
might have made modifications to their macports.conf they want to keep.

>  === Reinstall ports === #ports
>  
>  To reinstall your ports:
>  
>   1. Save the list of installed ports:
>  {{{
> -port -qv installed > myports.txt
> +port -qv installed > my_installed_ports.txt
> +port list requested | perl -pe 's/ .*//g' | sort -u > my_requested_ports.txt
>  }}}

port list probably doesn't do what you expect it to do. See
http://trac.macports.org/wiki/FAQ#portlist for an explanation. The
better alternative here probably is 'port -q installed requested',
because it preserves the variant information, something your port list
approach does not. Additionally, port list is a lot slower.

>   2. Uninstall all installed ports:
>  {{{
> @@ -45,22 +54,21 @@
>  {{{
>  sudo port clean all
>  }}}
> - 4. Browse `myports.txt` and install the ports that you actually want to use (as opposed to those that are only needed as dependencies) one by one, remembering to specify the appropriate variants:
> + 4. Install your old ports:
>  {{{
> -sudo port install portname +variant1 +variant2 …
> +sudo port install $(cat my_requested_ports.txt | perl -pe 's/\n/ /g')
>  }}}
> -Note that if you have specified variants which are not the default, you may need to install ports in an order other than the alphabetical order recorded in `myports.txt`.

This is the place where your approach breaks all variants that were
previously installed.

>  
>  ==== Automatically reinstall ports ==== #automatic
>  
> -A script has been written to automate Step 4 above, though it has some caveats. If it fails, you will just have to do it manually. (But see workaround for conflicting ports below.)
> +A script has been written to automate Step 4 above more accurately, though it has some caveats. If it fails, you will just have to do it manually. (But see workaround for conflicting ports below.)
>  
>  To use it, you will first need to run steps 1-3 as described above. Then:
>   4. Run these commands to download and execute the restore_ports script. (If you installed MacPorts from source and put its Tcl package somewhere other than /Library/Tcl, then you'll need to use the -t option when you run restore_ports.tcl; see `./restore_ports.tcl -h`.)
>  {{{
>  curl -O https://svn.macports.org/repository/macports/contrib/restore_ports/restore_ports.tcl
>  chmod +x restore_ports.tcl
> -sudo ./restore_ports.tcl myports.txt
> +sudo ./restore_ports.tcl my_installed_ports.txt
>  }}}

Given that we already have a more automated solution with
restore_ports.tcl (which can very likely also operate on the list of
requested ports only), I think rather than your approach that drops
variants, we should advise using this script.

>  One known issue is that the script will fail if there are conflicting ports in the list. It's possible to have conflicting ports installed provided at most one of the conflicting set is active. If the script fails for this reason, you can delete one of the conflicting ports from myports.txt and then simply run the script again. You may need to do this multiple times if there are multiple conflicting ports listed.

-- 
Clemens Lang



More information about the macports-dev mailing list