Skip to content

Commit 93650ef

Browse files
authored
Merge pull request #1404 from schoenherrg/fix/with-sources-ignored
Fix `-with-sources` not fetching differently named source packages
2 parents d873278 + 5e91b10 commit 93650ef

16 files changed

Lines changed: 265 additions & 74 deletions

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ List of contributors, in chronological order:
6767
* Christoph Fiehe (https://github.com/cfiehe)
6868
* Blake Kostner (https://github.com/btkostner)
6969
* Leigh London (https://github.com/leighlondon)
70+
* Gordian Schönherr (https://github.com/schoenherrg)

api/api.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,13 @@ func showPackages(c *gin.Context, reflist *deb.PackageRefList, collectionFactory
266266

267267
list.PrepareIndex()
268268

269-
list, err = list.Filter([]deb.PackageQuery{q}, withDeps,
270-
nil, context.DependencyOptions(), architecturesList)
269+
list, err = list.Filter(deb.FilterOptions{
270+
Queries: []deb.PackageQuery{q},
271+
WithDependencies: withDeps,
272+
Source: nil,
273+
DependencyOptions: context.DependencyOptions(),
274+
Architectures: architecturesList,
275+
})
271276
if err != nil {
272277
AbortWithJSONError(c, 500, fmt.Errorf("unable to search: %s", err))
273278
return
@@ -283,8 +288,9 @@ func showPackages(c *gin.Context, reflist *deb.PackageRefList, collectionFactory
283288
fmt.Println("filter packages by version, query string parse err: ", err)
284289
c.AbortWithError(500, fmt.Errorf("unable to parse %s maximum version query string: %s", p.Name, err))
285290
} else {
286-
tmpList, err := list.Filter([]deb.PackageQuery{versionQ}, false,
287-
nil, 0, []string{})
291+
tmpList, err := list.Filter(deb.FilterOptions{
292+
Queries: []deb.PackageQuery{versionQ},
293+
})
288294

289295
if err == nil {
290296
if tmpList.Len() > 0 {

api/mirror.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,12 @@ func apiMirrorsPackages(c *gin.Context) {
307307

308308
list.PrepareIndex()
309309

310-
list, err = list.Filter([]deb.PackageQuery{q}, withDeps,
311-
nil, context.DependencyOptions(), architecturesList)
310+
list, err = list.Filter(deb.FilterOptions{
311+
Queries: []deb.PackageQuery{q},
312+
WithDependencies: withDeps,
313+
DependencyOptions: context.DependencyOptions(),
314+
Architectures: architecturesList,
315+
})
312316
if err != nil {
313317
AbortWithJSONError(c, 500, fmt.Errorf("unable to search: %s", err))
314318
}

api/repos.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,14 @@ func apiReposCopyPackage(c *gin.Context) {
712712
return &task.ProcessReturnValue{Code: http.StatusUnprocessableEntity, Value: nil}, fmt.Errorf("unable to parse query '%s': %s", fileName, err)
713713
}
714714

715-
toProcess, err := srcList.FilterWithProgress(queries, jsonBody.WithDeps, dstList, context.DependencyOptions(), architecturesList, context.Progress())
715+
toProcess, err := srcList.Filter(deb.FilterOptions{
716+
Queries: queries,
717+
WithDependencies: jsonBody.WithDeps,
718+
Source: dstList,
719+
DependencyOptions: context.DependencyOptions(),
720+
Architectures: architecturesList,
721+
Progress: context.Progress(),
722+
})
716723
if err != nil {
717724
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("filter error: %s", err)
718725
}

api/snapshot.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,14 @@ func apiSnapshotsPull(c *gin.Context) {
748748
}
749749

750750
// Filter with dependencies as requested
751-
destinationPackageList, err := sourcePackageList.FilterWithProgress(queries, !noDeps, toPackageList, context.DependencyOptions(), architecturesList, context.Progress())
751+
destinationPackageList, err := sourcePackageList.Filter(deb.FilterOptions{
752+
Queries: queries,
753+
WithDependencies: !noDeps,
754+
Source: toPackageList,
755+
DependencyOptions: context.DependencyOptions(),
756+
Architectures: architecturesList,
757+
Progress: context.Progress(),
758+
})
752759
if err != nil {
753760
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
754761
}

cmd/repo_move.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,14 @@ func aptlyRepoMoveCopyImport(cmd *commander.Command, args []string) error {
116116
}
117117
}
118118

119-
toProcess, err := srcList.FilterWithProgress(queries, withDeps, dstList, context.DependencyOptions(), architecturesList, context.Progress())
119+
toProcess, err := srcList.Filter(deb.FilterOptions{
120+
Queries: queries,
121+
WithDependencies: withDeps,
122+
Source: dstList,
123+
DependencyOptions: context.DependencyOptions(),
124+
Architectures: architecturesList,
125+
Progress: context.Progress(),
126+
})
120127
if err != nil {
121128
return fmt.Errorf("unable to %s: %s", command, err)
122129
}

cmd/repo_remove.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func aptlyRepoRemove(cmd *commander.Command, args []string) error {
4545
}
4646

4747
list.PrepareIndex()
48-
toRemove, err := list.Filter(queries, false, nil, 0, nil)
48+
toRemove, err := list.Filter(deb.FilterOptions{Queries: queries})
4949
if err != nil {
5050
return fmt.Errorf("unable to remove: %s", err)
5151
}

cmd/snapshot_filter.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ func aptlySnapshotFilter(cmd *commander.Command, args []string) error {
6767
}
6868

6969
// Filter with dependencies as requested
70-
result, err := packageList.FilterWithProgress(queries, withDeps, nil, context.DependencyOptions(), architecturesList, context.Progress())
70+
result, err := packageList.Filter(deb.FilterOptions{
71+
Queries: queries,
72+
WithDependencies: withDeps,
73+
Source: nil,
74+
DependencyOptions: context.DependencyOptions(),
75+
Architectures: architecturesList,
76+
Progress: context.Progress(),
77+
})
7178
if err != nil {
7279
return fmt.Errorf("unable to filter: %s", err)
7380
}

cmd/snapshot_pull.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,14 @@ func aptlySnapshotPull(cmd *commander.Command, args []string) error {
9797
}
9898

9999
// Filter with dependencies as requested
100-
result, err := sourcePackageList.FilterWithProgress(queries, !noDeps, packageList, context.DependencyOptions(), architecturesList, context.Progress())
100+
result, err := sourcePackageList.Filter(deb.FilterOptions{
101+
Queries: queries,
102+
WithDependencies: !noDeps,
103+
Source: packageList,
104+
DependencyOptions: context.DependencyOptions(),
105+
Architectures: architecturesList,
106+
Progress: context.Progress(),
107+
})
101108
if err != nil {
102109
return fmt.Errorf("unable to pull: %s", err)
103110
}

cmd/snapshot_search.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,13 @@ func aptlySnapshotMirrorRepoSearch(cmd *commander.Command, args []string) error
103103
}
104104
}
105105

106-
result, err := list.FilterWithProgress([]deb.PackageQuery{q}, withDeps,
107-
nil, context.DependencyOptions(), architecturesList, context.Progress())
106+
result, err := list.Filter(deb.FilterOptions{
107+
Queries: []deb.PackageQuery{q},
108+
WithDependencies: withDeps,
109+
DependencyOptions: context.DependencyOptions(),
110+
Architectures: architecturesList,
111+
Progress: context.Progress(),
112+
})
108113
if err != nil {
109114
return fmt.Errorf("unable to search: %s", err)
110115
}

0 commit comments

Comments
 (0)