Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

satraul
Copy link
Member

@satraul satraul commented Oct 14, 2019

src/port/port.tcl Outdated Show resolved Hide resolved
src/port/port.tcl Outdated Show resolved Hide resolved
src/port/port.tcl Outdated Show resolved Hide resolved
src/port/port.tcl Outdated Show resolved Hide resolved
src/port/port.tcl Outdated Show resolved Hide resolved
src/port/port.tcl Outdated Show resolved Hide resolved
src/port/port.tcl Outdated Show resolved Hide resolved
src/port/port.tcl Outdated Show resolved Hide resolved
src/port/port.tcl Outdated Show resolved Hide resolved
src/port/port.tcl Show resolved Hide resolved
@satraul satraul changed the title WIP: port.tcl: Offer automated switch to git-based source port.tcl: Offer automated switch to git-based source Oct 15, 2019

# Update the ports tree
try {
mportsync
Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see two options:


# 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"} _]} {
Copy link
Member Author

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

Copy link
Member

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?

@satraul satraul marked this pull request as ready for review October 15, 2019 21:00

# 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"} _]} {
Copy link
Member

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]
Copy link
Member

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]
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see two options:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants