mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
Merge pull request #1368 from aptly-dev/fix/repo-add-errmsg
repo add: improve error message
This commit is contained in:
+1
-1
@@ -218,7 +218,7 @@ func ImportPackageFiles(list *PackageList, packageFiles []string, forceReplace b
|
|||||||
|
|
||||||
err = list.Add(p)
|
err = list.Add(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
reporter.Warning("Unable to add package to repo %s: %s", p, err)
|
reporter.Warning("Unable to add package: %s", err)
|
||||||
failedFiles = append(failedFiles, file)
|
failedFiles = append(failedFiles, file)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -138,7 +138,7 @@ func (l *PackageList) Add(p *Package) error {
|
|||||||
existing, ok := l.packages[key]
|
existing, ok := l.packages[key]
|
||||||
if ok {
|
if ok {
|
||||||
if !existing.Equals(p) {
|
if !existing.Equals(p) {
|
||||||
return &PackageConflictError{fmt.Errorf("conflict in package %s", p)}
|
return &PackageConflictError{fmt.Errorf("package already exists and is different: %s", p)}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -201,7 +201,7 @@ func (l *PackageList) Append(pl *PackageList) error {
|
|||||||
existing, ok := l.packages[k]
|
existing, ok := l.packages[k]
|
||||||
if ok {
|
if ok {
|
||||||
if !existing.Equals(p) {
|
if !existing.Equals(p) {
|
||||||
return fmt.Errorf("conflict in package %s", p)
|
return fmt.Errorf("package already exists and is different: %s", p)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
l.packages[k] = p
|
l.packages[k] = p
|
||||||
|
|||||||
+2
-2
@@ -131,7 +131,7 @@ func (s *PackageListSuite) TestAddLen(c *C) {
|
|||||||
c.Check(s.list.Len(), Equals, 1)
|
c.Check(s.list.Len(), Equals, 1)
|
||||||
c.Check(s.list.Add(s.p3), IsNil)
|
c.Check(s.list.Add(s.p3), IsNil)
|
||||||
c.Check(s.list.Len(), Equals, 2)
|
c.Check(s.list.Len(), Equals, 2)
|
||||||
c.Check(s.list.Add(s.p4), ErrorMatches, "conflict in package.*")
|
c.Check(s.list.Add(s.p4), ErrorMatches, "package already exists and is different: .*")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *PackageListSuite) TestRemove(c *C) {
|
func (s *PackageListSuite) TestRemove(c *C) {
|
||||||
@@ -243,7 +243,7 @@ func (s *PackageListSuite) TestAppend(c *C) {
|
|||||||
list.Add(s.p4)
|
list.Add(s.p4)
|
||||||
|
|
||||||
err = s.list.Append(list)
|
err = s.list.Append(list)
|
||||||
c.Check(err, ErrorMatches, "conflict.*")
|
c.Check(err, ErrorMatches, "package already exists and is different: .*")
|
||||||
|
|
||||||
s.list.PrepareIndex()
|
s.list.PrepareIndex()
|
||||||
c.Check(func() { s.list.Append(s.il) }, Panics, "Append not supported when indexed")
|
c.Check(func() { s.list.Append(s.il) }, Panics, "Append not supported when indexed")
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ func (s *PackageRefListSuite) TestNewPackageListFromRefList(c *C) {
|
|||||||
list, err := NewPackageListFromRefList(reflist, coll, nil)
|
list, err := NewPackageListFromRefList(reflist, coll, nil)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
c.Check(list.Len(), Equals, 4)
|
c.Check(list.Len(), Equals, 4)
|
||||||
c.Check(list.Add(s.p4), ErrorMatches, "conflict in package.*")
|
c.Check(list.Add(s.p4), ErrorMatches, "package already exists and is different: .*")
|
||||||
|
|
||||||
list, err = NewPackageListFromRefList(nil, coll, nil)
|
list, err = NewPackageListFromRefList(nil, coll, nil)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Loading packages...
|
Loading packages...
|
||||||
[!] Unable to add package to repo pyspi_0.6.1-1.3_source: conflict in package pyspi_0.6.1-1.3_source
|
[!] Unable to add package: package already exists and is different: pyspi_0.6.1-1.3_source
|
||||||
[!] Some files were skipped due to errors:
|
[!] Some files were skipped due to errors:
|
||||||
/pyspi_0.6.1-1.3.conflict.dsc
|
/pyspi_0.6.1-1.3.conflict.dsc
|
||||||
ERROR: some files failed to be added
|
ERROR: some files failed to be added
|
||||||
|
|||||||
Reference in New Issue
Block a user