MCPcopy Index your code
hub / github.com/aptly-dev/aptly / NewRemoteRepo

Function NewRemoteRepo

deb/remote.go:88–126  ·  view source on GitHub ↗

NewRemoteRepo creates new instance of Debian remote repository with specified params

(name string, archiveRoot string, distribution string, components []string,
	architectures []string, downloadSources bool, downloadUdebs bool, downloadInstaller bool, downloadAppStream bool)

Source from the content-addressed store, hash-verified

86
87// NewRemoteRepo creates new instance of Debian remote repository with specified params
88func NewRemoteRepo(name string, archiveRoot string, distribution string, components []string,
89 architectures []string, downloadSources bool, downloadUdebs bool, downloadInstaller bool, downloadAppStream bool) (*RemoteRepo, error) {
90 result := &RemoteRepo{
91 UUID: uuid.NewString(),
92 Name: name,
93 ArchiveRoot: archiveRoot,
94 Distribution: distribution,
95 Components: components,
96 Architectures: architectures,
97 DownloadSources: downloadSources,
98 DownloadUdebs: downloadUdebs,
99 DownloadInstaller: downloadInstaller,
100 DownloadAppStream: downloadAppStream,
101 }
102
103 err := result.prepare()
104 if err != nil {
105 return nil, err
106 }
107
108 if strings.HasSuffix(result.Distribution, "/") || strings.HasPrefix(result.Distribution, ".") {
109 // flat repo
110 if !strings.HasPrefix(result.Distribution, ".") {
111 result.Distribution = "./" + result.Distribution
112 }
113 if len(result.Components) > 0 {
114 return nil, fmt.Errorf("components aren't supported for flat repos")
115 }
116 if result.DownloadUdebs {
117 return nil, fmt.Errorf("debian-installer udebs aren't supported for flat repos")
118 }
119 if result.DownloadAppStream {
120 return nil, fmt.Errorf("AppStream (DEP-11) metadata isn't supported for flat repos")
121 }
122 result.Components = nil
123 }
124
125 return result, nil
126}
127
128// SetArchiveRoot of remote repo
129func (repo *RemoteRepo) SetArchiveRoot(archiveRoot string) {

Callers 15

aptlyMirrorCreateFunction · 0.92
apiMirrorsCreateFunction · 0.92
SetUpTestMethod · 0.85
TestInvalidURLMethod · 0.85
TestFlatCreationMethod · 0.85
TestAddByNameMethod · 0.85
TestByUUIDMethod · 0.85

Calls 2

prepareMethod · 0.95
HasPrefixMethod · 0.65

Tested by 15

SetUpTestMethod · 0.68
TestInvalidURLMethod · 0.68
TestFlatCreationMethod · 0.68
TestAddByNameMethod · 0.68
TestByUUIDMethod · 0.68
TestForEachAndLenMethod · 0.68
TestDropMethod · 0.68