Skip to content

Commit 6216a2a

Browse files
committed
fix: allow UpdateOSLibs to handle packages without an MD5Sum
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
1 parent f24a0c9 commit 6216a2a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

dagger/maintenance/updatelibs.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
)
1111

1212
// libsRegex matches library dependencies from apt-get output
13-
// Format: library-name MD5Sum:checksum
14-
var libsRegex = regexp.MustCompile(`(?m)^.*\s(lib\S*).*(MD5Sum:.*)$`)
13+
// Format: 'url' library-name size [MD5Sum:checksum]
14+
var libsRegex = regexp.MustCompile(`(?m)^.*\s(lib\S+\.deb)\s+\d+\s*(MD5Sum:\S+)?`)
1515

1616
func updateOSLibsOnTarget(
1717
ctx context.Context,
@@ -43,8 +43,12 @@ func updateOSLibsOnTarget(
4343

4444
var result string
4545
for _, m := range matches {
46-
if len(m) >= 3 {
47-
result += m[1] + " " + m[2] + "\n"
46+
if len(m) >= 2 {
47+
line := m[1]
48+
if len(m) >= 3 && m[2] != "" {
49+
line += " " + m[2]
50+
}
51+
result += line + "\n"
4852
}
4953
}
5054

0 commit comments

Comments
 (0)