port: add 'source' subcommand for managing sources.conf#395
Open
herbygillot wants to merge 1 commit into
Open
Conversation
0afed4c to
f0e724e
Compare
Add `port source` to list, add, remove, and manage default-flag state of entries in sources.conf. --add supports --first (insert before existing sources), --no-sync (append [nosync] flag), and --default (mark as the explicit default, clearing it from other sources). --set-default and --unset-default toggle the [default] flag on existing entries. --remove warns if the removed source was the only explicit default. Bare local paths starting with / or ~ are automatically normalized and converted to file:// URLs; local paths with spaces are supported. Write operations are atomic (write to temp file, then rename), check for write permission, and emit a sudo hint on failure. Business logic uses a structured read-parse-modify-write pipeline in macports1.0/macports.tcl: source_read_conf / source_parse_line / source_write_conf / source_render_record handle round-tripping the file while preserving comments and blank lines. port.tcl contains the thin UI wrapper (action_source). Uses file tildeexpand before file normalize for Tcl 9 compatibility, where file normalize no longer performs tilde expansion. Includes 20 tcltest unit tests (sources.test), a new port-source(1) man page (port-source.1.txt), and updates to port(1) and sources.conf(5). Fixes: https://trac.macports.org/ticket/73683
f0e724e to
2a0d337
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
port sourceto list, add, remove, and manage default-flag stateof entries in sources.conf.
--add supports --first (insert before existing sources), --no-sync
(append [nosync] flag), and --default (mark as the explicit default,
clearing it from other sources).
--set-default and --unset-default toggle the [default] flag on
existing entries.
--remove warns if the removed source was the only explicit default.
Bare local paths starting with / or ~ are automatically normalized and
converted to file:// URLs; local paths with spaces are supported.
Write operations are atomic (write to temp file, then rename), check
for write permission, and emit a sudo hint on failure.
Business logic uses a structured read-parse-modify-write pipeline in
macports1.0/macports.tcl: source_read_conf / source_parse_line /
source_write_conf / source_render_record handle round-tripping the
file while preserving comments and blank lines. port.tcl contains the
thin UI wrapper (action_source).
Uses file tildeexpand before file normalize for Tcl 9 compatibility,
where file normalize no longer performs tilde expansion.
Includes 20 tcltest unit tests (sources.test), a new port-source(1)
man page (port-source.1.txt), and updates to port(1) and
sources.conf(5).
Fixes: https://trac.macports.org/ticket/73683