mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-02 04:50:49 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1346352455 |
+8
-48
@@ -4,7 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"errors"
|
|
||||||
|
|
||||||
"github.com/aptly-dev/aptly/aptly"
|
"github.com/aptly-dev/aptly/aptly"
|
||||||
"github.com/aptly-dev/aptly/deb"
|
"github.com/aptly-dev/aptly/deb"
|
||||||
@@ -256,13 +255,13 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
|||||||
if b.SourceKind == deb.SourceSnapshot {
|
if b.SourceKind == deb.SourceSnapshot {
|
||||||
var snapshot *deb.Snapshot
|
var snapshot *deb.Snapshot
|
||||||
|
|
||||||
tmpCollection := collectionFactory.SnapshotCollection()
|
snapshotCollection := collectionFactory.SnapshotCollection()
|
||||||
|
|
||||||
for _, source := range b.Sources {
|
for _, source := range b.Sources {
|
||||||
components = append(components, source.Component)
|
components = append(components, source.Component)
|
||||||
names = append(names, source.Name)
|
names = append(names, source.Name)
|
||||||
|
|
||||||
snapshot, err = tmpCollection.ByName(source.Name)
|
snapshot, err = snapshotCollection.ByName(source.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to publish: %s", err))
|
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to publish: %s", err))
|
||||||
return
|
return
|
||||||
@@ -274,13 +273,13 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
|||||||
} else if b.SourceKind == deb.SourceLocalRepo {
|
} else if b.SourceKind == deb.SourceLocalRepo {
|
||||||
var localRepo *deb.LocalRepo
|
var localRepo *deb.LocalRepo
|
||||||
|
|
||||||
tmpCollection := collectionFactory.LocalRepoCollection()
|
localCollection := collectionFactory.LocalRepoCollection()
|
||||||
|
|
||||||
for _, source := range b.Sources {
|
for _, source := range b.Sources {
|
||||||
components = append(components, source.Component)
|
components = append(components, source.Component)
|
||||||
names = append(names, source.Name)
|
names = append(names, source.Name)
|
||||||
|
|
||||||
localRepo, err = tmpCollection.ByName(source.Name)
|
localRepo, err = localCollection.ByName(source.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to publish: %s", err))
|
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to publish: %s", err))
|
||||||
return
|
return
|
||||||
@@ -333,6 +332,8 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
|||||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to publish: %s", err)
|
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to publish: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resources = append(resources, string(published.Key()))
|
||||||
|
|
||||||
if b.Origin != "" {
|
if b.Origin != "" {
|
||||||
published.Origin = b.Origin
|
published.Origin = b.Origin
|
||||||
}
|
}
|
||||||
@@ -464,60 +465,18 @@ func apiPublishUpdateSwitch(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resources := []string{string(published.Key())}
|
|
||||||
|
|
||||||
if published.SourceKind == deb.SourceLocalRepo {
|
if published.SourceKind == deb.SourceLocalRepo {
|
||||||
if len(b.Snapshots) > 0 {
|
if len(b.Snapshots) > 0 {
|
||||||
AbortWithJSONError(c, http.StatusBadRequest, fmt.Errorf("snapshots shouldn't be given when updating local repo"))
|
AbortWithJSONError(c, http.StatusBadRequest, fmt.Errorf("snapshots shouldn't be given when updating local repo"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fmt.Printf("RACE DEBUG: deb.SourceLocalRepo\n")
|
|
||||||
|
|
||||||
// FIXME: lock repo ?
|
|
||||||
// localCollection := collectionFactory.LocalRepoCollection()
|
|
||||||
// for _, source := range b.Sources {
|
|
||||||
// components = append(components, source.Component)
|
|
||||||
// names = append(names, source.Name)
|
|
||||||
|
|
||||||
// localRepo, err = localCollection.ByName(source.Name)
|
|
||||||
// if err != nil {
|
|
||||||
// AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to publish: %s", err))
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// resources = append(resources, string(localRepo.Key()))
|
|
||||||
// }
|
|
||||||
} else if published.SourceKind == deb.SourceSnapshot {
|
} else if published.SourceKind == deb.SourceSnapshot {
|
||||||
fmt.Printf("RACE DEBUG: deb.SourceSnapshot: %s\n", b.Snapshots)
|
|
||||||
for _, snapshotInfo := range b.Snapshots {
|
for _, snapshotInfo := range b.Snapshots {
|
||||||
snapshot, err2 := snapshotCollection.ByName(snapshotInfo.Name)
|
_, err2 := snapshotCollection.ByName(snapshotInfo.Name)
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
AbortWithJSONError(c, http.StatusNotFound, err2)
|
AbortWithJSONError(c, http.StatusNotFound, err2)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
resources = append(resources, string(snapshot.ResourceKey()))
|
|
||||||
|
|
||||||
for _, sourceID := range snapshot.SourceIDs {
|
|
||||||
if snapshot.SourceKind == deb.SourceSnapshot {
|
|
||||||
// FIXME: implement
|
|
||||||
err := errors.New("not implemented deb.SourceSnapshot")
|
|
||||||
AbortWithJSONError(c, http.StatusNotFound, err)
|
|
||||||
return
|
|
||||||
} else if snapshot.SourceKind == deb.SourceLocalRepo {
|
|
||||||
var repo *deb.LocalRepo
|
|
||||||
repo, err = context.NewCollectionFactory().LocalRepoCollection().ByUUID(sourceID)
|
|
||||||
if err != nil {
|
|
||||||
AbortWithJSONError(c, http.StatusNotFound, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resources = append(resources, string(repo.Key()))
|
|
||||||
} else if snapshot.SourceKind == deb.SourceRemoteRepo {
|
|
||||||
// FIXME: implement
|
|
||||||
err := errors.New("not implemented: deb.SourceRemoteRepo")
|
|
||||||
AbortWithJSONError(c, http.StatusNotFound, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unknown published repository type"))
|
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unknown published repository type"))
|
||||||
@@ -556,6 +515,7 @@ func apiPublishUpdateSwitch(c *gin.Context) {
|
|||||||
published.Version = *b.Version
|
published.Version = *b.Version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resources := []string{string(published.Key())}
|
||||||
taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
|
taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
|
||||||
maybeRunTaskInBackground(c, taskName, resources, func(out aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
maybeRunTaskInBackground(c, taskName, resources, func(out aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||||
err = collection.LoadComplete(published, collectionFactory)
|
err = collection.LoadComplete(published, collectionFactory)
|
||||||
|
|||||||
+1
-6
@@ -28,11 +28,6 @@ func ParsePPA(ppaURL string, config *utils.ConfigStructure) (url string, distrib
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
baseurl := config.PpaBaseURL
|
|
||||||
if baseurl == "" {
|
|
||||||
baseurl = "http://ppa.launchpad.net"
|
|
||||||
}
|
|
||||||
|
|
||||||
codename := config.PpaCodename
|
codename := config.PpaCodename
|
||||||
if codename == "" {
|
if codename == "" {
|
||||||
codename, err = getCodename()
|
codename, err = getCodename()
|
||||||
@@ -44,7 +39,7 @@ func ParsePPA(ppaURL string, config *utils.ConfigStructure) (url string, distrib
|
|||||||
|
|
||||||
distribution = codename
|
distribution = codename
|
||||||
components = []string{"main"}
|
components = []string{"main"}
|
||||||
url = fmt.Sprintf("%s/%s/%s/%s", baseurl, matches[1], matches[2], distributorID)
|
url = fmt.Sprintf("http://ppa.launchpad.net/%s/%s/%s", matches[1], matches[2], distributorID)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
-3
@@ -70,9 +70,6 @@ ppa_distributor_id: ubuntu
|
|||||||
# Codename for short PPA url expansion
|
# Codename for short PPA url expansion
|
||||||
ppa_codename: ""
|
ppa_codename: ""
|
||||||
|
|
||||||
# PPA Base URL (default: launchpad)
|
|
||||||
# # ppa_baseurl: http://ppa.launchpad.net
|
|
||||||
|
|
||||||
|
|
||||||
# Aptly Server
|
# Aptly Server
|
||||||
###############
|
###############
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
"dependencyVerboseResolve": false,
|
"dependencyVerboseResolve": false,
|
||||||
"ppaDistributorID": "ubuntu",
|
"ppaDistributorID": "ubuntu",
|
||||||
"ppaCodename": "",
|
"ppaCodename": "",
|
||||||
"ppaBaseURL": "http://ppa.launchpad.net",
|
|
||||||
"serveInAPIMode": true,
|
"serveInAPIMode": true,
|
||||||
"enableMetricsEndpoint": true,
|
"enableMetricsEndpoint": true,
|
||||||
"enableSwaggerEndpoint": false,
|
"enableSwaggerEndpoint": false,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ dep_follow_source: false
|
|||||||
dep_verboseresolve: false
|
dep_verboseresolve: false
|
||||||
ppa_distributor_id: ubuntu
|
ppa_distributor_id: ubuntu
|
||||||
ppa_codename: ""
|
ppa_codename: ""
|
||||||
ppa_baseurl: http://ppa.launchpad.net
|
|
||||||
serve_in_api_mode: true
|
serve_in_api_mode: true
|
||||||
enable_metrics_endpoint: true
|
enable_metrics_endpoint: true
|
||||||
enable_swagger_endpoint: false
|
enable_swagger_endpoint: false
|
||||||
|
|||||||
@@ -70,9 +70,6 @@ ppa_distributor_id: ubuntu
|
|||||||
# Codename for short PPA url expansion
|
# Codename for short PPA url expansion
|
||||||
ppa_codename: ""
|
ppa_codename: ""
|
||||||
|
|
||||||
# PPA Base URL (default: launchpad)
|
|
||||||
# # ppa_baseurl: http://ppa.launchpad.net
|
|
||||||
|
|
||||||
|
|
||||||
# Aptly Server
|
# Aptly Server
|
||||||
###############
|
###############
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Downloading: http://repo.aptly.info/system-tests/ppa/gladky-anton/gnuplot/ubuntu/dists/maverick/InRelease
|
Downloading: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/dists/maverick/InRelease
|
||||||
gpgv: Signature made Sun Jul 28 07:57:01 2024 UTC
|
gpgv: Signature made Sun Jul 28 07:57:01 2024 UTC
|
||||||
gpgv: using RSA key 5BFCD481D86D5824470E469F9000B1C3A01F726C
|
gpgv: using RSA key 5BFCD481D86D5824470E469F9000B1C3A01F726C
|
||||||
gpgv: Good signature from "Launchpad PPA for Anton Gladky"
|
gpgv: Good signature from "Launchpad PPA for Anton Gladky"
|
||||||
@@ -6,5 +6,5 @@ gpgv: Signature made Sun Jul 28 07:57:01 2024 UTC
|
|||||||
gpgv: using RSA key 02219381E9161C78A46CB2BFA5279A973B1F56C0
|
gpgv: using RSA key 02219381E9161C78A46CB2BFA5279A973B1F56C0
|
||||||
gpgv: Good signature from "Launchpad sim"
|
gpgv: Good signature from "Launchpad sim"
|
||||||
|
|
||||||
Mirror [mirror18]: http://repo.aptly.info/system-tests/ppa/gladky-anton/gnuplot/ubuntu/ maverick successfully added.
|
Mirror [mirror18]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick successfully added.
|
||||||
You can run 'aptly mirror update mirror18' to download repository contents.
|
You can run 'aptly mirror update mirror18' to download repository contents.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Name: mirror18
|
Name: mirror18
|
||||||
Archive Root URL: http://repo.aptly.info/system-tests/ppa/gladky-anton/gnuplot/ubuntu/
|
Archive Root URL: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/
|
||||||
Distribution: maverick
|
Distribution: maverick
|
||||||
Components: main
|
Components: main
|
||||||
Architectures: amd64, armel, i386, powerpc
|
Architectures: amd64, armel, i386, powerpc
|
||||||
|
|||||||
@@ -221,7 +221,6 @@ class CreateMirror18Test(BaseTest):
|
|||||||
"max-tries": 1,
|
"max-tries": 1,
|
||||||
"ppaDistributorID": "ubuntu",
|
"ppaDistributorID": "ubuntu",
|
||||||
"ppaCodename": "maverick",
|
"ppaCodename": "maverick",
|
||||||
"ppaBaseURL": "http://repo.aptly.info/system-tests/ppa",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fixtureCmds = [
|
fixtureCmds = [
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ func (list *List) consumer() {
|
|||||||
task.State = SUCCEEDED
|
task.State = SUCCEEDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("RACE DEBUG: Task %s done, freeing %s\n", task.Name, task.resources)
|
|
||||||
list.usedResources.Free(task.resources)
|
list.usedResources.Free(task.resources)
|
||||||
|
|
||||||
task.wgTask.Done()
|
task.wgTask.Done()
|
||||||
@@ -78,8 +77,6 @@ func (list *List) consumer() {
|
|||||||
blockingTasks := list.usedResources.UsedBy(t.resources)
|
blockingTasks := list.usedResources.UsedBy(t.resources)
|
||||||
if len(blockingTasks) == 0 {
|
if len(blockingTasks) == 0 {
|
||||||
list.usedResources.MarkInUse(t.resources, t)
|
list.usedResources.MarkInUse(t.resources, t)
|
||||||
|
|
||||||
fmt.Printf("RACE DEBUG: Starting queued task %s, using %s\n", t.Name, t.resources)
|
|
||||||
// unlock list since queueing may block
|
// unlock list since queueing may block
|
||||||
list.Unlock()
|
list.Unlock()
|
||||||
unlocked = true
|
unlocked = true
|
||||||
@@ -212,12 +209,10 @@ func (list *List) RunTaskInBackground(name string, resources []string, process P
|
|||||||
tasks := list.usedResources.UsedBy(resources)
|
tasks := list.usedResources.UsedBy(resources)
|
||||||
if len(tasks) == 0 {
|
if len(tasks) == 0 {
|
||||||
list.usedResources.MarkInUse(task.resources, task)
|
list.usedResources.MarkInUse(task.resources, task)
|
||||||
fmt.Printf("RACE DEBUG: Starting task %s, using %s\n", name, resources)
|
|
||||||
// queueing task might block if channel not ready, unlock list before queueing
|
// queueing task might block if channel not ready, unlock list before queueing
|
||||||
list.Unlock()
|
list.Unlock()
|
||||||
list.queue <- task
|
list.queue <- task
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("RACE DEBUG: Queued task %s, locked %s\n", name, resources)
|
|
||||||
list.Unlock()
|
list.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ type ConfigStructure struct { // nolint: maligned
|
|||||||
// PPA
|
// PPA
|
||||||
PpaDistributorID string `json:"ppaDistributorID" yaml:"ppa_distributor_id"`
|
PpaDistributorID string `json:"ppaDistributorID" yaml:"ppa_distributor_id"`
|
||||||
PpaCodename string `json:"ppaCodename" yaml:"ppa_codename"`
|
PpaCodename string `json:"ppaCodename" yaml:"ppa_codename"`
|
||||||
PpaBaseURL string `json:"ppaBaseURL" yaml:"ppa_baseurl"`
|
|
||||||
|
|
||||||
// Server
|
// Server
|
||||||
ServeInAPIMode bool `json:"serveInAPIMode" yaml:"serve_in_api_mode"`
|
ServeInAPIMode bool `json:"serveInAPIMode" yaml:"serve_in_api_mode"`
|
||||||
@@ -236,7 +235,6 @@ var Config = ConfigStructure{
|
|||||||
SkipLegacyPool: false,
|
SkipLegacyPool: false,
|
||||||
PpaDistributorID: "ubuntu",
|
PpaDistributorID: "ubuntu",
|
||||||
PpaCodename: "",
|
PpaCodename: "",
|
||||||
PpaBaseURL: "http://ppa.launchpad.net",
|
|
||||||
FileSystemPublishRoots: map[string]FileSystemPublishRoot{},
|
FileSystemPublishRoots: map[string]FileSystemPublishRoot{},
|
||||||
S3PublishRoots: map[string]S3PublishRoot{},
|
S3PublishRoots: map[string]S3PublishRoot{},
|
||||||
SwiftPublishRoots: map[string]SwiftPublishRoot{},
|
SwiftPublishRoots: map[string]SwiftPublishRoot{},
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
|
|||||||
" \"dependencyVerboseResolve\": false,\n" +
|
" \"dependencyVerboseResolve\": false,\n" +
|
||||||
" \"ppaDistributorID\": \"\",\n" +
|
" \"ppaDistributorID\": \"\",\n" +
|
||||||
" \"ppaCodename\": \"\",\n" +
|
" \"ppaCodename\": \"\",\n" +
|
||||||
" \"ppaBaseURL\": \"\",\n" +
|
|
||||||
" \"serveInAPIMode\": false,\n" +
|
" \"serveInAPIMode\": false,\n" +
|
||||||
" \"enableMetricsEndpoint\": false,\n" +
|
" \"enableMetricsEndpoint\": false,\n" +
|
||||||
" \"enableSwaggerEndpoint\": false,\n" +
|
" \"enableSwaggerEndpoint\": false,\n" +
|
||||||
@@ -253,7 +252,6 @@ func (s *ConfigSuite) TestSaveYAML2Config(c *C) {
|
|||||||
"dep_verboseresolve: false\n" +
|
"dep_verboseresolve: false\n" +
|
||||||
"ppa_distributor_id: \"\"\n" +
|
"ppa_distributor_id: \"\"\n" +
|
||||||
"ppa_codename: \"\"\n" +
|
"ppa_codename: \"\"\n" +
|
||||||
"ppa_baseurl: \"\"\n" +
|
|
||||||
"serve_in_api_mode: false\n" +
|
"serve_in_api_mode: false\n" +
|
||||||
"enable_metrics_endpoint: false\n" +
|
"enable_metrics_endpoint: false\n" +
|
||||||
"enable_swagger_endpoint: false\n" +
|
"enable_swagger_endpoint: false\n" +
|
||||||
@@ -310,7 +308,6 @@ dep_follow_source: true
|
|||||||
dep_verboseresolve: true
|
dep_verboseresolve: true
|
||||||
ppa_distributor_id: Ubuntu
|
ppa_distributor_id: Ubuntu
|
||||||
ppa_codename: code
|
ppa_codename: code
|
||||||
ppa_baseurl: http://ppa.launchpad.net
|
|
||||||
serve_in_api_mode: true
|
serve_in_api_mode: true
|
||||||
enable_metrics_endpoint: true
|
enable_metrics_endpoint: true
|
||||||
enable_swagger_endpoint: true
|
enable_swagger_endpoint: true
|
||||||
|
|||||||
Reference in New Issue
Block a user