Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] EL9 RPM Sqlite3 DB support #201

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

agrare
Copy link
Member

@agrare agrare commented Oct 31, 2024

@Fryguy
Copy link
Member

Fryguy commented Oct 31, 2024

I'd be happy merging specs as is ahead of actually implementing anything.

@Fryguy Fryguy self-assigned this Oct 31, 2024
it "returns a list of rpm packages" do
result = described_class.new(fs)

expect(result.instance_variable_get(:@packages).count).to eq(690)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we don't have an attr_reader for @packages here, toXml and toString are the only "interface" methods but I think access to packages would be handy also

}

#
# Nubbers on disk are in network byte order.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL nubbers

@agrare agrare force-pushed the miq_rpm_packages_el9 branch 2 times, most recently from cd7f0b9 to 654c48a Compare November 4, 2024 16:35
@@ -63,7 +63,7 @@ def decodeSchema
return if @type != "table" || @name[0..6] == "sqlite_" # Names beginning with sqlite_ are internal to engine
@columns = []
sql = @sql.gsub(/[\n\r]/, "")
re1 = /\s*CREATE\s+TABLE\s+(\w+)\s*\((.*)\)\s*/
re1 = /\s*CREATE\s+TABLE\s+'?(\w+)'?\s*\((.*)\)\s*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting - I've never seen quotes before. Also note that technically the table name could have a . in it as well (i.e. <schema_name>.<table_name>)

@Fryguy
Copy link
Member

Fryguy commented Nov 4, 2024

@agrare More out of curiosity, what's the approach here? I'm seeing refactoring into separate modules + specs...is the plan to do an initial refactor, then merge, then add the new DB support?

@agrare
Copy link
Member Author

agrare commented Nov 4, 2024

@Fryguy so I see this as two high level issues,

  1. MiqSqlite3DB can't currently load the rpmdb.sqlite database
  2. MiqRpmPackages can't currently process a rpmdb.sqlite file

So the plan is:

  1. Get MiqSqlite3DB::Sqlite3 able to load the rpmdb.sqlite file and list tables
  2. Get MiqSqlite3DB::Sqlite3Table able to list rows in the Packages table (this is also broken currently)
  3. Get MiqLinux::MiqRpmPackages able to understand the contents of the rpmdb.sqlite database (this PR)

So I'm rebasing this on top of the sqlite3 fixes

@Fryguy
Copy link
Member

Fryguy commented Nov 4, 2024

Moving forward I wonder if it's better to use the sqlite library instead of rolling our own. Not sure if that is with investigation or not. I'd rather do whats more expedient at this time, but I'm also wondering what bugs will lurk in the corners.

@agrare
Copy link
Member Author

agrare commented Nov 4, 2024

Moving forward I wonder if it's better to use the sqlite library instead of rolling our own

Yes I did look into that originally, but I don't think that will work with the way that we handle loading the filesystem via MiqFs in SSA. We'd need a "real" file since the interface is a path and all of the loading of the database is done in C-ext code.

(Another reason I'd like to use FUSE instead eventually so that we could "mount" the filesystem and use more standardized tools based on files/paths)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants