Merge pull request #72 from nix-community/combine-clean

Combine clean
This commit is contained in:
Jörg Thalheim 2018-08-17 01:23:52 +02:00 committed by GitHub
commit 87a7098f5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View file

@ -350,7 +350,6 @@ with pkgs.lib;
}
```
## Contribution guideline
- When adding packages to your repository make sure they build and set
@ -381,6 +380,11 @@ override existing packages.
Also without coordination multiple overlays could easily introduce dependency
cycles.
## Contact
You can chat with us on IRC in channel [#nixos-nur](https://webchat.freenode.net/?url=irc%3A%2F%2Firc.freenode.net%2Fnixos-nur).
Apart from that we also read posts on [https://discourse.nixos.org](https://discourse.nixos.org/).
## Roadmap
- Implement a search to find packages

View file

@ -2,6 +2,7 @@ import logging
import os
import shutil
import subprocess
from tempfile import TemporaryDirectory
from argparse import Namespace
from distutils.dir_util import copy_tree
from pathlib import Path
@ -44,12 +45,22 @@ def commit_files(files: List[str], message: str) -> None:
def commit_repo(repo: Repo, message: str, path: Path) -> Repo:
repo_path = str(path.joinpath(repo.name).resolve())
repo_path = path.joinpath(repo.name).resolve()
copy_tree(repo_source(repo.name), repo_path)
tmp: Optional[TemporaryDirectory] = TemporaryDirectory(prefix=str(repo_path.parent))
assert tmp is not None
try:
copy_tree(repo_source(repo.name), tmp.name)
shutil.rmtree(repo_path, ignore_errors=True)
os.rename(tmp.name, repo_path)
tmp = None
finally:
if tmp is not None:
tmp.cleanup()
with chdir(str(path)):
commit_files([repo_path], message)
commit_files([str(repo_path)], message)
return repo