rename channel to combined
This commit is contained in:
parent
8550c5b6f3
commit
c92ed46110
4 changed files with 35 additions and 35 deletions
|
|
@ -112,9 +112,9 @@ in {
|
|||
## Finding packages
|
||||
|
||||
At the moment we do not have a dedicated package search available. However our
|
||||
[nur-channel](https://github.com/nix-community/nur-channel) that contains all
|
||||
nix expressions from all users can be search via
|
||||
[github](https://github.com/nix-community/nur-channel/search).
|
||||
[nur-combined](https://github.com/nix-community/nur-combined) repository contains all
|
||||
nix expressions from all users and can be search via
|
||||
[github](https://github.com/nix-community/nur-combined/search).
|
||||
|
||||
## How to add your own repository.
|
||||
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ git config --global user.email "joerg.nur-bot@thalheim.io"
|
|||
git config --global user.signingkey "B4E40EEC9053254E"
|
||||
git config --global commit.gpgsign true
|
||||
|
||||
git clone git@github.com:nix-community/nur-channel
|
||||
git clone git@github.com:nix-community/nur-combined
|
||||
|
||||
result/bin/nur build-channel nur-channel
|
||||
result/bin/nur combine nur-combined
|
||||
|
||||
if [[ -z "$(git diff --exit-code)" ]]; then
|
||||
echo "No changes to the output on this push; exiting."
|
||||
|
|
@ -59,4 +59,4 @@ else
|
|||
git push git@github.com:nix-community/NUR HEAD:master
|
||||
fi
|
||||
|
||||
(cd nur-channel && git push origin master)
|
||||
(cd nur-combined && git push origin master)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from .format_manifest import format_manifest_command
|
|||
from .index import index_command
|
||||
from .update import update_command
|
||||
|
||||
from .channel import build_channel_command
|
||||
from .combine import combine_command
|
||||
|
||||
|
||||
def parse_arguments(argv: List[str]) -> argparse.Namespace:
|
||||
|
|
@ -16,9 +16,9 @@ def parse_arguments(argv: List[str]) -> argparse.Namespace:
|
|||
|
||||
subparsers = parser.add_subparsers(description="subcommands")
|
||||
|
||||
build_channel = subparsers.add_parser("build-channel")
|
||||
build_channel.add_argument("directory")
|
||||
build_channel.set_defaults(func=build_channel_command)
|
||||
combine = subparsers.add_parser("combine")
|
||||
combine.add_argument("directory")
|
||||
combine.set_defaults(func=combine_command)
|
||||
|
||||
format_manifest = subparsers.add_parser("format-manifest")
|
||||
format_manifest.set_defaults(func=format_manifest_command)
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@ from .path import LOCK_PATH, MANIFEST_PATH, ROOT
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def load_channel_repos(path: Path) -> Dict[str, Repo]:
|
||||
channel_manifest = load_manifest(
|
||||
def load_combined_repos(path: Path) -> Dict[str, Repo]:
|
||||
combined_manifest = load_manifest(
|
||||
path.joinpath("repos.json"), path.joinpath("repos.json.lock")
|
||||
)
|
||||
repos = {}
|
||||
for repo in channel_manifest.repos:
|
||||
for repo in combined_manifest.repos:
|
||||
repos[repo.name] = repo
|
||||
return repos
|
||||
|
||||
|
|
@ -54,20 +54,20 @@ def commit_repo(repo: Repo, message: str, path: Path) -> Repo:
|
|||
return repo
|
||||
|
||||
|
||||
def update_channel_repo(
|
||||
channel_repo: Optional[Repo], repo: Repo, path: Path
|
||||
def update_combined_repo(
|
||||
combined_repo: Optional[Repo], repo: Repo, path: Path
|
||||
) -> Optional[Repo]:
|
||||
if repo.locked_version is None:
|
||||
return None
|
||||
|
||||
new_rev = repo.locked_version.rev
|
||||
if channel_repo is None:
|
||||
if combined_repo is None:
|
||||
return commit_repo(repo, f"{repo.name}: init at {new_rev}", path)
|
||||
|
||||
assert channel_repo.locked_version is not None
|
||||
old_rev = channel_repo.locked_version.rev
|
||||
assert combined_repo.locked_version is not None
|
||||
old_rev = combined_repo.locked_version.rev
|
||||
|
||||
if channel_repo.locked_version == repo.locked_version:
|
||||
if combined_repo.locked_version == repo.locked_version:
|
||||
return repo
|
||||
|
||||
if new_rev != old_rev:
|
||||
|
|
@ -93,10 +93,10 @@ def update_manifest(repos: List[Repo], path: Path) -> None:
|
|||
write_json_file(dict(repos=d), path)
|
||||
|
||||
|
||||
def update_channel(path: Path) -> None:
|
||||
def update_combined(path: Path) -> None:
|
||||
manifest = load_manifest(MANIFEST_PATH, LOCK_PATH)
|
||||
|
||||
channel_repos = load_channel_repos(path)
|
||||
combined_repos = load_combined_repos(path)
|
||||
|
||||
repos_path = path.joinpath("repos")
|
||||
os.makedirs(repos_path, exist_ok=True)
|
||||
|
|
@ -104,12 +104,12 @@ def update_channel(path: Path) -> None:
|
|||
updated_repos = []
|
||||
|
||||
for repo in manifest.repos:
|
||||
channel_repo = None
|
||||
if repo.name in channel_repos:
|
||||
channel_repo = channel_repos[repo.name]
|
||||
del channel_repos[repo.name]
|
||||
combined_repo = None
|
||||
if repo.name in combined_repos:
|
||||
combined_repo = combined_repos[repo.name]
|
||||
del combined_repos[repo.name]
|
||||
try:
|
||||
new_repo = update_channel_repo(channel_repo, repo, repos_path)
|
||||
new_repo = update_combined_repo(combined_repo, repo, repos_path)
|
||||
except Exception:
|
||||
logger.exception(f"Failed to updated repository {repo.name}")
|
||||
continue
|
||||
|
|
@ -117,8 +117,8 @@ def update_channel(path: Path) -> None:
|
|||
if new_repo is not None:
|
||||
updated_repos.append(new_repo)
|
||||
|
||||
for channel_repo in channel_repos.values():
|
||||
remove_repo(channel_repo, path)
|
||||
for combined_repo in combined_repos.values():
|
||||
remove_repo(combined_repo, path)
|
||||
|
||||
update_manifest(updated_repos, path.joinpath("repos.json"))
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ def update_channel(path: Path) -> None:
|
|||
commit_files(["repos.json", "repos.json.lock"], "update repos.json + lock")
|
||||
|
||||
|
||||
def setup_channel() -> None:
|
||||
def setup_combined() -> None:
|
||||
manifest_path = "repos.json"
|
||||
|
||||
if not Path(".git").exists():
|
||||
|
|
@ -145,12 +145,12 @@ def setup_channel() -> None:
|
|||
|
||||
vcs_files = [manifest_path, manifest_lib, default_nix]
|
||||
|
||||
commit_files(vcs_files, "update channel code")
|
||||
commit_files(vcs_files, "update code")
|
||||
|
||||
|
||||
def build_channel_command(args: Namespace) -> None:
|
||||
channel_path = Path(args.directory)
|
||||
def combine_command(args: Namespace) -> None:
|
||||
combined_path = Path(args.directory)
|
||||
|
||||
with chdir(channel_path):
|
||||
setup_channel()
|
||||
update_channel(channel_path)
|
||||
with chdir(combined_path):
|
||||
setup_combined()
|
||||
update_combined(combined_path)
|
||||
Loading…
Add table
Add a link
Reference in a new issue