mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-11 03:11:50 +00:00
System test for repo adding .udebs. #108
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -155,6 +155,7 @@ class BaseTest(object):
|
||||
if not hasattr(command, "__iter__"):
|
||||
params = {
|
||||
'files': os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files"),
|
||||
'udebs': os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "udebs"),
|
||||
'testfiles': os.path.join(os.path.dirname(inspect.getsourcefile(self.__class__)), self.__class__.__name__),
|
||||
}
|
||||
if self.fixtureWebServer:
|
||||
|
||||
2
system/t09_repo/AddRepo12Test_gold
Normal file
2
system/t09_repo/AddRepo12Test_gold
Normal file
@@ -0,0 +1,2 @@
|
||||
Loading packages...
|
||||
[+] dmraid-udeb_1.0.0.rc16-4.1_amd64 added
|
||||
7
system/t09_repo/AddRepo12Test_repo_show
Normal file
7
system/t09_repo/AddRepo12Test_repo_show
Normal file
@@ -0,0 +1,7 @@
|
||||
Name: repo12
|
||||
Comment: Repo12
|
||||
Default Distribution: squeeze
|
||||
Default Component: main
|
||||
Number of packages: 1
|
||||
Packages:
|
||||
dmraid-udeb_1.0.0.rc16-4.1_amd64
|
||||
6
system/t09_repo/AddRepo13Test_gold
Normal file
6
system/t09_repo/AddRepo13Test_gold
Normal file
@@ -0,0 +1,6 @@
|
||||
Loading packages...
|
||||
[+] libboost-program-options-dev_1.49.0.1_i386 added
|
||||
[+] pyspi_0.6.1-1.4_source added
|
||||
[+] pyspi_0.6.1-1.3_source added
|
||||
[+] dmraid-udeb_1.0.0.rc16-4.1_amd64 added
|
||||
[+] dmraid-udeb_1.0.0.rc16-4.1_i386 added
|
||||
11
system/t09_repo/AddRepo13Test_repo_show
Normal file
11
system/t09_repo/AddRepo13Test_repo_show
Normal file
@@ -0,0 +1,11 @@
|
||||
Name: repo13
|
||||
Comment: Repo13
|
||||
Default Distribution: squeeze
|
||||
Default Component: main
|
||||
Number of packages: 5
|
||||
Packages:
|
||||
dmraid-udeb_1.0.0.rc16-4.1_amd64
|
||||
dmraid-udeb_1.0.0.rc16-4.1_i386
|
||||
libboost-program-options-dev_1.49.0.1_i386
|
||||
pyspi_0.6.1-1.3_source
|
||||
pyspi_0.6.1-1.4_source
|
||||
@@ -232,3 +232,38 @@ class AddRepo11Test(BaseTest):
|
||||
def check(self):
|
||||
self.check_output()
|
||||
self.check_cmd_output("aptly repo show -with-packages repo11", "repo_show")
|
||||
|
||||
|
||||
class AddRepo12Test(BaseTest):
|
||||
"""
|
||||
add package to local repo: .udeb file
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create -comment=Repo12 -distribution=squeeze repo12",
|
||||
]
|
||||
runCmd = "aptly repo add repo12 ${udebs}/dmraid-udeb_1.0.0.rc16-4.1_amd64.udeb"
|
||||
|
||||
def check(self):
|
||||
self.check_output()
|
||||
self.check_cmd_output("aptly repo show -with-packages repo12", "repo_show")
|
||||
|
||||
# check pool
|
||||
self.check_exists('pool/72/16/dmraid-udeb_1.0.0.rc16-4.1_amd64.udeb')
|
||||
|
||||
|
||||
class AddRepo13Test(BaseTest):
|
||||
"""
|
||||
add package to local repo: .udeb and .deb files
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create -comment=Repo13 -distribution=squeeze repo13",
|
||||
]
|
||||
runCmd = "aptly repo add repo13 ${udebs} ${files}"
|
||||
|
||||
def check(self):
|
||||
self.check_output()
|
||||
self.check_cmd_output("aptly repo show -with-packages repo13", "repo_show")
|
||||
|
||||
# check pool
|
||||
self.check_exists('pool/72/16/dmraid-udeb_1.0.0.rc16-4.1_amd64.udeb')
|
||||
self.check_exists('pool/b7/2c/pyspi_0.6.1-1.3.dsc')
|
||||
|
||||
BIN
system/udebs/dmraid-udeb_1.0.0.rc16-4.1_amd64.udeb
Normal file
BIN
system/udebs/dmraid-udeb_1.0.0.rc16-4.1_amd64.udeb
Normal file
Binary file not shown.
BIN
system/udebs/dmraid-udeb_1.0.0.rc16-4.1_i386.udeb
Normal file
BIN
system/udebs/dmraid-udeb_1.0.0.rc16-4.1_i386.udeb
Normal file
Binary file not shown.
Reference in New Issue
Block a user