From bc24eec7208187e171fd61ced7130fd8e2828257 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 14 Mar 2018 00:54:05 +0300 Subject: Add support for version iteration --- bpkg/pkg-purge.cxx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'bpkg/pkg-purge.cxx') diff --git a/bpkg/pkg-purge.cxx b/bpkg/pkg-purge.cxx index fa5ce01..e1cd113 100644 --- a/bpkg/pkg-purge.cxx +++ b/bpkg/pkg-purge.cxx @@ -37,19 +37,30 @@ namespace bpkg if (exists (d)) // Don't complain if someone did our job for us. rm_r (d); - p->src_root = nullopt; p->purge_src = false; } - if (p->purge_archive && archive) + // Let's forget about the possibly non-purged source directory, as the + // selected package may now be reused for unrelated package version. + // + p->src_root = nullopt; + p->manifest_checksum = nullopt; + + if (archive) { - path a (p->archive->absolute () ? *p->archive : c / *p->archive); + if (p->purge_archive) + { + path a (p->archive->absolute () ? *p->archive : c / *p->archive); - if (exists (a)) - rm (a); + if (exists (a)) + rm (a); + p->purge_archive = false; + } + + // Let's forget about the possibly non-purged archive (see above). + // p->archive = nullopt; - p->purge_archive = false; } } catch (const failed&) -- cgit v1.1