Skip to content

Commit

Permalink
prune: Use sudo for repo-build
Browse files Browse the repository at this point in the history
Since it's owned by root.
  • Loading branch information
cgwalters authored and jlebon committed Oct 11, 2018
1 parent aea377a commit 293080d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/prune_builds
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,15 @@ for build_dir, _ in builds_to_delete:
shutil.rmtree(os.path.join(builds_dir, build_dir))

# and finally prune OSTree repos

for repo_name in ['repo', 'repo-build']:
def ostree_prune(repo_name, sudo=False):
repo = os.path.join(args.workdir, repo_name)
subprocess.run(["ostree", "prune", "--repo", repo, "--refs-only",
f"--depth={args.keep_last_n-1}"], check=True)
argv = []
if sudo:
argv.extend(['sudo', '--'])
print(f"Pruning {repo_name}")
argv.extend(["ostree", "prune", "--repo", repo, "--refs-only",
f"--depth={args.keep_last_n-1}"])
subprocess.run(argv, check=True)

ostree_prune('repo')
ostree_prune('repo-build', sudo=True)

0 comments on commit 293080d

Please sign in to comment.