-
-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
port.tcl: Offer automated switch to git-based source #157
base: master
Are you sure you want to change the base?
Conversation
Prompt to ask for anything
0631e8e
to
2f3dc5a
Compare
|
||
# Update the ports tree | ||
try { | ||
mportsync |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need help with this one. At this point we've setup the new git source including updating sources.conf, but calling mportsync
still updates the old source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see two options:
- Call
mportshutdown
andmportinit
again, then runmportsync
- Use
execl
to re-execute the same command after the changes were made, see https://github.com/macports/macports-base/blob/gsoc17-migrate/src/port/port.tcl#L2829
|
||
# CHECK IF SOURCES.CONF IS STILL DEFAULT (INDICATING THAT USER IS FIRST TIME CONTRIBUTOR) | ||
set confpath "${macports::prefix}/etc/macports/sources.conf" | ||
if {[catch {exec [macports::findBinary diff] "-q" $confpath "$confpath.default"} _]} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We offer this change if sources.conf
is identical with sources.conf.default
or this proc has ran before without unexpectedly failing. We keep track that by creating a file ${macports::portdbpath}/contrib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just use the cmp
binary here?
|
||
# CHECK IF SOURCES.CONF IS STILL DEFAULT (INDICATING THAT USER IS FIRST TIME CONTRIBUTOR) | ||
set confpath "${macports::prefix}/etc/macports/sources.conf" | ||
if {[catch {exec [macports::findBinary diff] "-q" $confpath "$confpath.default"} _]} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just use the cmp
binary here?
set retvalue [$macports::ui_options(questions_yesno) "You do not seem have a working copy of the macports-ports git repository, which is required to contribute this change." "clone" {} {y} 0 "Create one now?"] | ||
if {$retvalue == 1} { | ||
# quit as user answered 'no' | ||
set tempfd [open "${macports::portdbpath}/contrib" w] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So when the user answers no, we never ask again?
if {[info exists macports::sudo_user]} { | ||
set username ${macports::sudo_user} | ||
} else { | ||
set username [exec id -un] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will just be root, so there's probably no point?
|
||
# Update the ports tree | ||
try { | ||
mportsync |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see two options:
- Call
mportshutdown
andmportinit
again, then runmportsync
- Use
execl
to re-execute the same command after the changes were made, see https://github.com/macports/macports-base/blob/gsoc17-migrate/src/port/port.tcl#L2829
Reference: https://trac.macports.org/wiki/Meetings/MacPortsMeeting2019/ContributingUXImprovements