Fixing tests and fix cleanup.

Signed-off-by: Christoph Fiehe <c.fiehe@eurodata.de>
This commit is contained in:
Christoph Fiehe
2024-10-11 23:09:30 +02:00
committed by André Roth
parent ac5ecf946d
commit f8f28e9554
83 changed files with 540 additions and 174 deletions

View File

@@ -64,3 +64,4 @@ List of contributors, in chronological order:
* Golf Hu (https://github.com/hudeng-go)
* Cookie Fei (https://github.com/wuhuang26)
* Andrey Loukhnov (https://github.com/aol-nnov)
* Christoph Fiehe (https://github.com/cfiehe)

View File

@@ -30,9 +30,9 @@ type signingParams struct {
type sourceParams struct {
// Name of the component
Component string `binding:"required" json:"Component" example:"contrib"`
Component string `binding:"required" json:"Component"`
// Name of the local repository/snapshot
Name string `binding:"required" json:"Name" example:"snap1"`
Name string `binding:"required" json:"Name"`
}
func getSigner(options *signingParams) (pgp.Signer, error) {
@@ -77,7 +77,7 @@ func apiPublishList(c *gin.Context) {
collectionFactory := context.NewCollectionFactory()
collection := collectionFactory.PublishedRepoCollection()
result := make([]*deb.PublishedRepo, 0, collection.Len())
repos := make([]*deb.PublishedRepo, 0, collection.Len())
err := collection.ForEach(func(repo *deb.PublishedRepo) error {
err := collection.LoadShallow(repo, collectionFactory)
@@ -85,7 +85,7 @@ func apiPublishList(c *gin.Context) {
return err
}
result = append(result, repo)
repos = append(repos, repo)
return nil
})
@@ -95,17 +95,16 @@ func apiPublishList(c *gin.Context) {
return
}
c.JSON(http.StatusOK, result)
c.JSON(http.StatusOK, repos)
}
// @Summary Show published repository
// @Description **Get published repository by name**
// @Description **Get details of a published repository**
// @Tags Publish
// @Consume json
// @Produce json
// @Param prefix path string true "publishing prefix, use `:.` instead of `.` because it is ambigious in URLs"
// @Param distribution path string true "distribution name"
// @Success 200 {object} deb.RemoteRepo
// @Success 200 {object} deb.PublishedRepo
// @Failure 404 {object} Error "Published repository not found"
// @Failure 500 {object} Error "Internal Error"
// @Router /api/publish/{prefix}/{distribution} [get]
@@ -165,14 +164,15 @@ type publishedRepoCreateParams struct {
}
// @Summary Create published repository
// @Description Publish local repository or snapshot under specified prefix. Storage might be passed in prefix as well, e.g. `s3:packages/`.
// @Description To supply empty prefix, just remove last part (`POST /api/publish`).
// @Description **Publish local repository or snapshot under specified prefix**
// @Description
// @Description Storage might be passed in prefix as well, e.g. `s3:packages/`. To supply empty prefix, just remove last part (`POST /api/publish`).
// @Tags Publish
// @Param prefix path string true "publishing prefix"
// @Consume json
// @Param request body publishedRepoCreateParams true "Parameters"
// @Produce json
// @Success 200 {object} deb.RemoteRepo
// @Success 200 {object} deb.PublishedRepo
// @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Source not found"
// @Failure 500 {object} Error "Internal Error"
@@ -337,14 +337,40 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
})
}
type publishedRepoUpdateSwitchParams struct {
// when publishing, overwrite files in pool/ directory without notice
ForceOverwrite bool ` json:"ForceOverwrite"`
// GPG options
Signing signingParams ` json:"Signing"`
// Don't generate contents indexes
SkipContents *bool ` json:"SkipContents"`
// Skip bz2 compression for index files
SkipBz2 *bool ` json:"SkipBz2"`
// Don't remove unreferenced files in prefix/component
SkipCleanup *bool ` json:"SkipCleanup"`
// only when updating published snapshots, list of objects 'Component/Name'
Snapshots []sourceParams `binding:"required" json:"Snapshots"`
// Provide index files by hash
AcquireByHash *bool ` json:"AcquireByHash"`
// Enable multiple packages with the same filename in different distributions
MultiDist *bool ` json:"MultiDist"`
}
// @Summary Update published repository
// @Description Update a published repository.
// @Description **Update a published local repository or switch published snapshot**
// @Description
// @Description API action depends on published repository contents:
// @Description * if local repository has been published, published repository would be updated to match local repository contents
// @Description * if snapshots have been been published, it is possible to switch each component to new snapshot
// @Tags Publish
// @Accept json
// @Produce json
// @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name"
// @Success 200 {object} deb.RemoteRepo
// @Consume json
// @Param request body publishedRepoUpdateSwitchParams true "Parameters"
// @Produce json
// @Success 200 {object} deb.PublishedRepo
// @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Published repository or source not found"
// @Failure 500 {object} Error "Internal Error"
@@ -354,20 +380,7 @@ func apiPublishUpdateSwitch(c *gin.Context) {
storage, prefix := deb.ParsePrefix(param)
distribution := slashEscape(c.Params.ByName("distribution"))
var b struct {
ForceOverwrite bool
Signing signingParams
SkipContents *bool
SkipBz2 *bool
SkipCleanup *bool
Snapshots []struct {
Component string `binding:"required"`
Name string `binding:"required"`
}
AcquireByHash *bool
MultiDist *bool
}
var b publishedRepoUpdateSwitchParams
if c.Bind(&b) != nil {
return
}
@@ -393,7 +406,7 @@ func apiPublishUpdateSwitch(c *gin.Context) {
if published.SourceKind == deb.SourceLocalRepo {
if len(b.Snapshots) > 0 {
AbortWithJSONError(c, 400, fmt.Errorf("snapshots shouldn't be given when updating local repo"))
AbortWithJSONError(c, http.StatusBadRequest, fmt.Errorf("snapshots shouldn't be given when updating local repo"))
return
}
updatedComponents = published.Components()
@@ -483,8 +496,9 @@ func apiPublishUpdateSwitch(c *gin.Context) {
}
if b.SkipCleanup == nil || !*b.SkipCleanup {
err = collection.CleanupPrefixComponentFiles(context, published, result.AddedComponents(), result.UpdatedComponents(), result.RemovedComponents(),
collectionFactory, out)
cleanComponents := make([]string, 0, len(result.UpdatedSources)+len(result.RemovedSources))
cleanComponents = append(append(cleanComponents, result.UpdatedComponents()...), result.RemovedComponents()...)
err = collection.CleanupPrefixComponentFiles(context, published, cleanComponents, collectionFactory, out)
if err != nil {
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
}
@@ -495,7 +509,9 @@ func apiPublishUpdateSwitch(c *gin.Context) {
}
// @Summary Delete published repository
// @Description Delete a published repository.
// @Description **Delete a published repository**
// @Description
// @Description Delete published repository, clean up files in published directory.
// @Tags Publish
// @Accept json
// @Produce json
@@ -503,7 +519,7 @@ func apiPublishUpdateSwitch(c *gin.Context) {
// @Param distribution path string true "distribution name"
// @Param force query int true "force: 1 to enable"
// @Param skipCleanup query int true "skipCleanup: 1 to enable"
// @Success 200 {object} task.ProcessReturnValue
// @Success 200
// @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Published repository not found"
// @Failure 500 {object} Error "Internal Error"
@@ -538,6 +554,16 @@ func apiPublishDrop(c *gin.Context) {
})
}
// @Summary Add staged source
// @Description **Create and add a staged source**
// @Tags Publish
// @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name"
// @Produce json
// @Success 200 {object} sourceParams
// @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Published repository not found"
// @Failure 500 {object} Error "Internal Error"
// @Router /api/publish/{prefix}/{distribution}/sources [post]
func apiPublishSourcesCreate(c *gin.Context) {
var (
@@ -576,7 +602,7 @@ func apiPublishSourcesCreate(c *gin.Context) {
_, exists := sources[component]
if exists {
AbortWithJSONError(c, http.StatusBadRequest, fmt.Errorf("unable to create: Component %q already exists", component))
AbortWithJSONError(c, http.StatusBadRequest, fmt.Errorf("unable to create: Component '%s' already exists", component))
return
}
@@ -594,6 +620,16 @@ func apiPublishSourcesCreate(c *gin.Context) {
})
}
// @Summary Get staged sources
// @Description **Get the staged source list**
// @Tags Publish
// @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name"
// @Produce json
// @Success 200 {array} sourceParams
// @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Published repository not found or no source changes exist"
// @Failure 500 {object} Error "Internal Error"
// @Router /api/publish/{prefix}/{distribution}/sources [get]
func apiPublishSourcesList(c *gin.Context) {
param := slashEscape(c.Params.ByName("prefix"))
@@ -624,6 +660,18 @@ func apiPublishSourcesList(c *gin.Context) {
c.JSON(http.StatusOK, revision.SourceList())
}
// @Summary Set staged sources
// @Description **Set the staged source list**
// @Tags Publish
// @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name"
// @Consume json
// @Param request body publishedRepoUpdateParams true "Parameters"
// @Produce json
// @Success 200 {array} sourceParams
// @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Published repository not found"
// @Failure 500 {object} Error "Internal Error"
// @Router /api/publish/{prefix}/{distribution}/sources [put]
func apiPublishSourcesUpdate(c *gin.Context) {
var (
@@ -640,13 +688,13 @@ func apiPublishSourcesUpdate(c *gin.Context) {
published, err := collection.ByStoragePrefixDistribution(storage, prefix, distribution)
if err != nil {
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to show: %s", err))
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to update: %s", err))
return
}
err = collection.LoadComplete(published, collectionFactory)
if err != nil {
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unable to show: %s", err))
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unable to update: %s", err))
return
}
@@ -672,10 +720,22 @@ func apiPublishSourcesUpdate(c *gin.Context) {
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save to DB: %s", err)
}
return &task.ProcessReturnValue{Code: http.StatusOK, Value: published}, nil
return &task.ProcessReturnValue{Code: http.StatusOK, Value: revision.SourceList()}, nil
})
}
// @Summary Delete staged sources
// @Description **Delete the staged source list**
// @Description
// @Description Delete staged sources and keep existing sources of published repository.
// @Tags Publish
// @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name"
// @Produce json
// @Success 200
// @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Published repository not found"
// @Failure 500 {object} Error "Internal Error"
// @Router /api/publish/{prefix}/{distribution}/sources [delete]
func apiPublishSourcesDelete(c *gin.Context) {
param := slashEscape(c.Params.ByName("prefix"))
@@ -707,10 +767,21 @@ func apiPublishSourcesDelete(c *gin.Context) {
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save to DB: %s", err)
}
return &task.ProcessReturnValue{Code: http.StatusOK, Value: published}, nil
return &task.ProcessReturnValue{Code: http.StatusOK, Value: gin.H{}}, nil
})
}
// @Summary Update staged source
// @Description **Update the staged source of a component**
// @Tags Publish
// @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name"
// @Param component path string true "component name"
// @Produce json
// @Success 200
// @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Published repository/component not found"
// @Failure 500 {object} Error "Internal Error"
// @Router /api/publish/{prefix}/{distribution}/sources/{component} [put]
func apiPublishSourceUpdate(c *gin.Context) {
var (
@@ -743,7 +814,7 @@ func apiPublishSourceUpdate(c *gin.Context) {
_, exists := sources[component]
if !exists {
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to update: Component %q does not exist", component))
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to update: Component '%s' does not exist", component))
return
}
@@ -770,10 +841,21 @@ func apiPublishSourceUpdate(c *gin.Context) {
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save to DB: %s", err)
}
return &task.ProcessReturnValue{Code: http.StatusOK, Value: published}, nil
return &task.ProcessReturnValue{Code: http.StatusOK, Value: gin.H{}}, nil
})
}
// @Summary Delete staged source
// @Description **Delete the staged source**
// @Tags Publish
// @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name"
// @Param component path string true "component name"
// @Produce json
// @Success 200
// @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Published repository not found"
// @Failure 500 {object} Error "Internal Error"
// @Router /api/publish/{prefix}/{distribution}/sources/{component} [delete]
func apiPublishSourceDelete(c *gin.Context) {
var err error
@@ -788,19 +870,25 @@ func apiPublishSourceDelete(c *gin.Context) {
published, err := collection.ByStoragePrefixDistribution(storage, prefix, distribution)
if err != nil {
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to show: %s", err))
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to delete: %s", err))
return
}
err = collection.LoadComplete(published, collectionFactory)
if err != nil {
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unable to show: %s", err))
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unable to delete: %s", err))
return
}
revision := published.ObtainRevision()
sources := revision.Sources
_, exists := sources[component]
if !exists {
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to delete: Component '%s' does not exist", component))
return
}
delete(sources, component)
resources := []string{string(published.Key())}
@@ -811,10 +899,41 @@ func apiPublishSourceDelete(c *gin.Context) {
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save to DB: %s", err)
}
return &task.ProcessReturnValue{Code: http.StatusOK, Value: published}, nil
return &task.ProcessReturnValue{Code: http.StatusOK, Value: gin.H{}}, nil
})
}
type publishedRepoUpdateParams struct {
// when publishing, overwrite files in pool/ directory without notice
ForceOverwrite bool ` json:"ForceOverwrite"`
// GPG options
Signing signingParams ` json:"Signing"`
// Don't generate contents indexes
SkipContents *bool ` json:"SkipContents"`
// Skip bz2 compression for index files
SkipBz2 *bool ` json:"SkipBz2"`
// Don't remove unreferenced files in prefix/component
SkipCleanup *bool ` json:"SkipCleanup"`
// Provide index files by hash
AcquireByHash *bool ` json:"AcquireByHash"`
// Enable multiple packages with the same filename in different distributions
MultiDist *bool ` json:"MultiDist"`
}
// @Summary Update content of published repository
// @Description **Update the content of a published repository**
// @Description
// @Description Replace the sources of the published repository (if available) and (re-)publish new content.
// @Tags Publish
// @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name"
// @Consume json
// @Param request body publishedRepoUpdateParams true "Parameters"
// @Produce json
// @Success 200 {object} deb.PublishedRepo
// @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Published repository/component not found"
// @Failure 500 {object} Error "Internal Error"
// @Router /api/publish/{prefix}/{distribution}/update [post]
func apiPublishUpdate(c *gin.Context) {
param := slashEscape(c.Params.ByName("prefix"))
@@ -891,8 +1010,9 @@ func apiPublishUpdate(c *gin.Context) {
}
if b.SkipCleanup == nil || !*b.SkipCleanup {
err = collection.CleanupPrefixComponentFiles(context, published,
result.AddedComponents(), result.UpdatedComponents(), result.RemovedComponents(), collectionFactory, out)
cleanComponents := make([]string, 0, len(result.UpdatedSources)+len(result.RemovedSources))
cleanComponents = append(append(cleanComponents, result.UpdatedComponents()...), result.RemovedComponents()...)
err = collection.CleanupPrefixComponentFiles(context, published, cleanComponents, collectionFactory, out)
if err != nil {
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
}

View File

@@ -267,7 +267,7 @@ func aptlyMirrorUpdate(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to update: %s", err)
}
context.Progress().Printf("\nMirror `%s` has been successfully updated.\n", repo.Name)
context.Progress().Printf("\nMirror `%s` has been updated successfully.\n", repo.Name)
return err
}

View File

@@ -44,9 +44,9 @@ func aptlyPublishSourceAdd(cmd *commander.Command, args []string) error {
name := names[i]
_, exists := sources[component]
if exists {
return fmt.Errorf("unable to add: component %q has already been added", component)
return fmt.Errorf("unable to add: component '%s' has already been added", component)
}
context.Progress().Printf("Adding component %q with source %q [%s]...\n", component, name, published.SourceKind)
context.Progress().Printf("Adding component '%s' with source '%s' [%s]...\n", component, name, published.SourceKind)
sources[component] = names[i]
}

View File

@@ -42,9 +42,9 @@ func aptlyPublishSourceRemove(cmd *commander.Command, args []string) error {
for _, component := range components {
name, exists := sources[component]
if !exists {
return fmt.Errorf("unable to remove: component %q does not exist", component)
return fmt.Errorf("unable to remove: component '%s' does not exist", component)
}
context.Progress().Printf("Removing component %q with source %q [%s]...\n", component, name, published.SourceKind)
context.Progress().Printf("Removing component '%s' with source '%s' [%s]...\n", component, name, published.SourceKind)
delete(sources, component)
}

View File

@@ -44,9 +44,9 @@ func aptlyPublishSourceUpdate(cmd *commander.Command, args []string) error {
name := names[i]
_, exists := sources[component]
if !exists {
return fmt.Errorf("unable to update: component %q does not exist", component)
return fmt.Errorf("unable to update: component '%s' does not exist", component)
}
context.Progress().Printf("Updating component %q with source %q [%s]...\n", component, name, published.SourceKind)
context.Progress().Printf("Updating component '%s' with source '%s' [%s]...\n", component, name, published.SourceKind)
sources[component] = name
}

View File

@@ -115,8 +115,7 @@ func aptlyPublishSwitch(cmd *commander.Command, args []string) error {
skipCleanup := context.Flags().Lookup("skip-cleanup").Value.Get().(bool)
if !skipCleanup {
err = collectionFactory.PublishedRepoCollection().CleanupPrefixComponentFiles(context, published,
[]string{}, components, []string{}, collectionFactory, context.Progress())
err = collectionFactory.PublishedRepoCollection().CleanupPrefixComponentFiles(context, published, components, collectionFactory, context.Progress())
if err != nil {
return fmt.Errorf("unable to switch: %s", err)
}

View File

@@ -76,14 +76,15 @@ func aptlyPublishUpdate(cmd *commander.Command, args []string) error {
skipCleanup := context.Flags().Lookup("skip-cleanup").Value.Get().(bool)
if !skipCleanup {
err = collectionFactory.PublishedRepoCollection().CleanupPrefixComponentFiles(context, published,
result.AddedComponents(), result.UpdatedComponents(), result.RemovedComponents(), collectionFactory, context.Progress())
cleanComponents := make([]string, 0, len(result.UpdatedSources)+len(result.RemovedSources))
cleanComponents = append(append(cleanComponents, result.UpdatedComponents()...), result.RemovedComponents()...)
err = collectionFactory.PublishedRepoCollection().CleanupPrefixComponentFiles(context, published, cleanComponents, collectionFactory, context.Progress())
if err != nil {
return fmt.Errorf("unable to update: %s", err)
}
}
context.Progress().Printf("\nPublished %s repository %s has been successfully updated.\n", published.SourceKind, published.String())
context.Progress().Printf("\nPublished %s repository %s has been updated successfully.\n", published.SourceKind, published.String())
return err
}

View File

@@ -1462,73 +1462,127 @@ func (collection *PublishedRepoCollection) listReferencedFilesByComponent(prefix
// CleanupPrefixComponentFiles removes all unreferenced files in published storage under prefix/component pair
func (collection *PublishedRepoCollection) CleanupPrefixComponentFiles(publishedStorageProvider aptly.PublishedStorageProvider,
published *PublishedRepo, addedComponents, updatedComponents, removedComponents []string,
collectionFactory *CollectionFactory, progress aptly.Progress) error {
published *PublishedRepo, cleanComponents []string, collectionFactory *CollectionFactory, progress aptly.Progress) error {
var err error
collection.loadList()
storage := published.Storage
prefix := published.Prefix
distribution := published.Distribution
multiDist := published.MultiDist
rootPath := filepath.Join(prefix, "dists", distribution)
publishedStorage := publishedStorageProvider.GetPublishedStorage(published.Storage)
components := make([]string, 0, len(addedComponents)+len(updatedComponents)+len(removedComponents))
components = append(append(append(components, addedComponents...), updatedComponents...), removedComponents...)
sort.Strings(components)
sort.Strings(cleanComponents)
publishedComponents := published.Components()
removedComponents := utils.StrSlicesSubstract(cleanComponents, publishedComponents)
updatedComponents := utils.StrSlicesSubstract(cleanComponents, removedComponents)
if progress != nil {
progress.Printf("Cleaning up published repository %s/%s...\n", published.StoragePrefix(), distribution)
}
for _, component := range removedComponents {
if progress != nil {
progress.Printf("Removing component %q from prefix %q...\n", component, prefix)
progress.Printf("Removing component '%s'...\n", component)
}
err := publishedStorage.RemoveDirs(filepath.Join(prefix, "dists", distribution, component), progress)
err = publishedStorage.RemoveDirs(filepath.Join(rootPath, component), progress)
if err != nil {
return err
}
if multiDist {
for _, component := range removedComponents {
err = publishedStorage.RemoveDirs(filepath.Join(prefix, "pool", distribution, component), progress)
// Ensure that component does not exist in multi distribution pool
err = publishedStorage.RemoveDirs(filepath.Join(prefix, "pool", distribution, component), nil)
if err != nil {
return err
}
}
referencedFiles := map[string][]string{}
if published.MultiDist {
rootPath = filepath.Join(prefix, "pool", distribution)
// Get all referenced files by component for determining orphaned pool files.
for _, component := range publishedComponents {
packageList, err := NewPackageListFromRefList(published.RefList(component), collectionFactory.PackageCollection(), progress)
if err != nil {
return err
}
packageList.ForEach(func(p *Package) error {
poolDir, err := p.PoolDirectory()
if err != nil {
return err
}
for _, file := range p.Files() {
referencedFiles[component] = append(referencedFiles[component], filepath.Join(poolDir, file.Filename))
}
return nil
})
}
} else {
rootPath = filepath.Join(prefix, "pool")
// In case of a shared component pool directory, we must check, if a component is no longer referenced by any other
// published repository within the same prefix.
referencedComponents := map[string]struct{}{}
for _, p := range collection.list {
if p.Prefix == prefix && p.Storage == storage && !p.MultiDist {
for _, component := range p.Components() {
referencedComponents[component] = struct{}{}
}
}
}
// Remove orphaned component pool directories in the prefix.
for _, component := range removedComponents {
_, exists := referencedComponents[component]
if !exists {
err := publishedStorage.RemoveDirs(filepath.Join(rootPath, component), progress)
if err != nil {
return err
}
}
}
// Get all referenced files by component for determining orphaned pool files.
referencedFiles, err = collection.listReferencedFilesByComponent(prefix, publishedComponents, collectionFactory, progress)
if err != nil {
return err
}
}
components = make([]string, 0, len(updatedComponents)+len(removedComponents))
components = append(append(components, addedComponents...), updatedComponents...)
referencedFiles, err := collection.listReferencedFilesByComponent(prefix, components, collectionFactory, progress)
if err != nil {
return err
}
for _, component := range components {
for _, component := range updatedComponents {
if progress != nil {
progress.Printf("Cleaning up component %q in prefix %q...\n", component, prefix)
progress.Printf("Cleaning up component '%s'...\n", component)
}
sort.Strings(referencedFiles[component])
rootPath := filepath.Join(prefix, "pool", component)
existingFiles, err := publishedStorage.Filelist(rootPath)
path := filepath.Join(rootPath, component)
existingFiles, err := publishedStorage.Filelist(path)
if err != nil {
return err
}
sort.Strings(existingFiles)
filesToDelete := utils.StrSlicesSubstract(existingFiles, referencedFiles[component])
orphanedFiles := utils.StrSlicesSubstract(existingFiles, referencedFiles[component])
for _, file := range filesToDelete {
err = publishedStorage.Remove(filepath.Join(rootPath, file))
for _, file := range orphanedFiles {
err = publishedStorage.Remove(filepath.Join(path, file))
if err != nil {
return err
}
}
}
return nil
return err
}
// Remove removes published repository, cleaning up directories, files
@@ -1579,8 +1633,7 @@ func (collection *PublishedRepoCollection) Remove(publishedStorageProvider aptly
nil, collection.list[len(collection.list)-1], collection.list[:len(collection.list)-1]
if !skipCleanup && len(cleanComponents) > 0 {
err = collection.CleanupPrefixComponentFiles(publishedStorageProvider, repo, []string{}, cleanComponents, []string{},
collectionFactory, progress)
err = collection.CleanupPrefixComponentFiles(publishedStorageProvider, repo, cleanComponents, collectionFactory, progress)
if err != nil {
if !force {
return fmt.Errorf("cleanup failed, use -force-drop to override: %s", err)

View File

@@ -2,6 +2,7 @@ package deb
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
@@ -359,6 +360,25 @@ func (s *PublishedRepoSuite) TestDistributionComponentGuessing(c *C) {
c.Check(err, ErrorMatches, "duplicate component name: main")
}
func (s *PublishedRepoSuite) TestUpdate(c *C) {
revision := s.repo2.ObtainRevision()
sources := revision.Sources
sources["test"] = "local1"
result, err := s.repo2.Update(s.factory, nil)
c.Assert(err, IsNil)
c.Assert(result, NotNil)
c.Assert(s.repo2.Revision, IsNil)
c.Assert(result.AddedSources, DeepEquals, map[string]string{"test": "local1"})
c.Assert(result.UpdatedSources, DeepEquals, map[string]string{"main": "local1"})
c.Assert(result.RemovedSources, DeepEquals, map[string]string{})
c.Assert(result.AddedComponents(), DeepEquals, []string{"test"})
c.Assert(result.UpdatedComponents(), DeepEquals, []string{"main"})
c.Assert(result.RemovedComponents(), DeepEquals, []string{})
}
func (s *PublishedRepoSuite) TestPublish(c *C) {
err := s.repo.Publish(s.packagePool, s.provider, s.factory, &NullSigner{}, nil, false)
c.Assert(err, IsNil)
@@ -489,6 +509,30 @@ func (s *PublishedRepoSuite) TestEncodeDecode(c *C) {
c.Assert(repo2, DeepEquals, s.repo2)
}
func (s *PublishedRepoSuite) TestPublishedRepoRevision(c *C) {
revision := s.repo2.ObtainRevision()
c.Assert(revision, NotNil)
sources := revision.Sources
c.Assert(sources, NotNil)
c.Assert(sources, DeepEquals, map[string]string{"main": "local1"})
sources["test1"] = "snap1"
sources["test2"] = "snap2"
c.Assert(revision.Components(), DeepEquals, []string{"main", "test1", "test2"})
c.Assert(revision.SourceNames(), DeepEquals, []string{"local1", "snap1", "snap2"})
bytes, err := json.Marshal(revision)
c.Assert(err, IsNil)
json_expected := `{"Sources":[{"Component":"main","Name":"local1"},{"Component":"test1","Name":"snap1"},{"Component":"test2","Name":"snap2"}]}`
c.Assert(string(bytes), Equals, json_expected)
c.Assert(s.repo2.DropRevision(), DeepEquals, revision)
c.Assert(s.repo2.Revision, IsNil)
}
type PublishedRepoCollectionSuite struct {
PackageListMixinSuite
db database.Storage

View File

@@ -18,7 +18,7 @@ Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/d
Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/debian/bullseye-cran40/rkward-dbgsym_0.7.5-1~bullseyecran.0_i386.deb
Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/debian/bullseye-cran40/rkward_0.7.5-1~bullseyecran.0_amd64.deb
Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/debian/bullseye-cran40/rkward_0.7.5-1~bullseyecran.0_i386.deb
Mirror `flat-src` has been successfully updated.
Mirror `flat-src` has been updated successfully.
Packages filtered: 110 -> 11.
gpgv: using RSA key 7BA040A510E4E66ED3743EC1B8F25A8A73EACF41
gpgv: Good signature from "Johannes Ranke <johannes.ranke@jrwb.de>"

View File

@@ -13,7 +13,7 @@ Downloading: http://repo.aptly.info/system-tests/snapshot.debian.org/archive/deb
Downloading: http://repo.aptly.info/system-tests/snapshot.debian.org/archive/debian/20220201T025006Z/pool/main/s/sensible-utils/sensible-utils_0.0.9+deb9u1_all.deb
Downloading: http://repo.aptly.info/system-tests/snapshot.debian.org/archive/debian/20220201T025006Z/pool/main/s/sysvinit/sysvinit-utils_2.88dsf-59.9_i386.deb
Error (retrying): HTTP code 404 while fetching http://repo.aptly.info/system-tests/snapshot.debian.org/archive/debian/20220201T025006Z/dists/stretch/InRelease
Mirror `stretch-main` has been successfully updated.
Mirror `stretch-main` has been updated successfully.
Packages filtered: 50604 -> 3.
Retrying 0 http://repo.aptly.info/system-tests/snapshot.debian.org/archive/debian/20220201T025006Z/dists/stretch/InRelease...
gpgv: issuer "debian-release@lists.debian.org"

View File

@@ -37,7 +37,7 @@ Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archi
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/pool/main/g/gnupg2/scdaemon_2.1.18-8~deb9u4_amd64.deb
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/pool/main/g/gnupg2/scdaemon_2.1.18-8~deb9u4_i386.deb
Error (retrying): HTTP code 404 while fetching http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/InRelease
Mirror `stretch` has been successfully updated.
Mirror `stretch` has been updated successfully.
Packages filtered: 78248 -> 20.
Retrying 0 http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/InRelease...
gpgv: issuer "debian-release@lists.debian.org"

View File

@@ -58,4 +58,4 @@ Downloading: http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/va
Downloading: http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/pool/wheezy/main/v/varnish/varnish-dbg_3.0.3-1~wheezy_i386.deb
Downloading: http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/pool/wheezy/main/v/varnish/varnish_3.0.3-1~wheezy_amd64.deb
Downloading: http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/pool/wheezy/main/v/varnish/varnish_3.0.3-1~wheezy_i386.deb
Mirror `varnish` has been successfully updated.
Mirror `varnish` has been updated successfully.

View File

@@ -6,4 +6,4 @@ Downloading & parsing package files...
Downloading: http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/dists/wheezy/Release
Downloading: http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/dists/wheezy/main/binary-amd64/Packages.bz2
Downloading: http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/dists/wheezy/main/binary-i386/Packages.bz2
Mirror `varnish` has been successfully updated.
Mirror `varnish` has been updated successfully.

View File

@@ -6,4 +6,4 @@ Downloading & parsing package files...
Downloading https://dl.bintray.com/smira/deb/Packages.bz2...
Downloading https://dl.bintray.com/smira/deb/Release...
Downloading https://dl.bintray.com/smira/deb/libboost-program-options-dev_1.49.0.1_i386.deb...
Mirror `bintray` has been successfully updated.
Mirror `bintray` has been updated successfully.

View File

@@ -6,4 +6,4 @@ Downloading & parsing package files...
Downloading https://dl.bintray.com/smira/deb/Packages.bz2...
Downloading https://dl.bintray.com/smira/deb/Release...
Downloading https://dl.bintray.com/smira/deb/libboost-program-options-dev_1.49.0.1_i386.deb...
Mirror `bintray` has been successfully updated.
Mirror `bintray` has been updated successfully.

View File

@@ -6,5 +6,5 @@ Download queue: 0 items (0 B)
Downloading & parsing package files...
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/Release
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/main/binary-i386/Packages.gz
Mirror `stretch` has been successfully updated.
Mirror `stretch` has been updated successfully.
Packages filtered: 50604 -> 1.

View File

@@ -7,5 +7,5 @@ Downloading & parsing package files...
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/Release
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/main/binary-i386/Packages.gz
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/pool/main/b/boost-defaults/libboost-program-options-dev_1.62.0.1_i386.deb
Mirror `stretch` has been successfully updated.
Mirror `stretch` has been updated successfully.
Packages filtered: 50604 -> 1.

View File

@@ -12,4 +12,4 @@ Downloading: http://repo.aptly.info/system-tests/packages.pagerduty.com/pdagent/
Building download queue...
Download queue: 23 items (3.46 MiB)
Mirror `pagerduty` has been successfully updated.
Mirror `pagerduty` has been updated successfully.

View File

@@ -58,4 +58,4 @@ Downloading: http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/va
Downloading: http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/pool/wheezy/main/v/varnish/varnish-dbg_3.0.3-1~wheezy_i386.deb
Downloading: http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/pool/wheezy/main/v/varnish/varnish_3.0.3-1~wheezy_amd64.deb
Downloading: http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/pool/wheezy/main/v/varnish/varnish_3.0.3-1~wheezy_i386.deb
Mirror `varnish` has been successfully updated.
Mirror `varnish` has been updated successfully.

View File

@@ -8,7 +8,7 @@ Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/d
Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/debian/bullseye-cran40/Packages.bz2
Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/debian/bullseye-cran40/r-cran-class_7.3-22-2~bullseyecran.0_amd64.deb
Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/debian/bullseye-cran40/r-cran-class_7.3-22-2~bullseyecran.0_i386.deb
Mirror `flat` has been successfully updated.
Mirror `flat` has been updated successfully.
Packages filtered: 89 -> 2.
openpgp: Good signature from "Johannes Ranke <johannes.ranke@jrwb.de>"
openpgp: RSA key ID B8F25A8A73EACF41

View File

@@ -11,4 +11,4 @@ Downloading: http://repo.aptly.info/system-tests/packages.pagerduty.com/pdagent/
Building download queue...
Download queue: 23 items (3.46 MiB)
Mirror `pagerduty` has been successfully updated.
Mirror `pagerduty` has been updated successfully.

View File

@@ -8,4 +8,4 @@ Applying filter...
Building download queue...
Download queue: 0 items (0 B)
Mirror `libnvidia-container` has been successfully updated.
Mirror `libnvidia-container` has been updated successfully.

View File

@@ -23,7 +23,7 @@ Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archi
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/non-free/installer-s390x/current/images/SHA256SUMS
Error (retrying): HTTP code 404 while fetching http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/InRelease
Error (retrying): HTTP code 404 while fetching http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/non-free/installer-s390x/current/images/SHA256SUMS
Mirror `stretch` has been successfully updated.
Mirror `stretch` has been updated successfully.
Packages filtered: 49256 -> 1.
Retrying 0 http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/InRelease...
Retrying 0 http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/non-free/installer-s390x/current/images/SHA256SUMS...

View File

@@ -53,7 +53,7 @@ Downloading: http://repo.aptly.info/system-tests/us.archive.ubuntu.com/ubuntu/di
Downloading: http://repo.aptly.info/system-tests/us.archive.ubuntu.com/ubuntu/dists/trusty/restricted/installer-amd64/current/images/SHA256SUMS
Error (retrying): HTTP code 404 while fetching http://repo.aptly.info/system-tests/us.archive.ubuntu.com/ubuntu/dists/trusty/InRelease
Error (retrying): HTTP code 404 while fetching http://repo.aptly.info/system-tests/us.archive.ubuntu.com/ubuntu/dists/trusty/restricted/installer-amd64/current/images/SHA256SUMS
Mirror `trusty` has been successfully updated.
Mirror `trusty` has been updated successfully.
Packages filtered: 8616 -> 1.
Retrying 0 http://repo.aptly.info/system-tests/us.archive.ubuntu.com/ubuntu/dists/trusty/InRelease...
Retrying 0 http://repo.aptly.info/system-tests/us.archive.ubuntu.com/ubuntu/dists/trusty/restricted/installer-amd64/current/images/SHA256SUMS...

View File

@@ -14,7 +14,7 @@ Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archi
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/main/binary-i386/Packages.gz
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/pool/main/b/boost-defaults/libboost-program-options-dev_1.62.0.1_i386.deb
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/pool/main/b/boost-defaults/libboost-program-options-dev_1.62.0.1_i386.deb
Mirror `grab` has been successfully updated.
Mirror `grab` has been updated successfully.
Packages filtered: 50604 -> 1.
Retrying 0 http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/InRelease
Retrying 0 http://repo.aptly.info/system-tests/archive.debian.org/debian-archive/debian/dists/stretch/InRelease

View File

@@ -18,4 +18,4 @@ Download queue: 1 items (30 B)
Downloading: ${url}pool/main/a/amanda/amanda-client_3.3.1-3~bpo60+1_amd64.deb
WARNING: ${url}pool/main/a/amanda/amanda-client_3.3.1-3~bpo60+1_amd64.deb: sha1 hash mismatch "8d3a014000038725d6daf8771b42a0784253688f" != "66b27417d37e024c46526c2f6d358a754fc552f3"
Mirror `failure` has been successfully updated.
Mirror `failure` has been updated successfully.

View File

@@ -94,7 +94,7 @@ Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/d
Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/debian/bullseye-cran40/rkward-dbgsym_0.7.5-1~bullseyecran.0_i386.deb
Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/debian/bullseye-cran40/rkward_0.7.5-1~bullseyecran.0_amd64.deb
Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/debian/bullseye-cran40/rkward_0.7.5-1~bullseyecran.0_i386.deb
Mirror `flat` has been successfully updated.
Mirror `flat` has been updated successfully.
gpgv: using RSA key 7BA040A510E4E66ED3743EC1B8F25A8A73EACF41
gpgv: Good signature from "Johannes Ranke <johannes.ranke@jrwb.de>"
gpgv: Signature made Thu Nov 2 07:43:52 2023 UTC

View File

@@ -15,4 +15,4 @@ Downloading: http://repo.aptly.info/system-tests/ppa.launchpad.net/gladky-anton/
Building download queue...
Download queue: 0 items (0 B)
Mirror `gnuplot-maverick-src` has been successfully updated.
Mirror `gnuplot-maverick-src` has been updated successfully.

View File

@@ -157,7 +157,7 @@ Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/d
Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/debian/bullseye-cran40/survival_3.5-7-1~bullseyecran.0.debian.tar.xz
Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/debian/bullseye-cran40/survival_3.5-7-1~bullseyecran.0.dsc
Downloading: http://repo.aptly.info/system-tests/cloud.r-project.org/bin/linux/debian/bullseye-cran40/survival_3.5-7.orig.tar.gz
Mirror `flat-src` has been successfully updated.
Mirror `flat-src` has been updated successfully.
gpgv: using RSA key 7BA040A510E4E66ED3743EC1B8F25A8A73EACF41
gpgv: Good signature from "Johannes Ranke <johannes.ranke@jrwb.de>"
gpgv: Signature made Thu Nov 2 07:43:52 2023 UTC

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository azure:test1:./maverick...
Cleaning up component 'main'...
Published local repository azure:test1:./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.
Published local repository azure:test1:./maverick [i386, source] publishes {main: [local-repo]} has been updated successfully.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository azure:test1:./maverick...
Cleaning up component 'main'...
Published snapshot repository azure:test1:./maverick (origin: LP-PPA-gladky-anton-gnuplot) [amd64, i386] publishes {main: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'} has been successfully switched to new source.

View File

@@ -1,3 +1,4 @@
Cleaning up prefix "." components main...
Cleaning up published repository azure:test1:./sq2...
Cleaning up component 'main'...
Published repository has been removed successfully.

View File

@@ -1,4 +1,5 @@
Removing ${HOME}/.aptly/public/dists/sq1...
Cleaning up prefix "." components main...
Cleaning up published repository ./sq1...
Cleaning up component 'main'...
Published repository has been removed successfully.

View File

@@ -1,4 +1,5 @@
Removing ${HOME}/.aptly/public/dists/sq2...
Cleaning up prefix "." components main...
Cleaning up published repository ./sq2...
Cleaning up component 'main'...
Published repository has been removed successfully.

View File

@@ -1,4 +1,5 @@
Removing ${HOME}/.aptly/public/dists/sq1...
Cleaning up prefix "." components main...
Cleaning up published repository ./sq1...
Cleaning up component 'main'...
Published repository has been removed successfully.

View File

@@ -0,0 +1,5 @@
Prefix: .
Distribution: wheezy
Architectures: i386
Sources:
main: local-repo [local]

View File

@@ -0,0 +1,13 @@
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Snapshot snap1 has been successfully published.
Please setup your webserver to serve directory '${HOME}/.aptly/public' with autoindexing.
Now you can add following line to apt sources:
deb http://your-server/ maverick main
Don't forget to add your GPG key to apt with apt-key.
You can also use `aptly serve` to publish your repositories over HTTP quickly.

View File

@@ -1,3 +1,3 @@
Adding component "test" with source "snap2" [snapshot]...
Adding component 'test' with source 'snap2' [snapshot]...
You can run 'aptly publish update maverick .' to update the content of the published repository.

View File

@@ -1,4 +1,4 @@
Adding component "test" with source "snap2" [snapshot]...
Adding component "other-test" with source "snap3" [snapshot]...
Adding component 'test' with source 'snap2' [snapshot]...
Adding component 'other-test' with source 'snap3' [snapshot]...
You can run 'aptly publish update maverick .' to update the content of the published repository.

View File

@@ -1 +1 @@
ERROR: unable to add: component "main" has already been added
ERROR: unable to add: component 'main' has already been added

View File

@@ -1,3 +1,3 @@
Removing component "test" with source "snap2" [snapshot]...
Removing component 'test' with source 'snap2' [snapshot]...
You can run 'aptly publish update maverick .' to update the content of the published repository.

View File

@@ -1,4 +1,4 @@
Removing component "test" with source "snap2" [snapshot]...
Removing component "other-test" with source "snap3" [snapshot]...
Removing component 'test' with source 'snap2' [snapshot]...
Removing component 'other-test' with source 'snap3' [snapshot]...
You can run 'aptly publish update maverick .' to update the content of the published repository.

View File

@@ -1 +1 @@
ERROR: unable to remove: component "not-existent" does not exist
ERROR: unable to remove: component 'not-existent' does not exist

View File

@@ -1,3 +1,3 @@
Updating component "main" with source "snap2" [snapshot]...
Updating component 'main' with source 'snap2' [snapshot]...
You can run 'aptly publish update maverick .' to update the content of the published repository.

View File

@@ -1,4 +1,4 @@
Updating component "main" with source "snap2" [snapshot]...
Updating component "test" with source "snap3" [snapshot]...
Updating component 'main' with source 'snap2' [snapshot]...
Updating component 'test' with source 'snap3' [snapshot]...
You can run 'aptly publish update maverick .' to update the content of the published repository.

View File

@@ -1 +1 @@
ERROR: unable to update: component "not-existent" does not exist
ERROR: unable to update: component 'not-existent' does not exist

View File

@@ -5,6 +5,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository ./maverick...
Cleaning up component 'main'...
Published snapshot repository ./maverick [i386, source] publishes {main: [snap2]: Snapshot from local repo [local-repo2]} has been successfully switched to new source.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository ./maverick...
Cleaning up component 'main'...
Published snapshot repository ./maverick (origin: LP-PPA-gladky-anton-gnuplot) [amd64, i386] publishes {main: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'} has been successfully switched to new source.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository ./maverick...
Cleaning up component 'main'...
Published snapshot repository ./maverick (origin: LP-PPA-gladky-anton-gnuplot) [amd64, i386] publishes {main: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'} has been successfully switched to new source.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository ./bookworm...
Cleaning up component 'main'...
Published snapshot repository ./bookworm (origin: LP-PPA-gladky-anton-gnuplot) [amd64, i386] publishes {main: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'} has been successfully switched to new source.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository ./maverick...
Cleaning up component 'main'...
Published snapshot repository ./maverick (origin: LP-PPA-gladky-anton-gnuplot) [amd64, i386] publishes {main: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'} has been successfully switched to new source.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "ppa" components main...
Cleaning up published repository ppa/maverick...
Cleaning up component 'main'...
Published snapshot repository ppa/maverick [amd64, i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick} has been successfully switched to new source.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository ./maverick...
Cleaning up component 'main'...
Published snapshot repository ./maverick (origin: LP-PPA-gladky-anton-gnuplot) [amd64, i386] publishes {main: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'} has been successfully switched to new source.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "ppa" components main...
Cleaning up published repository ppa/maverick...
Cleaning up component 'main'...
Published snapshot repository ppa/maverick [i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick} has been successfully switched to new source.

View File

@@ -3,6 +3,8 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components b, c...
Cleaning up published repository ./maverick...
Cleaning up component 'b'...
Cleaning up component 'c'...
Published snapshot repository ./maverick [amd64, i386, source] publishes {a: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {b: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'}, {c: [local2]: Snapshot from local repo [local-repo]} has been successfully switched to new source.

View File

@@ -5,6 +5,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository ./maverick...
Cleaning up component 'main'...
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been updated successfully.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository ./maverick...
Cleaning up component 'main'...
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been updated successfully.

View File

@@ -4,4 +4,4 @@ Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been updated successfully.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository ./maverick...
Cleaning up component 'main'...
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been updated successfully.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository ./bookworm...
Cleaning up component 'main'...
Published local repository ./bookworm [i386, source] publishes {main: [local-repo]} has been successfully updated.
Published local repository ./bookworm [i386, source] publishes {main: [local-repo]} has been updated successfully.

View File

@@ -3,6 +3,6 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components ...
Cleaning up published repository ./maverick...
Published snapshot repository ./maverick (origin: LP-PPA-gladky-anton-gnuplot) [i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {other-test: [snap3]: Created as empty}, {test: [snap2]: Created as empty} has been successfully updated.
Published snapshot repository ./maverick (origin: LP-PPA-gladky-anton-gnuplot) [i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {other-test: [snap3]: Created as empty}, {test: [snap2]: Created as empty} has been updated successfully.

View File

@@ -3,6 +3,12 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components ...
Cleaning up published repository ./maverick...
Removing component 'other-test'...
Removing ${HOME}/.aptly/public/dists/maverick/other-test...
Removing component 'test'...
Removing ${HOME}/.aptly/public/dists/maverick/test...
Removing ${HOME}/.aptly/public/pool/other-test...
Removing ${HOME}/.aptly/public/pool/test...
Published snapshot repository ./maverick [i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick} has been successfully updated.
Published snapshot repository ./maverick [i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick} has been updated successfully.

View File

@@ -3,6 +3,8 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components other-test, test...
Cleaning up published repository ./maverick...
Cleaning up component 'other-test'...
Cleaning up component 'test'...
Published snapshot repository ./maverick [i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {other-test: [snap5]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {test: [snap4]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick} has been successfully updated.
Published snapshot repository ./maverick [i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {other-test: [snap5]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {test: [snap4]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick} has been updated successfully.

View File

@@ -3,6 +3,10 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components test...
Cleaning up published repository ./maverick...
Removing component 'main'...
Removing ${HOME}/.aptly/public/dists/maverick/main...
Removing ${HOME}/.aptly/public/pool/main...
Cleaning up component 'test'...
Published snapshot repository ./maverick [i386] publishes {other-test: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {test: [snap3]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick} has been successfully updated.
Published snapshot repository ./maverick [i386] publishes {other-test: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {test: [snap3]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick} has been updated successfully.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository ./maverick...
Cleaning up component 'main'...
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been updated successfully.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository ./maverick...
Cleaning up component 'main'...
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been updated successfully.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository ./maverick...
Cleaning up component 'main'...
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.
Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been updated successfully.

View File

@@ -3,6 +3,6 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up component 'main' in prefix '.'...
Published local repository ./maverick [source] publishes {main: [local-repo]} has been successfully updated.
Published local repository ./maverick [source] publishes {main: [local-repo]} has been updated successfully.

View File

@@ -3,6 +3,8 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components contrib, main...
Cleaning up published repository ./maverick...
Cleaning up component 'contrib'...
Cleaning up component 'main'...
Published local repository ./maverick [i386, source] publishes {contrib: [repo2]}, {main: [repo1]} has been successfully updated.
Published local repository ./maverick [i386, source] publishes {contrib: [repo2]}, {main: [repo1]} has been updated successfully.

View File

@@ -1,6 +1,8 @@
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
Cleaning up prefix "." components contrib, main...
Cleaning up published repository ./squeeze...
Cleaning up component 'contrib'...
Cleaning up component 'main'...
Published local repository ./squeeze [i386] publishes {contrib: [repo2]}, {main: [repo1]} has been successfully updated.
Published local repository ./squeeze [i386] publishes {contrib: [repo2]}, {main: [repo1]} has been updated successfully.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository s3:test1:./maverick...
Cleaning up component 'main'...
Published local repository s3:test1:./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.
Published local repository s3:test1:./maverick [i386, source] publishes {main: [local-repo]} has been updated successfully.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository s3:test1:./maverick...
Cleaning up component 'main'...
Published snapshot repository s3:test1:./maverick (origin: LP-PPA-gladky-anton-gnuplot) [amd64, i386] publishes {main: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'} has been successfully switched to new source.

View File

@@ -1,3 +1,4 @@
Cleaning up prefix "." components main...
Cleaning up published repository s3:test1:./sq2...
Cleaning up component 'main'...
Published repository has been removed successfully.

View File

@@ -3,6 +3,7 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up published repository s3:test1:./maverick...
Cleaning up component 'main'...
Published local repository s3:test1:./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.
Published local repository s3:test1:./maverick [i386, source] publishes {main: [local-repo]} has been updated successfully.

View File

@@ -3,6 +3,6 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up prefix '.' components main...
Published local repository swift:test1:./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.
Published local repository swift:test1:./maverick [i386, source] publishes {main: [local-repo]} has been updated successfully.

View File

@@ -3,6 +3,6 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components main...
Cleaning up prefix '.' components main...
Published snapshot repository swift:test1:./maverick (origin: LP-PPA-gladky-anton-gnuplot) [amd64, i386] publishes {main: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'} has been successfully switched to new snapshot.

View File

@@ -1,3 +1,3 @@
Cleaning up prefix "." components main...
Cleaning up prefix '.' components main...
Published repository has been removed successfully.

View File

@@ -51,3 +51,17 @@ class PublishShow4Test(BaseTest):
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1 ppa/smira",
]
runCmd = "aptly publish show -json maverick ppa/smira"
class PublishShow5Test(BaseTest):
"""
publish show: existing local repo
"""
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly repo create -distribution=wheezy local-repo",
"aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -architectures=i386 local-repo"
]
runCmd = "aptly publish show wheezy"
gold_processor = BaseTest.expand_environ

View File

@@ -1344,3 +1344,23 @@ class PublishSnapshot41Test(BaseTest):
self.check_exists('public/pool/main/libx/libxslt/libxslt1.1_1.1.32-2.2~deb10u2_i386.deb')
self.check_exists('public/pool/main/libz/libzstd/libzstd1_1.3.8+dfsg-3+deb10u2_i386.deb')
self.check_exists('public/pool/main/z/zlib/zlib1g_1.2.11.dfsg-1+deb10u2_i386.deb')
class PublishSnapshot42Test(BaseTest):
"""
publish snapshot: mirror with multi-dist
"""
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror gnuplot-maverick",
]
runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -multi-dist snap1"
gold_processor = BaseTest.expand_environ
def check(self):
super(PublishSnapshot42Test, self).check()
self.check_not_exists(
'public/pool/main/g/gnuplot/gnuplot-doc_4.6.1-1~maverick2_all.deb')
self.check_exists(
'public/pool/maverick/main/g/gnuplot/gnuplot-doc_4.6.1-1~maverick2_all.deb')

View File

@@ -1,4 +1,5 @@
Removing ${HOME}/.aptly/public/dists/def...
Cleaning up prefix "." components main...
Cleaning up published repository ./def...
Cleaning up component 'main'...
Published repository has been removed successfully.

View File

@@ -1402,6 +1402,58 @@ class PublishSourcesListAPITestRepo(APITest):
self.check_equal(sources_expected, sources.json())
class PublishSourceReplaceAPITestRepo(APITest):
"""
PUT /publish/:prefix/:distribution/sources/main
"""
fixtureGpg = True
def check(self):
repo1_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo1_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc",
"pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz",
"pyspi-0.6.1-1.3.stripped.dsc").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo1_name + "/file/" + d).status_code, 200)
repo2_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo2_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo2_name + "/file/" + d).status_code, 200)
# publishing under prefix, default distribution
prefix = self.random_name()
self.check_equal(self.post(
"/api/publish/" + prefix,
json={
"SourceKind": "local",
"Sources": [{"Component": "main", "Name": repo1_name}],
"Signing": DefaultSigningOptions,
}
).status_code, 201)
# Actual test
self.check_equal(self.put(
"/api/publish/" + prefix + "/wheezy/sources/main",
json={"Component": "test", "Name": repo2_name}
).status_code, 200)
sources_expected = [{"Component": "test", "Name": repo2_name}]
sources = self.get("/api/publish/" + prefix + "/wheezy/sources")
self.check_equal(sources.status_code, 200)
self.check_equal(sources_expected, sources.json())
class PublishUpdateSourcesAPITestRepo(APITest):
"""
POST /publish/:prefix/:distribution/update