LegacyPath returns path relative to pool's root for pre-1.1 aptly (based on MD5)
(filename string, checksums *utils.ChecksumInfo)
| 45 | |
| 46 | // LegacyPath returns path relative to pool's root for pre-1.1 aptly (based on MD5) |
| 47 | func (pool *PackagePool) LegacyPath(filename string, checksums *utils.ChecksumInfo) (string, error) { |
| 48 | filename = filepath.Base(filename) |
| 49 | if filename == "." || filename == "/" { |
| 50 | return "", fmt.Errorf("filename %s is invalid", filename) |
| 51 | } |
| 52 | |
| 53 | hashMD5 := checksums.MD5 |
| 54 | |
| 55 | if len(hashMD5) < 4 { |
| 56 | return "", fmt.Errorf("unable to compute pool location for filename %v, MD5 is missing", filename) |
| 57 | } |
| 58 | |
| 59 | return filepath.Join(hashMD5[0:2], hashMD5[2:4], filename), nil |
| 60 | } |
| 61 | |
| 62 | // buildPoolPath generates pool path based on file checksum |
| 63 | func (pool *PackagePool) buildPoolPath(filename string, checksums *utils.ChecksumInfo) (string, error) { |