-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract all dpkg packages regardless of the Status field and store th…
…e value of Status in the metadata. PiperOrigin-RevId: 630407306
- Loading branch information
1 parent
e83bfdd
commit d9a5b66
Showing
6 changed files
with
97 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "accountsservice", | ||
PackageVersion: "22.08.8-6", | ||
Status: "install ok installed", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
|
@@ -105,6 +106,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "acl", | ||
PackageVersion: "2.3.1-3", | ||
Status: "install ok installed", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
|
@@ -120,6 +122,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "adduser", | ||
PackageVersion: "3.131", | ||
Status: "install ok installed", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
|
@@ -135,6 +138,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "admin-session", | ||
PackageVersion: "2023.06.26.c543406313-00", | ||
Status: "install ok installed", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
|
@@ -150,6 +154,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "attr", | ||
PackageVersion: "1:2.5.1-4", | ||
Status: "install ok installed", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
|
@@ -166,6 +171,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "libacl1", | ||
PackageVersion: "2.3.1-3", | ||
Status: "install ok installed", | ||
SourceName: "acl", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
|
@@ -183,6 +189,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "util-linux-extra", | ||
PackageVersion: "2.38.1-5+b1", | ||
Status: "install ok installed", | ||
SourceName: "util-linux", | ||
SourceVersion: "2.38.1-5", | ||
OSID: "debian", | ||
|
@@ -207,6 +214,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "foo", | ||
PackageVersion: "1.0", | ||
Status: "install ok installed", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
|
@@ -220,6 +228,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "bar", | ||
PackageVersion: "2.0", | ||
Status: "install ok installed", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
|
@@ -240,6 +249,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "foo", | ||
PackageVersion: "1.0", | ||
Status: "install ok installed", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
|
@@ -253,6 +263,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "bar", | ||
PackageVersion: "2.0", | ||
Status: "install ok installed", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
|
@@ -273,6 +284,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "wantinstall_installed", | ||
PackageVersion: "1.0", | ||
Status: "install ok installed", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
|
@@ -286,6 +298,35 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "wantdeinstall_installed", | ||
PackageVersion: "1.0", | ||
Status: "deinstall reinstreq installed", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
}, | ||
Locations: []string{"testdata/statusfield"}, | ||
Extractor: dpkg.Name, | ||
}, | ||
&extractor.Inventory{ | ||
Name: "wantdeinstall_configfiles", | ||
Version: "1.0", | ||
Metadata: &dpkg.Metadata{ | ||
PackageName: "wantdeinstall_configfiles", | ||
PackageVersion: "1.0", | ||
Status: "deinstall ok config-files", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
}, | ||
Locations: []string{"testdata/statusfield"}, | ||
Extractor: dpkg.Name, | ||
}, | ||
&extractor.Inventory{ | ||
Name: "wantinstall_unpacked", | ||
Version: "1.0", | ||
Metadata: &dpkg.Metadata{ | ||
PackageName: "wantinstall_unpacked", | ||
PackageVersion: "1.0", | ||
Status: "install ok unpacked", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
|
@@ -299,6 +340,34 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "wantpurge_installed", | ||
PackageVersion: "1.0", | ||
Status: "purge ok installed", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
}, | ||
Locations: []string{"testdata/statusfield"}, | ||
Extractor: dpkg.Name, | ||
}, | ||
&extractor.Inventory{ | ||
Name: "wantinstall_halfinstalled", | ||
Version: "1.0", | ||
Metadata: &dpkg.Metadata{ | ||
PackageName: "wantinstall_halfinstalled", | ||
PackageVersion: "1.0", | ||
Status: "install reinstreq half-installed", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
}, | ||
Locations: []string{"testdata/statusfield"}, | ||
Extractor: dpkg.Name, | ||
}, | ||
&extractor.Inventory{ | ||
Name: "wantnostatus", | ||
Version: "1.0", | ||
Metadata: &dpkg.Metadata{ | ||
PackageName: "wantnostatus", | ||
PackageVersion: "1.0", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
|
@@ -313,7 +382,6 @@ func TestExtract(t *testing.T) { | |
path: "testdata/empty", | ||
osrelease: DebianBookworm, | ||
wantInventory: []*extractor.Inventory{}, | ||
wantErr: cmpopts.AnyError, | ||
}, | ||
{ | ||
name: "invalid", | ||
|
@@ -334,6 +402,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "acl", | ||
PackageVersion: "2.3.1-3", | ||
Status: "install ok installed", | ||
OSID: "debian", | ||
OSVersionID: "12", | ||
Maintainer: "Guillem Jover <[email protected]>", | ||
|
@@ -355,6 +424,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "acl", | ||
PackageVersion: "2.3.1-3", | ||
Status: "install ok installed", | ||
OSID: "debian", | ||
Maintainer: "Guillem Jover <[email protected]>", | ||
Architecture: "amd64", | ||
|
@@ -375,6 +445,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "acl", | ||
PackageVersion: "2.3.1-3", | ||
Status: "install ok installed", | ||
OSVersionCodename: "bookworm", | ||
Maintainer: "Guillem Jover <[email protected]>", | ||
Architecture: "amd64", | ||
|
@@ -398,6 +469,7 @@ func TestExtract(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "acl", | ||
PackageVersion: "2.3.1-3", | ||
Status: "install ok installed", | ||
OSID: "ubuntu", | ||
OSVersionCodename: "jammy", | ||
OSVersionID: "22.04", | ||
|
@@ -438,6 +510,20 @@ func TestExtract(t *testing.T) { | |
Locations: []string{"testdata/status.d/foo"}, | ||
Extractor: dpkg.Name, | ||
}, | ||
&extractor.Inventory{ | ||
Name: "bar", | ||
Version: "1.0", | ||
Metadata: &dpkg.Metadata{ | ||
PackageName: "bar", | ||
PackageVersion: "1.0", | ||
Status: "deinstall ok config-files", | ||
OSID: "debian", | ||
OSVersionCodename: "bookworm", | ||
OSVersionID: "12", | ||
}, | ||
Locations: []string{"testdata/status.d/foo"}, | ||
Extractor: dpkg.Name, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
@@ -489,6 +575,7 @@ func TestExtractNonexistentOSRelease(t *testing.T) { | |
Metadata: &dpkg.Metadata{ | ||
PackageName: "acl", | ||
PackageVersion: "2.3.1-3", | ||
Status: "install ok installed", | ||
OSID: "", | ||
OSVersionID: "", | ||
Maintainer: "Guillem Jover <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters