files

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 11 Imported by: 10

README

Downloaded packages

SHA-256

For each uploaded Debian package a SHA-256 checksum is computed. This checksum is used to create a file tree where each package will reside, with following hierarchy.

Directory and sub-directories structure
  • 1st and 2nd characters of SHA-256 checksum as sub-directory of rootDir/pool directory.
  • 3rd and 4th characters of SHA-256 checksum as sub-directory of the former

ex:

sha256sum 476e0cdac6bc757dd2b78bacc1325323b09c45ecb41d4562deec2a1c7c148405 my-package_1.2.3_all.deb

${rootDir}/pool # rootDir defined in aptly.conf
└── 47
    └── 6e
Filename

The following items are concatenated to form the filename under which package is stored.

  • 5th to the 31st characters of SHA-256 checksum
  • "_" (undescore)
  • filename of uploaded Debian as defined in Debian package file names

ex:

sha256sum 476e0cdac6bc757dd2b78bacc1325323b09c45ecb41d4562deec2a1c7c148405 my-package_1.2.3_all.deb

 0cdac6bc757dd2b78bacc13253_my-package_1.2.3_all.deb

MD5

For each uploaded Debian package a MD5 checksum is computed. This checksum is used to create a file tree where each package will reside, with following hierarchy

Note: MD5 is only legacy layout. Its support is limited to 'read' files from the pool, it never puts files this way for new package files.

Directory and sub-directories structure
  • 1st and 2nd characters of MD5 checksum as sub-directory name of rootDir/pool directory
  • 3rd and 4th characters of MD5 chacksum as sub-directory name of the former

ex:

md5sum feea3c0c3e823615bf2d417b052a96b4 my-package_1.2.3_all.deb

${rootDir}/pool # rootDir defined in aptly.conf
└── fe
    └── ea
Filename

Uploaded Debian is stored as-is and not renamed.

Example

${rootDir}/pool # rootDir defined in aptly.conf
├── 00
│   ├── 25
│   │   └── yet_another_package-0.6.0_all.deb
│   ├── 60
│   ├── 97
│   │   └── 80ced73165f92fea490f2561a7c4_my-package_0.0.1_all.deb
│   ├── 6e 
│   │   └── 0cdac6bc757dd2b78bacc13253_my-package_1.2.3_all.deb # sha256sum 476e0cdac6bc757dd2b78bacc1325323b09c45ecb41d4562deec2a1c7c148405
│   └── db
│       └── yet_another_package-0.5.8_all.deb # md5sum 00db7ada61aa28a6931267f1714cbb15
...
├── 2a                                                                                                                
│   ├── 10                                                                                                            
│   │   └── yet_another_package-0.5.9_all.deb
│   ├── 64
│   │   └── 80ced73165f92fea490f2561a7c4_my-other-package_2.3.2_amd64.deb
│   ├── 4c                                                                                                            
│   ├── 5c                                                                                                            
│   │   └── yet_another_package-0.6.1_all.deb
│   ├── 77                                                                                                            
│   ├── b5                                                                                                            
│   │   └── 4b2eb349236cf5c4af7eca68a43b_my-package_0.2.0_amd64.deb
...
└── ff
    ├── 4c                                                                                                            
    ├── 5a                                                                                                            
    │   └── 8868dd8661bbe25c51bdd9b2d25c_my-package_0.2.0_amd64.deb                                          
    └── dc

Documentation

Overview

Package files handles operation on filesystem for both public pool and published files

Index

Constants

View Source
const (
	LinkMethodHardLink uint = iota
	LinkMethodSymLink
	LinkMethodCopy
)

Constants defining the type of creating links

View Source
const (
	VerificationMethodChecksum uint = iota
	VerificationMethodFileSize
)

Constants defining the type of file verification for LinkMethodCopy

Variables

This section is empty.

Functions

func NewMockChecksumStorage added in v1.1.0

func NewMockChecksumStorage() aptly.ChecksumStorage

NewMockChecksumStorage creates aptly.ChecksumStorage for tests

Types

type PackagePool

type PackagePool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

PackagePool is deduplicated storage of package files on filesystem

func NewPackagePool

func NewPackagePool(root string, supportLegacyPaths bool) *PackagePool

NewPackagePool creates new instance of PackagePool which specified root

func (*PackagePool) FilepathList

func (pool *PackagePool) FilepathList(progress aptly.Progress) ([]string, error)

FilepathList returns file paths of all the files in the pool

func (*PackagePool) FullPath added in v1.1.0

func (pool *PackagePool) FullPath(path string) string

FullPath generates full path to the file in pool

Please use with care: it's not supposed to be used to access files

func (*PackagePool) GenerateTempPath added in v1.1.0

func (pool *PackagePool) GenerateTempPath(filename string) (string, error)

GenerateTempPath generates temporary path for download (which is fast to import into package pool later on)

func (*PackagePool) Import

func (pool *PackagePool) Import(srcPath, basename string, checksums *utils.ChecksumInfo, move bool, checksumStorage aptly.ChecksumStorage) (string, error)

Import copies file into package pool

- srcPath is full path to source file as it is now - basename is desired human-readable name (canonical filename) - checksums are used to calculate file placement - move indicates whether srcPath can be removed

func (*PackagePool) LegacyPath added in v1.1.0

func (pool *PackagePool) LegacyPath(filename string, checksums *utils.ChecksumInfo) (string, error)

LegacyPath returns path relative to pool's root for pre-1.1 aptly (based on MD5)

func (pool *PackagePool) Link(path, dstPath string) error

Link generates hardlink to destination path

func (*PackagePool) Open added in v1.1.0

func (pool *PackagePool) Open(path string) (aptly.ReadSeekerCloser, error)

Open returns io.ReadCloser to access the file

func (*PackagePool) Remove

func (pool *PackagePool) Remove(path string) (size int64, err error)

Remove deletes file in package pool returns its size

func (*PackagePool) Stat added in v1.1.0

func (pool *PackagePool) Stat(path string) (os.FileInfo, error)

Stat returns Unix stat(2) info

func (pool *PackagePool) Symlink(path, dstPath string) error

Symlink generates symlink to destination path

func (*PackagePool) Verify added in v1.1.0

func (pool *PackagePool) Verify(poolPath, basename string, checksums *utils.ChecksumInfo, checksumStorage aptly.ChecksumStorage) (string, bool, error)

Verify checks whether file exists in the pool and fills back checksum info

if poolPath is empty, poolPath is generated automatically based on checksum info (if available) in any case, if function returns true, it also fills back checksums with complete information about the file in the pool

type PublishedStorage

type PublishedStorage struct {
	// contains filtered or unexported fields
}

PublishedStorage abstract file system with public dirs (published repos)

func NewPublishedStorage

func NewPublishedStorage(root string, linkMethod string, verifyMethod string) *PublishedStorage

NewPublishedStorage creates new instance of PublishedStorage which specified root

func (*PublishedStorage) FileExists added in v1.2.0

func (storage *PublishedStorage) FileExists(path string) (bool, error)

FileExists returns true if path exists

func (*PublishedStorage) Filelist added in v0.5.1

func (storage *PublishedStorage) Filelist(prefix string) ([]string, error)

Filelist returns list of files under prefix

func (storage *PublishedStorage) HardLink(src string, dst string) error

HardLink creates a hardlink of a file

func (*PublishedStorage) LinkFromPool

func (storage *PublishedStorage) LinkFromPool(publishedDirectory, fileName string, sourcePool aptly.PackagePool,
	sourcePath string, sourceChecksums utils.ChecksumInfo, force bool) error

LinkFromPool links package file from pool to dist's pool location

publishedDirectory is desired location in pool (like prefix/pool/component/liba/libav/) sourcePool is instance of aptly.PackagePool sourcePath is a relative path to package file in package pool

LinkFromPool returns relative path for the published file to be included in package index

func (*PublishedStorage) MkDir

func (storage *PublishedStorage) MkDir(path string) error

MkDir creates directory recursively under public path

func (*PublishedStorage) PublicPath

func (storage *PublishedStorage) PublicPath() string

PublicPath returns root of public part

func (*PublishedStorage) PutFile added in v0.7.1

func (storage *PublishedStorage) PutFile(path string, sourceFilename string) error

PutFile puts file into published storage at specified path

func (storage *PublishedStorage) ReadLink(path string) (string, error)

ReadLink returns the symbolic link pointed to by path (relative to storage root)

func (*PublishedStorage) Remove added in v0.5.1

func (storage *PublishedStorage) Remove(path string) error

Remove removes single file under public path

func (*PublishedStorage) RemoveDirs

func (storage *PublishedStorage) RemoveDirs(path string, progress aptly.Progress) error

RemoveDirs removes directory structure under public path

func (*PublishedStorage) RenameFile added in v0.5.1

func (storage *PublishedStorage) RenameFile(oldName, newName string) error

RenameFile renames (moves) file

func (storage *PublishedStorage) SymLink(src string, dst string) error

SymLink creates a symbolic link, which can be read with ReadLink

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL