[MacPorts] Migration modified

Joshua Root jmr at macports.org
Mon Dec 15 18:08:22 PST 2014


Putting this script in contrib and linking to it would be fine.

- Josh

On 2014-12-16 01:38 , Dave Yost wrote:
> Yes, there were a couple of problems :-/ The version below has worked
> two times in a row on Yosemite. I hope you will at least put this script
> or something like it on the wiki as an alternative. It could save many
> people a lot of time.
> 
>     #!/bin/bash
> 
>     # If there is an argument, then don't preserve 'requested' flags.
>     function reinstallPorts() {
>       local -r dontPreserveRequestedFlags=$1
>       set -e
>       sudo -v
>       
>       # Ensure that xcode-select has been run successfully.
>       /usr/bin/clang --version
> 
>       # Save the list of installed ports.
>       port -qv installed > myports.txt
> 
>       if [[ ! "$dontPreserveRequestedFlags" ]] ; then
>         # Preserve the 'requested' flags.
>         port echo requested | cut -d ' ' -f 1 > requested.txt
>       fi
> 
>       # Download the restore_ports script.
>       curl -O
>     https://svn.macports.org/repository/macports/contrib/restore_ports/restore_ports.tcl
>       chmod +x restore_ports.tcl
> 
>       # Change this if your installation is somewhere else.
>       # (There should be a way to get the port command to report this.)
>       local -r MACPORTS_HOME=/opt/local
> 
>       sudo bash << EOF
>         set -xe
> 
>         # Start with the latest data.
>         port selfupdate
> 
>         # Uninstall all installed ports.
>         port -f uninstall installed
> 
>         # Clean any partially-completed builds.
>         port clean all
> 
>         # Execute the restore_ports script.
>         ./restore_ports.tcl -p $MACPORTS_HOME myports.txt
>         
>         if [[ ! "$dontPreserveRequestedFlags" ]] ; then
>           # Restore the 'requested' flags.
>           port unsetrequested installed
>           < requested.txt xargs port setrequested
>         fi
>     EOF
>     }
> 
>     reinstallPorts $@
> 
> 
> 
> 
> 
> 
>> On 2014-12-14, at 08:43 PM, Dave Yost <Dave at Yost.com
>> <mailto:Dave at Yost.com>> wrote:
>>
>>
>>> On 2014-12-14, at 07:59 PM, Lawrence Velázquez <larryv at macports.org
>>> <mailto:larryv at macports.org>> wrote:
>>>
>>> The migration steps weren't really intended to be run as a single
>>> script. I'm not comfortable telling users to run this big untested
>>> blob of code.
>>
>> Then let’s test it! Works for me on Yosemite. I’ll run it again.
>>
>> You could put in a caveat that one can run the commands interactively
>> if one is worried about it.
>>
>> Really, code to do a migration should be part of macports, IMO.
>> Nothing like being able to start a command and walk away for a couple
>> of hours and have it do everything without tweaking.
>>
>> Dave
>>
>>>
>>>
>>>> On Dec 14, 2014, at 10:37 PM, MacPorts <noreply at macports.org
>>>> <mailto:noreply at macports.org>> wrote:
>>>>
>>>> Page "Migration" was changed by dave at yost.com <mailto:dave at yost.com>
>>>> Diff URL:
>>>> <https://trac.macports.org/wiki/Migration?action=diff&version=80>
>>>> Revision 80
>>>> Comment: Use a single sudo, so only one password is required.
>>>> Changes:
>>>> -------8<------8<------8<------8<------8<------8<------8<------8<--------
>>>> Index: Migration
>>>> =========================================================================
>>>> --- Migration (version: 79)
>>>> +++ Migration (version: 80)
>>>> @@ -23,29 +23,36 @@
>>>>   {{{
>>>>   # If there is an argument, then don't preserve 'requested' flags.
>>>>   function reinstallPorts() {
>>>> -      dontPreserveRequestedFlags=$1
>>>> +      local -r dontPreserveRequestedFlags=$1
>>>> +      set -e
>>>> +      # This will fail if xcode-select needs to be run.
>>>> +      clang --version
>>>
>>> What is the point of printing the Clang version? And you don't know
>>> which "clang" is being run.
>>
>> I was looking for a command I could run to smoke out wither
>> code-select is going to have to run before port can do its work.
>>



More information about the macports-dev mailing list