mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-15 11:57:59 +00:00
New upstream version 1.5.0+ds1
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
## Downloaded packages
|
||||
|
||||
### SHA-256
|
||||
|
||||
For each uploaded _Debian_ package a [SHA-256](https://en.wikipedia.org/wiki/SHA-2) 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 **476e**0cdac6bc757dd2b78bacc1325323b09c45ecb41d4562deec2a1c7c148405 my-package_1.2.3_all.deb
|
||||
|
||||
```bash
|
||||
${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](https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_debian_package_file_names)
|
||||
|
||||
ex:
|
||||
|
||||
sha256sum 476e**0cdac6bc757dd2b78bacc13253**23b09c45ecb41d4562deec2a1c7c148405 **my-package_1.2.3_all.deb**
|
||||
|
||||
```
|
||||
0cdac6bc757dd2b78bacc13253_my-package_1.2.3_all.deb
|
||||
```
|
||||
|
||||
### MD5
|
||||
|
||||
For each uploaded _Debian_ package a [MD5](https://en.wikipedia.org/wiki/MD5) checksum is computed.
|
||||
This checksum is used to create a file tree where each package will reside, with following hierarchy
|
||||
|
||||
**Note:** [MD5](https://en.wikipedia.org/wiki/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 **feea**3c0c3e823615bf2d417b052a96b4 my-package_1.2.3_all.deb
|
||||
|
||||
|
||||
```bash
|
||||
${rootDir}/pool # rootDir defined in aptly.conf
|
||||
└── fe
|
||||
└── ea
|
||||
```
|
||||
|
||||
#### Filename
|
||||
|
||||
Uploaded _Debian_ is stored as-is and not renamed.
|
||||
|
||||
### Example
|
||||
|
||||
```bash
|
||||
${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
|
||||
```
|
||||
@@ -94,7 +94,7 @@ func (pool *PackagePool) FilepathList(progress aptly.Progress) ([]string, error)
|
||||
}
|
||||
|
||||
if progress != nil {
|
||||
progress.InitBar(int64(len(dirs)), false)
|
||||
progress.InitBar(int64(len(dirs)), false, aptly.BarGeneralBuildFileList)
|
||||
defer progress.ShutdownBar()
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,19 @@ func (s *PackagePoolSuite) TestRemove(c *C) {
|
||||
c.Check(list, DeepEquals, []string{"ae/0c/1.deb", "bd/0a/3.deb", "bd/0b/4.deb"})
|
||||
}
|
||||
|
||||
func isSameDevice(s *PackagePoolSuite) bool {
|
||||
poolPath, _ := s.pool.buildPoolPath(filepath.Base(s.debFile), &s.checksum)
|
||||
fullPoolPath := filepath.Join(s.pool.rootPath, poolPath)
|
||||
poolDir := filepath.Dir(fullPoolPath)
|
||||
poolDirInfo, _ := os.Stat(poolDir)
|
||||
|
||||
source, _ := os.Open(s.debFile)
|
||||
sourceInfo, _ := source.Stat()
|
||||
defer source.Close()
|
||||
|
||||
return poolDirInfo.Sys().(*syscall.Stat_t).Dev == sourceInfo.Sys().(*syscall.Stat_t).Dev
|
||||
}
|
||||
|
||||
func (s *PackagePoolSuite) TestImportOk(c *C) {
|
||||
path, err := s.pool.Import(s.debFile, filepath.Base(s.debFile), &s.checksum, false, s.cs)
|
||||
c.Check(err, IsNil)
|
||||
@@ -103,7 +116,12 @@ func (s *PackagePoolSuite) TestImportOk(c *C) {
|
||||
info, err := s.pool.Stat(path)
|
||||
c.Assert(err, IsNil)
|
||||
c.Check(info.Size(), Equals, int64(2738))
|
||||
c.Check(info.Sys().(*syscall.Stat_t).Nlink > 1, Equals, true)
|
||||
// /tmp may be on different devices, so hardlinks are not used
|
||||
if isSameDevice(s) {
|
||||
c.Check(info.Sys().(*syscall.Stat_t).Nlink > 1, Equals, true)
|
||||
} else {
|
||||
c.Check(info.Sys().(*syscall.Stat_t).Nlink, Equals, uint64(1))
|
||||
}
|
||||
|
||||
// import as different name
|
||||
path, err = s.pool.Import(s.debFile, "some.deb", &s.checksum, false, s.cs)
|
||||
@@ -326,7 +344,11 @@ func (s *PackagePoolSuite) TestLink(c *C) {
|
||||
info, err := os.Stat(dstPath)
|
||||
c.Assert(err, IsNil)
|
||||
c.Check(info.Size(), Equals, int64(2738))
|
||||
c.Check(info.Sys().(*syscall.Stat_t).Nlink > 2, Equals, true)
|
||||
if isSameDevice(s) {
|
||||
c.Check(info.Sys().(*syscall.Stat_t).Nlink > 2, Equals, true)
|
||||
} else {
|
||||
c.Check(info.Sys().(*syscall.Stat_t).Nlink, Equals, uint64(2))
|
||||
}
|
||||
}
|
||||
|
||||
func (s *PackagePoolSuite) TestSymlink(c *C) {
|
||||
@@ -340,7 +362,11 @@ func (s *PackagePoolSuite) TestSymlink(c *C) {
|
||||
info, err := os.Stat(dstPath)
|
||||
c.Assert(err, IsNil)
|
||||
c.Check(info.Size(), Equals, int64(2738))
|
||||
c.Check(info.Sys().(*syscall.Stat_t).Nlink > 2, Equals, true)
|
||||
if isSameDevice(s) {
|
||||
c.Check(info.Sys().(*syscall.Stat_t).Nlink > 2, Equals, true)
|
||||
} else {
|
||||
c.Check(info.Sys().(*syscall.Stat_t).Nlink, Equals, uint64(1))
|
||||
}
|
||||
|
||||
info, err = os.Lstat(dstPath)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
Reference in New Issue
Block a user