macports-guide icon indicating copy to clipboard operation
macports-guide copied to clipboard

Show local port repository example source with nosync

Open mtn88 opened this issue 2 years ago • 5 comments

I believe it would make sense to change the example for the local port repository to prevent the source from syncing during 'port sync'

mtn88 avatar Dec 22 '23 23:12 mtn88

Can you elaborate a bit more why we would want to add the nosync flag? When the directory at the file:// URL is not a subversion working copy or git working tree, port sync should do nothing. Does the example cause any problems for you like this?

raimue avatar Dec 23 '23 23:12 raimue

It does run portindex but that's almost always desirable.

jmroot avatar Dec 24 '23 00:12 jmroot

Yes, the provided example causes a problem for me. And yes, I do have git enabled for my local repository. When I specify a local file:// URL I get the following error when running port sync:

--->  Updating the ports tree
port sync failed: Synchronization of 1 source failed

Appending [nosync] to my local repository URL fixes the problem.

I quote from the inline documentation in the file ${prefix}/etc/macports/sources.conf

To prevent a source from synchronizing when `port sync` is used,
append "[nosync]" at the end.

  Example: file:///Users/landonf/misc/MacPorts/ports [nosync]

And yes, portindex runs fine with our without [nosync] :-)

mtn88 avatar Dec 24 '23 01:12 mtn88

That error probably happens because your local git repository does not have a remote? Can you confirm with port -d sync that this is the problem? Then I would say the correct fix would be in macports-base to run the git pull --rebase command only if a remote is configured.

With nosync, the command port sync will not automatically run portindex on the ports tree. That means you always have to do that manually.

raimue avatar Dec 24 '23 01:12 raimue

Thanks for the feedback!

I can confirm that my local repository doesn't have a remote. Here's the output from port -d sync (when [nosync] is not activated):

DEBUG: Copying /Users/julesverne/Library/Preferences/com.apple.dt.Xcode.plist to /opt/local/var/macports/home/Library/Preferences
--->  Updating the ports tree
Synchronizing local ports tree from file:///Users/julesverne/ports
DEBUG: euid/egid changed to: 501/20, env: HOME=/Users/max SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.puZJiZel0J/Listeners
DEBUG: /opt/local/bin/git pull --rebase --autostash
DEBUG: system -W /Users/julesverne/ports: /opt/local/bin/git pull --rebase --autostash
There is no tracking information for the current branch.
Please specify which branch you want to rebase against.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master

Command failed: /opt/local/bin/git pull --rebase --autostash
Exit code: 1
DEBUG: command execution failed
    while executing
"system -W $dir $cmd"
    (procedure "macports::UpdateVCS" line 1)
    invoked from within
"macports::UpdateVCS $cmd $dir"
Syncing local Git ports tree failed
DEBUG: euid/egid restored to: 0/0, env restored
Synchronizing local ports tree from rsync://rsync.macports.org/macports/release/tarballs/ports.tar
DEBUG: system: /usr/bin/rsync -rtzvl --delete-after --include=/ports.tar --include=/ports.tar.rmd160 --exclude=* rsync://rsync.macports.org/macports/release/tarballs/ /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs

Willkommen auf dem RSYNC-server auf ftp.fau.de.
Nicht all unsere Mirror sind per rsync verfuegbar.

Welcome to the RSYNC daemon on ftp.fau.de.
Not all of our mirrors are available through rsync.


receiving file list ... done
./

sent 68 bytes  received 99 bytes  111.33 bytes/sec
total size is 124192256  speedup is 743666.20
DEBUG: successful verification with key /opt/local/share/macports/macports-pubkey.pem
DEBUG: system: /usr/bin/tar -C /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/tmp -xf /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports.tar
DEBUG: system: chmod -R a+r /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs
DEBUG: system: /opt/local/bin/portindex /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports
Creating port index in /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports

Total number of ports parsed:   0 
Ports successfully parsed:  0 
Ports failed:           0 
Up-to-date ports skipped:   37859

DEBUG: Synchronization of 1 source failed
    while executing
"mportsync [array get global_options]"
port sync failed: Synchronization of 1 source failed

mtn88 avatar Dec 24 '23 13:12 mtn88