From 38f4fc209b8ffa6256d475dd2cfaa0c068ae0254 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 31 Mar 2015 00:08:23 +0300 Subject: [PATCH] Contents index support. #142 --- deb/index_files.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/deb/index_files.go b/deb/index_files.go index 962c988b..a64fba86 100644 --- a/deb/index_files.go +++ b/deb/index_files.go @@ -215,6 +215,35 @@ func (files *indexFiles) ReleaseIndex(component, arch string, udeb bool) *indexF return file } +func (files *indexFiles) ContentsIndex(component, arch string, udeb bool) *indexFile { + if arch == "source" { + udeb = false + } + key := fmt.Sprintf("ci-%s-%s-%v", component, arch, udeb) + file, ok := files.indexes[key] + if !ok { + var relativePath string + + if udeb { + relativePath = filepath.Join(component, fmt.Sprintf("Contents-udeb-%s", arch)) + } else { + relativePath = filepath.Join(component, fmt.Sprintf("Contents-%s", arch)) + } + + file = &indexFile{ + parent: files, + discardable: true, + compressable: true, + signable: false, + relativePath: relativePath, + } + + files.indexes[key] = file + } + + return file +} + func (files *indexFiles) ReleaseFile() *indexFile { return &indexFile{ parent: files,