mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-31 04:30:44 +00:00
Remove files only if whole package has been processed successfully.
This commit is contained in:
+6
-4
@@ -85,6 +85,7 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
|
|||||||
p *debian.Package
|
p *debian.Package
|
||||||
)
|
)
|
||||||
|
|
||||||
|
candidateProcessedFiles := []string{}
|
||||||
isSourcePackage := strings.HasSuffix(file, ".dsc")
|
isSourcePackage := strings.HasSuffix(file, ".dsc")
|
||||||
|
|
||||||
if isSourcePackage {
|
if isSourcePackage {
|
||||||
@@ -122,7 +123,7 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
processedFiles = append(processedFiles, file)
|
candidateProcessedFiles = append(candidateProcessedFiles, file)
|
||||||
|
|
||||||
// go over all files, except for the last one (.dsc/.deb itself)
|
// go over all files, except for the last one (.dsc/.deb itself)
|
||||||
for i := 0; i < len(p.Files)-1; i++ {
|
for i := 0; i < len(p.Files)-1; i++ {
|
||||||
@@ -133,7 +134,7 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
processedFiles = append(processedFiles, sourceFile)
|
candidateProcessedFiles = append(candidateProcessedFiles, sourceFile)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// some files haven't been imported
|
// some files haven't been imported
|
||||||
@@ -153,6 +154,7 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
context.progress.ColoredPrintf("@g[+]@| %s added@|", p)
|
context.progress.ColoredPrintf("@g[+]@| %s added@|", p)
|
||||||
|
processedFiles = append(processedFiles, candidateProcessedFiles...)
|
||||||
}
|
}
|
||||||
|
|
||||||
repo.UpdateRefList(debian.NewPackageRefListFromPackageList(list))
|
repo.UpdateRefList(debian.NewPackageRefListFromPackageList(list))
|
||||||
@@ -183,8 +185,8 @@ func makeCmdRepoAdd() *commander.Command {
|
|||||||
Short: "add packages to local repository",
|
Short: "add packages to local repository",
|
||||||
Long: `
|
Long: `
|
||||||
Command adds packages to local repository. List of files or directories to be
|
Command adds packages to local repository. List of files or directories to be
|
||||||
scanned could be specified. If importing from directory, all files matching *.deb and *.dsc
|
scanned could be specified. If importing from directory, all files matching *.deb or *.dsc
|
||||||
pattern would be scanned and added to the repository. For source packages, all required
|
patterns would be scanned and added to the repository. For source packages, all required
|
||||||
files are added as well automatically.
|
files are added as well automatically.
|
||||||
|
|
||||||
ex:
|
ex:
|
||||||
|
|||||||
Reference in New Issue
Block a user