aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-04-01 14:27:29 +0200
committerMax Magorsch <arzano@gentoo.org>2020-04-01 14:27:29 +0200
commit54d2ae92baa1d8afd07dbe93d9464422af74d481 (patch)
treeed987dbe8b191e938f2b454b7b8a38a5fcb18eb5 /pkg/portage/repository/mask.go
parentSort the ebuild versions in the version table (diff)
downloadsoko-54d2ae92baa1d8afd07dbe93d9464422af74d481.tar.gz
soko-54d2ae92baa1d8afd07dbe93d9464422af74d481.tar.bz2
soko-54d2ae92baa1d8afd07dbe93d9464422af74d481.zip
Improve the error handling for package.mask entries
Signed-off-by: Max Magorsch <arzano@gentoo.org>
Diffstat (limited to 'pkg/portage/repository/mask.go')
-rw-r--r--pkg/portage/repository/mask.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/portage/repository/mask.go b/pkg/portage/repository/mask.go
index 9df53de..a684211 100644
--- a/pkg/portage/repository/mask.go
+++ b/pkg/portage/repository/mask.go
@@ -68,6 +68,13 @@ func versionSpecifierToPackageAtom(versionSpecifier string) string {
// parseAuthorLine parses the first line in the package.mask file
// and returns the author name, author email and the date
func parseAuthorLine(authorLine string) (string, string, time.Time) {
+
+ if ! ( strings.Contains(authorLine, "<") && strings.Contains(authorLine, ">") ) {
+ logger.Error.Println("Error while parsing the author line in mask entry:")
+ logger.Error.Println(authorLine)
+ return "", "", time.Now()
+ }
+
author := strings.TrimSpace(strings.Split(authorLine, "<")[0])
author = strings.ReplaceAll(author, "#", "")
authorEmail := strings.TrimSpace(strings.Split(strings.Split(authorLine, "<")[1], ">")[0])