System test for repo adding .udebs. #108

This commit is contained in:
Andrey Smirnov
2014-09-30 21:26:28 +04:00
parent 6514b87e3e
commit 2c84faaf8d
9 changed files with 74 additions and 5 deletions
+12 -5
View File
@@ -61,14 +61,16 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
return nil
}
if strings.HasSuffix(info.Name(), ".deb") || strings.HasSuffix(info.Name(), ".dsc") {
if strings.HasSuffix(info.Name(), ".deb") || strings.HasSuffix(info.Name(), ".udeb") ||
strings.HasSuffix(info.Name(), ".dsc") {
packageFiles = append(packageFiles, path)
}
return nil
})
} else {
if strings.HasSuffix(info.Name(), ".deb") || strings.HasSuffix(info.Name(), ".dsc") {
if strings.HasSuffix(info.Name(), ".deb") || strings.HasSuffix(info.Name(), ".udeb") ||
strings.HasSuffix(info.Name(), ".dsc") {
packageFiles = append(packageFiles, location)
} else {
context.Progress().ColoredPrintf("@y[!]@| @!Unknwon file extenstion: %s@|", location)
@@ -93,6 +95,7 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
candidateProcessedFiles := []string{}
isSourcePackage := strings.HasSuffix(file, ".dsc")
isUdebPackage := strings.HasSuffix(file, ".udeb")
if isSourcePackage {
stanza, err = deb.GetControlFileFromDsc(file, verifier)
@@ -105,7 +108,11 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
}
} else {
stanza, err = deb.GetControlFileFromDeb(file)
p = deb.NewPackageFromControlFile(stanza)
if isUdebPackage {
p = deb.NewUdebPackageFromControlFile(stanza)
} else {
p = deb.NewPackageFromControlFile(stanza)
}
}
if err != nil {
context.Progress().ColoredPrintf("@y[!]@| @!Unable to read file %s: %s@|", file, err)
@@ -216,8 +223,8 @@ func makeCmdRepoAdd() *commander.Command {
UsageLine: "add <name> <package file.deb>|<directory> ...",
Short: "add packages to local repository",
Long: `
Command adds packages to local repository from .deb (binary packages) and .dsc (source packages) files.
When importing from directory aptly would do recursive scan looking for all files matching *.deb or *.dsc
Command adds packages to local repository from .deb, .udeb (binary packages) and .dsc (source packages) files.
When importing from directory aptly would do recursive scan looking for all files matching *.[u]deb or *.dsc
patterns. Every file discovered would be analyzed to extract metadata, package would then be created and added
to the database. Files would be imported to internal package pool. For source packages, all required files are
added automatically as well. Extra files for source package should be in the same directory as *.dsc file.