mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-11 03:11:50 +00:00
rename addon files to skel files
This commit is contained in:
@@ -340,7 +340,7 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
||||
return &task.ProcessReturnValue{Code: http.StatusBadRequest, Value: nil}, fmt.Errorf("prefix/distribution already used by another published repo: %s", duplicate)
|
||||
}
|
||||
|
||||
err = published.Publish(context.PackagePool(), context, collectionFactory, signer, publishOutput, b.ForceOverwrite, context.AddonPath())
|
||||
err = published.Publish(context.PackagePool(), context, collectionFactory, signer, publishOutput, b.ForceOverwrite, context.SkelPath())
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to publish: %s", err)
|
||||
}
|
||||
@@ -477,6 +477,7 @@ func apiPublishUpdateSwitch(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
result, err := published.Update(collectionFactory, out)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("Unable to update: %s", err)
|
||||
@@ -1018,7 +1019,7 @@ func apiPublishUpdate(c *gin.Context) {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
err = published.Publish(context.PackagePool(), context, collectionFactory, signer, out, b.ForceOverwrite, context.AddonPath())
|
||||
err = published.Publish(context.PackagePool(), context, collectionFactory, signer, out, b.ForceOverwrite, context.SkelPath())
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error {
|
||||
context.Progress().ColoredPrintf("@rWARNING@|: force overwrite mode enabled, aptly might corrupt other published repositories sharing the same package pool.\n")
|
||||
}
|
||||
|
||||
err = published.Publish(context.PackagePool(), context, collectionFactory, signer, context.Progress(), forceOverwrite, context.AddonPath())
|
||||
err = published.Publish(context.PackagePool(), context, collectionFactory, signer, context.Progress(), forceOverwrite, context.SkelPath())
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to publish: %s", err)
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ func aptlyPublishSwitch(cmd *commander.Command, args []string) error {
|
||||
published.MultiDist = context.Flags().Lookup("multi-dist").Value.Get().(bool)
|
||||
}
|
||||
|
||||
err = published.Publish(context.PackagePool(), context, collectionFactory, signer, context.Progress(), forceOverwrite, context.AddonPath())
|
||||
err = published.Publish(context.PackagePool(), context, collectionFactory, signer, context.Progress(), forceOverwrite, context.SkelPath())
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to publish: %s", err)
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func aptlyPublishUpdate(cmd *commander.Command, args []string) error {
|
||||
published.MultiDist = context.Flags().Lookup("multi-dist").Value.Get().(bool)
|
||||
}
|
||||
|
||||
err = published.Publish(context.PackagePool(), context, collectionFactory, signer, context.Progress(), forceOverwrite, context.AddonPath())
|
||||
err = published.Publish(context.PackagePool(), context, collectionFactory, signer, context.Progress(), forceOverwrite, context.SkelPath())
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to publish: %s", err)
|
||||
}
|
||||
|
||||
@@ -527,9 +527,9 @@ func (context *AptlyContext) GetVerifier() pgp.Verifier {
|
||||
return pgp.NewGpgVerifier(context.getGPGFinder())
|
||||
}
|
||||
|
||||
// AddonPath builds the local addon folder
|
||||
func (context *AptlyContext) AddonPath() string {
|
||||
return filepath.Join(context.config().RootDir, "addon")
|
||||
// SkelPath builds the local skeleton folder
|
||||
func (context *AptlyContext) SkelPath() string {
|
||||
return filepath.Join(context.config().RootDir, "skel")
|
||||
}
|
||||
|
||||
// UpdateFlags sets internal copy of flags in the context
|
||||
|
||||
@@ -389,8 +389,8 @@ func (files *indexFiles) LegacyContentsIndex(arch string, udeb bool) *indexFile
|
||||
return file
|
||||
}
|
||||
|
||||
func (files *indexFiles) AddonIndex(component, path string) *indexFile {
|
||||
key := fmt.Sprintf("ai-%s-%s", component, path)
|
||||
func (files *indexFiles) SkelIndex(component, path string) *indexFile {
|
||||
key := fmt.Sprintf("si-%s-%s", component, path)
|
||||
file, ok := files.indexes[key]
|
||||
|
||||
if !ok {
|
||||
|
||||
@@ -773,16 +773,16 @@ func (p *PublishedRepo) GetCodename() string {
|
||||
return p.Codename
|
||||
}
|
||||
|
||||
// GetAddonFiles returns a map of files to be added to a repo. Key being the relative
|
||||
// GetSkelFiles returns a map of files to be added to a repo. Key being the relative
|
||||
// path from component folder, and value being the full local FS path.
|
||||
func (p *PublishedRepo) GetAddonFiles(addonDir string, component string) (map[string]string, error) {
|
||||
func (p *PublishedRepo) GetSkelFiles(skelDir string, component string) (map[string]string, error) {
|
||||
files := make(map[string]string)
|
||||
|
||||
if addonDir == "" {
|
||||
if skelDir == "" {
|
||||
return files, nil
|
||||
}
|
||||
|
||||
fsPath := filepath.Join(addonDir, p.Prefix, "dists", p.Distribution, component)
|
||||
fsPath := filepath.Join(skelDir, p.Prefix, "dists", p.Distribution, component)
|
||||
if err := filepath.Walk(fsPath, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -813,7 +813,7 @@ func (p *PublishedRepo) GetAddonFiles(addonDir string, component string) (map[st
|
||||
|
||||
// Publish publishes snapshot (repository) contents, links package files, generates Packages & Release files, signs them
|
||||
func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageProvider aptly.PublishedStorageProvider,
|
||||
collectionFactory *CollectionFactory, signer pgp.Signer, progress aptly.Progress, forceOverwrite, addonDirectory string) error {
|
||||
collectionFactory *CollectionFactory, signer pgp.Signer, progress aptly.Progress, forceOverwrite, skelDir string) error {
|
||||
publishedStorage := publishedStorageProvider.GetPublishedStorage(p.Storage)
|
||||
|
||||
err := publishedStorage.MkDir(filepath.Join(p.Prefix, "pool"))
|
||||
@@ -1023,25 +1023,25 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
|
||||
}
|
||||
|
||||
for component := range p.sourceItems {
|
||||
addonFiles, err := p.GetAddonFiles(addonDirectory, component)
|
||||
skelFiles, err := p.GetSkelFiles(skelDir, component)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to get addon files: %v", err)
|
||||
return fmt.Errorf("unable to get skeleton files: %v", err)
|
||||
}
|
||||
|
||||
for relPath, absPath := range addonFiles {
|
||||
bufWriter, err := indexes.AddonIndex(component, relPath).BufWriter()
|
||||
for relPath, absPath := range skelFiles {
|
||||
bufWriter, err := indexes.SkelIndex(component, relPath).BufWriter()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to generate addon index: %v", err)
|
||||
return fmt.Errorf("unable to generate skeleton index: %v", err)
|
||||
}
|
||||
|
||||
file, err := os.Open(absPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to read addon file: %v", err)
|
||||
return fmt.Errorf("unable to read skeleton file: %v", err)
|
||||
}
|
||||
|
||||
_, err = bufio.NewReader(file).WriteTo(bufWriter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to write addon file: %v", err)
|
||||
return fmt.Errorf("unable to write skeleton file: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ Options:
|
||||
is root of directory storage to store database (`rootDir`/db),
|
||||
the default for downloaded packages (`rootDir`/pool) and
|
||||
the default for published repositories (`rootDir`/public) and
|
||||
addon files (`rootDir`/addon)
|
||||
skeleton files (`rootDir`/skel)
|
||||
|
||||
* `databaseBackend`:
|
||||
the database config; if this config is empty, use levledb backend by default
|
||||
|
||||
@@ -892,7 +892,7 @@ class PublishRepo33Test(BaseTest):
|
||||
|
||||
class PublishRepo34Test(BaseTest):
|
||||
"""
|
||||
publish repo: addon files
|
||||
publish repo: skeleton files
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create local-repo",
|
||||
@@ -904,7 +904,7 @@ class PublishRepo34Test(BaseTest):
|
||||
def prepare_fixture(self):
|
||||
super(PublishRepo34Test, self).prepare_fixture()
|
||||
|
||||
self.write_file(os.path.join('addon', 'dists', 'maverick', 'main', 'dep11', 'README'), 'README test file')
|
||||
self.write_file(os.path.join('skel', 'dists', 'maverick', 'main', 'dep11', 'README'), 'README test file')
|
||||
|
||||
def check(self):
|
||||
super(PublishRepo34Test, self).check()
|
||||
|
||||
Reference in New Issue
Block a user