From c4ad756b4733bf5fad9cb7fdc70a67f7ef191776 Mon Sep 17 00:00:00 2001 From: KereMath Date: Thu, 20 Aug 2026 03:09:25 +0300 Subject: [PATCH] publish: add by-hash entries for skel and AppStream files SkelIndex was the only index constructor not propagating acquireByHash, so with -acquire-by-hash the Release file advertises Acquire-By-Hash: yes while no by-hash/ entries exist for these files and apt gets a 404. --- deb/index_files.go | 11 ++++++----- deb/publish_test.go | 13 +++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/deb/index_files.go b/deb/index_files.go index 88c3c709..f0e2ba9e 100644 --- a/deb/index_files.go +++ b/deb/index_files.go @@ -397,11 +397,12 @@ func (files *indexFiles) SkelIndex(component, path string) *indexFile { relativePath := filepath.Join(component, path) file = &indexFile{ - parent: files, - discardable: false, - compressable: false, - onlyGzip: false, - relativePath: relativePath, + parent: files, + discardable: false, + compressable: false, + onlyGzip: false, + acquireByHash: files.acquireByHash, + relativePath: relativePath, } files.indexes[key] = file diff --git a/deb/publish_test.go b/deb/publish_test.go index 0459c113..5a5b3cfa 100644 --- a/deb/publish_test.go +++ b/deb/publish_test.go @@ -537,6 +537,19 @@ func (s *PublishedRepoSuite) TestPublishAppStreamMultipleComponents(c *C) { c.Check(published, DeepEquals, contribContent) } +func (s *PublishedRepoSuite) TestPublishAppStreamAcquireByHash(c *C) { + s.snapshot.AppStreamFiles = map[string]string{ + "main/dep11/Components-amd64.yml.gz": s.importAppStreamFile(c, "Components-amd64.yml.gz", []byte("DEP-11 content\n")), + } + + s.repo.AcquireByHash = true + err := s.repo.Publish(s.packagePool, s.provider, s.factory, &NullSigner{}, nil, false, "") + c.Assert(err, IsNil) + + base := filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/squeeze") + c.Check(filepath.Join(base, "main/dep11/by-hash/SHA256"), PathExists) +} + func (s *PublishedRepoSuite) TestPublishNoSigner(c *C) { err := s.repo.Publish(s.packagePool, s.provider, s.factory, nil, nil, false, "") c.Assert(err, IsNil)