Changes between Version 27 and Version 28 of CommittersTipsAndTricks


Ignore:
Timestamp:
Oct 5, 2009, 7:59:15 PM (15 years ago)
Author:
dweber@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CommittersTipsAndTricks

    v27 v28  
    2020
    2121
    22 == Create your own users directory in the MacPorts Subversion repository ==
     22== Create an experimental users directory in the MacPorts Subversion repository ==
    2323
    2424Use the [/browser Trac Browser] to explore the MacPorts Subversion repository. The repository root is located at `https://svn.macosforge.org/repository/macports`.
     
    2626See also the explanation of [http://guide.macports.org/#development.local-repositories local development port trees] in the guide.
    2727
    28 To create your own users directory:
     28To create a sandbox for experimental development, create a users directory:
    2929
    3030{{{
     
    3232}}}
    3333
    34 Then, checkout your user directory:
     34Then, checkout the user directory (suggested location is ~/myports):
    3535
    3636{{{
     
    3838}}}
    3939
    40 Then edit your MacPorts sources.conf file {{{/opt/local/etc/macports/sources.conf}}} to add ~/myports to the list before the main rsync source at rsync.macports.org, e.g.:
    41 
    42 {{{
    43 file:///Users/<YourSystemUserName>/myports
    44 }}}
    45 
    46 To work on a copy of a port from MacPorts trunk, use `svn copy`.  For example, to test changes on the cableswig port, you can copy the repository trunk (at the HEAD revision) to your new user branch:
     40Then edit the MacPorts sources.conf file {{{/opt/local/etc/macports/sources.conf}}} to add ~/myports to the list before the main rsync source at rsync.macports.org, e.g.:
     41
     42{{{
     43file:///Users/<YourSystemUserName>/myports [nosync]
     44}}}
     45
     46To work on a copy of a port from the MacPorts trunk, use `svn copy`.  For example, to test changes on the cableswig port, copy the repository trunk (at the HEAD revision) into the user branch:
    4747
    4848{{{
     
    5757      https://svn.macosforge.org/repository/macports/trunk/dports/devel/cableswig \
    5858      https://svn.macports.org/repository/macports/users/<YourMacPortsUserName>/devel/cableswig \
    59       -m "testing modifications to cableswig"
     59      -m "experimental modifications to cableswig"
    6060$ cd ~/myports
    6161$ svn update
    6262}}}
    6363
    64 After the copy, run `portindex` in `~/myports` (do this any time you add a new Portfile), e.g.:
     64After the copy, run `portindex` in `~/myports` (do this anytime ports are added or removed from ~/myports), e.g.:
    6565
    6666{{{
     
    7070$ port file cableswig
    7171}}}
     72
     73Now make experimental changes to the port in the sandbox.  Whenever a signficant change is made, note the change with a commit to the sandbox and when all the changes are complete commit the final change to the sandbox with a meaningful commit message.
     74
     75The main trunk Portfile and the sandbox Portfile are now out of sync.  Someone may make changes to the main trunk Portfile while changes are made to the sandbox Portfile.  Let's assume that all the experimental changes are successful, so the Portfile needs to be integrated back into the main trunk, where other changes may have occurred.  This merge process requires a few steps.  Let's assume there are checkouts for the sandbox in ~/myports and the trunk in ~/macports.
     76
     77First update the sandbox and the trunk checkouts, e.g.:
     78
     79{{{
     80cd ~/myports
     81svn update
     82cd ~/macports
     83svn update
     84}}}
     85
     86Note that the revision numbers should be the same (because the sandbox and the main trunk belong to the same svn repository).
     87
     88Next, find out where the experimental changes left off from the trunk and create a bash variable (any shell variable) to store the value of the revision number where the branch copy occurred (the revision number will be the last one in the log):
     89
     90{{{
     91cd ~/myports/devel/cableswig
     92svn log --stop-on-copy Portfile
     93EXP_BRANCH_REV=54362
     94}}}
     95
     96For the curious, leave off the `--stop-on-copy` to see the entire commit log history (it should all be there if there is a continuous and reliable use of svn to manage the file from it's "birth" in the svn repository).
     97
     98Now take a look at the commit log for the main trunk, to get some hints about what has changed to the file since the experimental branch was forked off.
     99
     100{{{
     101cd ~/macports/dports/devel/cableswig
     102svn log Portfile | more
     103}}}
     104
     105Look through the log to find the revision number where the experimental copy took place.  If that is the first revision number in the log, there have been no changes in the trunk.  Otherwise, changes have occurred in the trunk that are not in the experimental branch.  There could be trunk changes that complement the experimental branch, or they may be in conflict.  Try to merge all these changes using the revision number of the experimental copy:
     106
     107{{{
     108cd ~/macports/dports/devel/cableswig
     109svn merge  -r ${EXP_BRANCH_REV}:HEAD  https://svn.macosforge.org/repository/macports/users/<YourMacPortsUserName>/devel/cableswig/Portfile Portfile
     110}}}
     111
     112Now resolve any conflicts, if any, in the trunk Portfile.  All work continues in the trunk (until the next time a sandbox is required).  Once the merge looks good, commit all the changes to the trunk with a meaningful commit message,
     113
     114{{{
     115cd ~/macports/dports/devel/cableswig
     116svn commit "merged sandbox changes from ${EXP_BRANCH_REV}:HEAD back into trunk" Portfile
     117}}}
     118
     119Finally, to have the port system revert to using the rsync distribution, it's possible to remove the sandbox port.  No information is lost from the svn system, so removing the sandbox port is really harmless (in any case, all the changes are now back in the trunk).  For example,
     120
     121{{{
     122sudo port clean --all cableswig
     123cd ~/myports/devel
     124svn remove cableswig
     125svn commit -m "done with sandbox for cableswig"
     126svn update
     127cd ~/myports
     128portindex
     129}}}
     130
    72131
    73132For more information about branches and merging, see