本文整理汇总了Golang中github.com/smira/aptly/aptly.PublishedStorage.LinkFromPool方法的典型用法代码示例。如果您正苦于以下问题:Golang PublishedStorage.LinkFromPool方法的具体用法?Golang PublishedStorage.LinkFromPool怎么用?Golang PublishedStorage.LinkFromPool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/smira/aptly/aptly.PublishedStorage
的用法示例。
在下文中一共展示了PublishedStorage.LinkFromPool方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: LinkFromPool
// LinkFromPool links package file from pool to dist's pool location
func (p *Package) LinkFromPool(publishedStorage aptly.PublishedStorage, packagePool aptly.PackagePool, prefix string, component string) error {
poolDir, err := p.PoolDirectory()
if err != nil {
return err
}
for i, f := range p.Files() {
sourcePath, err := packagePool.Path(f.Filename, f.Checksums.MD5)
if err != nil {
return err
}
relPath := filepath.Join("pool", component, poolDir)
publishedDirectory := filepath.Join(prefix, relPath)
err = publishedStorage.LinkFromPool(publishedDirectory, packagePool, sourcePath)
if err != nil {
return err
}
if p.IsSource {
p.Extra()["Directory"] = relPath
} else {
p.Files()[i].downloadPath = relPath
}
}
return nil
}
示例2: LinkFromPool
// LinkFromPool links package file from pool to dist's pool location
func (p *Package) LinkFromPool(publishedStorage aptly.PublishedStorage, packagePool aptly.PackagePool, prefix string, component string) error {
poolDir, err := p.PoolDirectory()
if err != nil {
return err
}
for i, f := range p.Files {
sourcePath, err := packagePool.Path(f.Filename, f.Checksums.MD5)
if err != nil {
return err
}
relPath, err := publishedStorage.LinkFromPool(prefix, component, poolDir, packagePool, sourcePath)
if err != nil {
return err
}
dir := filepath.Dir(relPath)
if p.IsSource {
p.Extra["Directory"] = dir
} else {
p.Files[i].downloadPath = dir
}
}
return nil
}