Skip to content

Commit

Permalink
Excise more OSTree pruning leftovers
Browse files Browse the repository at this point in the history
Minor follow-ups from the OSTree-in-builddir work.

- prune_builds: we don't need to remember the `ostree_timestamp` anymore
  when collecting builds.
- prune_builds: drop the `subprocess` module, since we no longer need to
  call out to the `ostree` CLI either.
- cmd-clean: drop the reference to OSTree repo objects
  • Loading branch information
jlebon committed Jul 3, 2019
1 parent ca1fbf8 commit 2a00a23
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/cmd-clean
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,5 @@ prepare_build

# But go back to the toplevel
cd "${workdir:?}"
# Note we don't prune the cache.qcow2 or the objects
# in the repo. If you want that, just rm -rf them.
# Note we don't prune the cache. If you want that, just rm -rf them.
rm -rf builds/* tmp/*
9 changes: 2 additions & 7 deletions src/prune_builds
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import sys
import json
import shutil
import argparse
import subprocess
import collections

from datetime import timedelta, datetime, timezone
Expand All @@ -35,8 +34,7 @@ def parse_date_string(date_string):
return dt.replace(tzinfo=timezone.utc)


Build = collections.namedtuple('Build', ['id', 'timestamp',
'ostree_timestamp'])
Build = collections.namedtuple('Build', ['id', 'timestamp'])

# Let's just hardcode this here for now
DEFAULT_KEEP_LAST_N = 3
Expand Down Expand Up @@ -115,10 +113,7 @@ with os.scandir(builds_dir) as it:
# Older versions only had ostree-timestamp
ts = j.get('coreos-assembler.build-timestamp') or j['ostree-timestamp']
t = parse_date_string(ts)
ostree_ts = j['ostree-timestamp']
ostree_t = parse_date_string(ostree_ts)
builds.append(Build(id=entry.name, timestamp=t,
ostree_timestamp=ostree_t))
builds.append(Build(id=entry.name, timestamp=t))

# just get the trivial case out of the way
if len(builds) == 0:
Expand Down

0 comments on commit 2a00a23

Please sign in to comment.