SF.net SVN: gar:[23910] csw/mgar/gar/v2/go/src/promote-packages/ promote-packages.go
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sun Aug 3 07:18:08 CEST 2014
Revision: 23910
http://sourceforge.net/p/gar/code/23910
Author: wahwah
Date: 2014-08-03 05:18:05 +0000 (Sun, 03 Aug 2014)
Log Message:
-----------
promote-packages: Support for package deletions
This fixes 2 bugs:
When a package goes from present to absent, we only update the timestamp the
first time we see it's absent. If it continues to be absent, let's not touch
the timestamp.
When a package from from absent to present, but was previously in the timing
data structure, we do need to erase the previous entry and create a new one.
This is the !pti.Present condition.
Modified Paths:
--------------
csw/mgar/gar/v2/go/src/promote-packages/promote-packages.go
Modified: csw/mgar/gar/v2/go/src/promote-packages/promote-packages.go
===================================================================
--- csw/mgar/gar/v2/go/src/promote-packages/promote-packages.go 2014-08-03 05:11:22 UTC (rev 23909)
+++ csw/mgar/gar/v2/go/src/promote-packages/promote-packages.go 2014-08-03 05:18:05 UTC (rev 23910)
@@ -208,7 +208,7 @@
}
inCat := make(map[diskformat.Md5Sum]bool)
for _, p := range c.PkgsExtra {
- if _, ok := t.catalogs[c.Spec][p.Md5_sum]; !ok {
+ if pti, ok := t.catalogs[c.Spec][p.Md5_sum]; !ok || !pti.Present {
// Packages we haven't seen yet that are in the catalog.
t.catalogs[c.Spec][p.Md5_sum] = PackageTimeInfo{
c.Spec,
@@ -226,10 +226,13 @@
if _, ok := inCat[md5]; !ok {
// Packages that aren't in the catalog (any more).
p := t.catalogs[c.Spec][md5]
- // This field is not actually read anywhere. It's enough that an entry exists.
- p.Present = false
- p.ChangedAt = time.Now()
- t.catalogs[c.Spec][md5] = p
+ // Only update the last-seen time the first time the package goes from
+ // present to absent. Otherwise the entry wouldn't age.
+ if p.Present {
+ p.Present = false
+ p.ChangedAt = time.Now()
+ t.catalogs[c.Spec][md5] = p
+ }
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list