#![cfg(unix)]
use libappstream_sys::*;
use std::env;
use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::{Command, Stdio};
use std::str;
use tempfile::Builder;
static PACKAGES: &[&str] = &["appstream"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Self, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
args.push("-std=c11".to_owned());
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Self { args })
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {cmd:?} failed, {status}").into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<dyn Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{name} {err}").into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags");
cmd.args(packages);
cmd.stderr(Stdio::inherit());
let out = cmd.output()?;
if !out.status.success() {
let (status, stdout) = (out.status, String::from_utf8_lossy(&out.stdout));
return Err(format!("command {cmd:?} failed, {status:?}\nstdout: {stdout}").into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
passed: usize,
failed: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn summary(&self) -> String {
format!("{} passed; {} failed", self.passed, self.failed)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
fn cross_validate_constants_with_c() {
let mut c_constants: Vec<(String, String)> = Vec::new();
for l in get_c_output("constant").unwrap().lines() {
let (name, value) = l.split_once(';').expect("Missing ';' separator");
c_constants.push((name.to_owned(), value.to_owned()));
}
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}",
);
continue;
}
results.record_passed();
}
results.expect_total_success();
}
#[test]
fn cross_validate_layout_with_c() {
let mut c_layouts = Vec::new();
for l in get_c_output("layout").unwrap().lines() {
let (name, value) = l.split_once(';').expect("Missing first ';' separator");
let (size, alignment) = value.split_once(';').expect("Missing second ';' separator");
let size = size.parse().expect("Failed to parse size");
let alignment = alignment.parse().expect("Failed to parse alignment");
c_layouts.push((name.to_owned(), Layout { size, alignment }));
}
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",);
continue;
}
results.record_passed();
}
results.expect_total_success();
}
fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let tmpdir = Builder::new().prefix("abi").tempdir()?;
let exe = tmpdir.path().join(name);
let c_file = Path::new("tests").join(name).with_extension("c");
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut cmd = Command::new(exe);
cmd.stderr(Stdio::inherit());
let out = cmd.output()?;
if !out.status.success() {
let (status, stdout) = (out.status, String::from_utf8_lossy(&out.stdout));
return Err(format!("command {cmd:?} failed, {status:?}\nstdout: {stdout}").into());
}
Ok(String::from_utf8(out.stdout)?)
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
(
"AsAgreement",
Layout {
size: size_of::<AsAgreement>(),
alignment: align_of::<AsAgreement>(),
},
),
(
"AsAgreementClass",
Layout {
size: size_of::<AsAgreementClass>(),
alignment: align_of::<AsAgreementClass>(),
},
),
(
"AsAgreementKind",
Layout {
size: size_of::<AsAgreementKind>(),
alignment: align_of::<AsAgreementKind>(),
},
),
(
"AsAgreementSection",
Layout {
size: size_of::<AsAgreementSection>(),
alignment: align_of::<AsAgreementSection>(),
},
),
(
"AsAgreementSectionClass",
Layout {
size: size_of::<AsAgreementSectionClass>(),
alignment: align_of::<AsAgreementSectionClass>(),
},
),
(
"AsArtifact",
Layout {
size: size_of::<AsArtifact>(),
alignment: align_of::<AsArtifact>(),
},
),
(
"AsArtifactClass",
Layout {
size: size_of::<AsArtifactClass>(),
alignment: align_of::<AsArtifactClass>(),
},
),
(
"AsArtifactKind",
Layout {
size: size_of::<AsArtifactKind>(),
alignment: align_of::<AsArtifactKind>(),
},
),
(
"AsBranding",
Layout {
size: size_of::<AsBranding>(),
alignment: align_of::<AsBranding>(),
},
),
(
"AsBrandingClass",
Layout {
size: size_of::<AsBrandingClass>(),
alignment: align_of::<AsBrandingClass>(),
},
),
(
"AsBrandingColorIter",
Layout {
size: size_of::<AsBrandingColorIter>(),
alignment: align_of::<AsBrandingColorIter>(),
},
),
(
"AsBundle",
Layout {
size: size_of::<AsBundle>(),
alignment: align_of::<AsBundle>(),
},
),
(
"AsBundleClass",
Layout {
size: size_of::<AsBundleClass>(),
alignment: align_of::<AsBundleClass>(),
},
),
(
"AsBundleKind",
Layout {
size: size_of::<AsBundleKind>(),
alignment: align_of::<AsBundleKind>(),
},
),
(
"AsCacheFlags",
Layout {
size: size_of::<AsCacheFlags>(),
alignment: align_of::<AsCacheFlags>(),
},
),
(
"AsCategory",
Layout {
size: size_of::<AsCategory>(),
alignment: align_of::<AsCategory>(),
},
),
(
"AsCategoryClass",
Layout {
size: size_of::<AsCategoryClass>(),
alignment: align_of::<AsCategoryClass>(),
},
),
(
"AsChassisKind",
Layout {
size: size_of::<AsChassisKind>(),
alignment: align_of::<AsChassisKind>(),
},
),
(
"AsCheckResult",
Layout {
size: size_of::<AsCheckResult>(),
alignment: align_of::<AsCheckResult>(),
},
),
(
"AsChecksum",
Layout {
size: size_of::<AsChecksum>(),
alignment: align_of::<AsChecksum>(),
},
),
(
"AsChecksumClass",
Layout {
size: size_of::<AsChecksumClass>(),
alignment: align_of::<AsChecksumClass>(),
},
),
(
"AsChecksumKind",
Layout {
size: size_of::<AsChecksumKind>(),
alignment: align_of::<AsChecksumKind>(),
},
),
(
"AsColorKind",
Layout {
size: size_of::<AsColorKind>(),
alignment: align_of::<AsColorKind>(),
},
),
(
"AsColorSchemeKind",
Layout {
size: size_of::<AsColorSchemeKind>(),
alignment: align_of::<AsColorSchemeKind>(),
},
),
(
"AsComponent",
Layout {
size: size_of::<AsComponent>(),
alignment: align_of::<AsComponent>(),
},
),
(
"AsComponentBox",
Layout {
size: size_of::<AsComponentBox>(),
alignment: align_of::<AsComponentBox>(),
},
),
(
"AsComponentBoxClass",
Layout {
size: size_of::<AsComponentBoxClass>(),
alignment: align_of::<AsComponentBoxClass>(),
},
),
(
"AsComponentBoxFlags",
Layout {
size: size_of::<AsComponentBoxFlags>(),
alignment: align_of::<AsComponentBoxFlags>(),
},
),
(
"AsComponentClass",
Layout {
size: size_of::<AsComponentClass>(),
alignment: align_of::<AsComponentClass>(),
},
),
(
"AsComponentKind",
Layout {
size: size_of::<AsComponentKind>(),
alignment: align_of::<AsComponentKind>(),
},
),
(
"AsComponentScope",
Layout {
size: size_of::<AsComponentScope>(),
alignment: align_of::<AsComponentScope>(),
},
),
(
"AsContentRating",
Layout {
size: size_of::<AsContentRating>(),
alignment: align_of::<AsContentRating>(),
},
),
(
"AsContentRatingClass",
Layout {
size: size_of::<AsContentRatingClass>(),
alignment: align_of::<AsContentRatingClass>(),
},
),
(
"AsContentRatingSystem",
Layout {
size: size_of::<AsContentRatingSystem>(),
alignment: align_of::<AsContentRatingSystem>(),
},
),
(
"AsContentRatingValue",
Layout {
size: size_of::<AsContentRatingValue>(),
alignment: align_of::<AsContentRatingValue>(),
},
),
(
"AsContext",
Layout {
size: size_of::<AsContext>(),
alignment: align_of::<AsContext>(),
},
),
(
"AsContextClass",
Layout {
size: size_of::<AsContextClass>(),
alignment: align_of::<AsContextClass>(),
},
),
(
"AsControlKind",
Layout {
size: size_of::<AsControlKind>(),
alignment: align_of::<AsControlKind>(),
},
),
(
"AsDataIdMatchFlags",
Layout {
size: size_of::<AsDataIdMatchFlags>(),
alignment: align_of::<AsDataIdMatchFlags>(),
},
),
(
"AsDeveloper",
Layout {
size: size_of::<AsDeveloper>(),
alignment: align_of::<AsDeveloper>(),
},
),
(
"AsDeveloperClass",
Layout {
size: size_of::<AsDeveloperClass>(),
alignment: align_of::<AsDeveloperClass>(),
},
),
(
"AsDisplaySideKind",
Layout {
size: size_of::<AsDisplaySideKind>(),
alignment: align_of::<AsDisplaySideKind>(),
},
),
(
"AsFormatKind",
Layout {
size: size_of::<AsFormatKind>(),
alignment: align_of::<AsFormatKind>(),
},
),
(
"AsFormatStyle",
Layout {
size: size_of::<AsFormatStyle>(),
alignment: align_of::<AsFormatStyle>(),
},
),
(
"AsFormatVersion",
Layout {
size: size_of::<AsFormatVersion>(),
alignment: align_of::<AsFormatVersion>(),
},
),
(
"AsIcon",
Layout {
size: size_of::<AsIcon>(),
alignment: align_of::<AsIcon>(),
},
),
(
"AsIconClass",
Layout {
size: size_of::<AsIconClass>(),
alignment: align_of::<AsIconClass>(),
},
),
(
"AsIconKind",
Layout {
size: size_of::<AsIconKind>(),
alignment: align_of::<AsIconKind>(),
},
),
(
"AsImage",
Layout {
size: size_of::<AsImage>(),
alignment: align_of::<AsImage>(),
},
),
(
"AsImageClass",
Layout {
size: size_of::<AsImageClass>(),
alignment: align_of::<AsImageClass>(),
},
),
(
"AsImageKind",
Layout {
size: size_of::<AsImageKind>(),
alignment: align_of::<AsImageKind>(),
},
),
(
"AsInternetKind",
Layout {
size: size_of::<AsInternetKind>(),
alignment: align_of::<AsInternetKind>(),
},
),
(
"AsIssue",
Layout {
size: size_of::<AsIssue>(),
alignment: align_of::<AsIssue>(),
},
),
(
"AsIssueClass",
Layout {
size: size_of::<AsIssueClass>(),
alignment: align_of::<AsIssueClass>(),
},
),
(
"AsIssueKind",
Layout {
size: size_of::<AsIssueKind>(),
alignment: align_of::<AsIssueKind>(),
},
),
(
"AsIssueSeverity",
Layout {
size: size_of::<AsIssueSeverity>(),
alignment: align_of::<AsIssueSeverity>(),
},
),
(
"AsLaunchable",
Layout {
size: size_of::<AsLaunchable>(),
alignment: align_of::<AsLaunchable>(),
},
),
(
"AsLaunchableClass",
Layout {
size: size_of::<AsLaunchableClass>(),
alignment: align_of::<AsLaunchableClass>(),
},
),
(
"AsLaunchableKind",
Layout {
size: size_of::<AsLaunchableKind>(),
alignment: align_of::<AsLaunchableKind>(),
},
),
(
"AsMarkupKind",
Layout {
size: size_of::<AsMarkupKind>(),
alignment: align_of::<AsMarkupKind>(),
},
),
(
"AsMergeKind",
Layout {
size: size_of::<AsMergeKind>(),
alignment: align_of::<AsMergeKind>(),
},
),
(
"AsMetadata",
Layout {
size: size_of::<AsMetadata>(),
alignment: align_of::<AsMetadata>(),
},
),
(
"AsMetadataClass",
Layout {
size: size_of::<AsMetadataClass>(),
alignment: align_of::<AsMetadataClass>(),
},
),
(
"AsMetadataError",
Layout {
size: size_of::<AsMetadataError>(),
alignment: align_of::<AsMetadataError>(),
},
),
(
"AsMetadataLocation",
Layout {
size: size_of::<AsMetadataLocation>(),
alignment: align_of::<AsMetadataLocation>(),
},
),
(
"AsParseFlags",
Layout {
size: size_of::<AsParseFlags>(),
alignment: align_of::<AsParseFlags>(),
},
),
(
"AsPool",
Layout {
size: size_of::<AsPool>(),
alignment: align_of::<AsPool>(),
},
),
(
"AsPoolClass",
Layout {
size: size_of::<AsPoolClass>(),
alignment: align_of::<AsPoolClass>(),
},
),
(
"AsPoolError",
Layout {
size: size_of::<AsPoolError>(),
alignment: align_of::<AsPoolError>(),
},
),
(
"AsPoolFlags",
Layout {
size: size_of::<AsPoolFlags>(),
alignment: align_of::<AsPoolFlags>(),
},
),
(
"AsProvided",
Layout {
size: size_of::<AsProvided>(),
alignment: align_of::<AsProvided>(),
},
),
(
"AsProvidedClass",
Layout {
size: size_of::<AsProvidedClass>(),
alignment: align_of::<AsProvidedClass>(),
},
),
(
"AsProvidedKind",
Layout {
size: size_of::<AsProvidedKind>(),
alignment: align_of::<AsProvidedKind>(),
},
),
(
"AsReference",
Layout {
size: size_of::<AsReference>(),
alignment: align_of::<AsReference>(),
},
),
(
"AsReferenceClass",
Layout {
size: size_of::<AsReferenceClass>(),
alignment: align_of::<AsReferenceClass>(),
},
),
(
"AsReferenceKind",
Layout {
size: size_of::<AsReferenceKind>(),
alignment: align_of::<AsReferenceKind>(),
},
),
(
"AsRelation",
Layout {
size: size_of::<AsRelation>(),
alignment: align_of::<AsRelation>(),
},
),
(
"AsRelationCheckResult",
Layout {
size: size_of::<AsRelationCheckResult>(),
alignment: align_of::<AsRelationCheckResult>(),
},
),
(
"AsRelationCheckResultClass",
Layout {
size: size_of::<AsRelationCheckResultClass>(),
alignment: align_of::<AsRelationCheckResultClass>(),
},
),
(
"AsRelationClass",
Layout {
size: size_of::<AsRelationClass>(),
alignment: align_of::<AsRelationClass>(),
},
),
(
"AsRelationCompare",
Layout {
size: size_of::<AsRelationCompare>(),
alignment: align_of::<AsRelationCompare>(),
},
),
(
"AsRelationError",
Layout {
size: size_of::<AsRelationError>(),
alignment: align_of::<AsRelationError>(),
},
),
(
"AsRelationItemKind",
Layout {
size: size_of::<AsRelationItemKind>(),
alignment: align_of::<AsRelationItemKind>(),
},
),
(
"AsRelationKind",
Layout {
size: size_of::<AsRelationKind>(),
alignment: align_of::<AsRelationKind>(),
},
),
(
"AsRelationStatus",
Layout {
size: size_of::<AsRelationStatus>(),
alignment: align_of::<AsRelationStatus>(),
},
),
(
"AsRelease",
Layout {
size: size_of::<AsRelease>(),
alignment: align_of::<AsRelease>(),
},
),
(
"AsReleaseClass",
Layout {
size: size_of::<AsReleaseClass>(),
alignment: align_of::<AsReleaseClass>(),
},
),
(
"AsReleaseKind",
Layout {
size: size_of::<AsReleaseKind>(),
alignment: align_of::<AsReleaseKind>(),
},
),
(
"AsReleaseList",
Layout {
size: size_of::<AsReleaseList>(),
alignment: align_of::<AsReleaseList>(),
},
),
(
"AsReleaseListClass",
Layout {
size: size_of::<AsReleaseListClass>(),
alignment: align_of::<AsReleaseListClass>(),
},
),
(
"AsReleaseListKind",
Layout {
size: size_of::<AsReleaseListKind>(),
alignment: align_of::<AsReleaseListKind>(),
},
),
(
"AsReleaseUrlKind",
Layout {
size: size_of::<AsReleaseUrlKind>(),
alignment: align_of::<AsReleaseUrlKind>(),
},
),
(
"AsReview",
Layout {
size: size_of::<AsReview>(),
alignment: align_of::<AsReview>(),
},
),
(
"AsReviewClass",
Layout {
size: size_of::<AsReviewClass>(),
alignment: align_of::<AsReviewClass>(),
},
),
(
"AsReviewFlags",
Layout {
size: size_of::<AsReviewFlags>(),
alignment: align_of::<AsReviewFlags>(),
},
),
(
"AsScreenshot",
Layout {
size: size_of::<AsScreenshot>(),
alignment: align_of::<AsScreenshot>(),
},
),
(
"AsScreenshotClass",
Layout {
size: size_of::<AsScreenshotClass>(),
alignment: align_of::<AsScreenshotClass>(),
},
),
(
"AsScreenshotKind",
Layout {
size: size_of::<AsScreenshotKind>(),
alignment: align_of::<AsScreenshotKind>(),
},
),
(
"AsScreenshotMediaKind",
Layout {
size: size_of::<AsScreenshotMediaKind>(),
alignment: align_of::<AsScreenshotMediaKind>(),
},
),
(
"AsSizeKind",
Layout {
size: size_of::<AsSizeKind>(),
alignment: align_of::<AsSizeKind>(),
},
),
(
"AsSuggested",
Layout {
size: size_of::<AsSuggested>(),
alignment: align_of::<AsSuggested>(),
},
),
(
"AsSuggestedClass",
Layout {
size: size_of::<AsSuggestedClass>(),
alignment: align_of::<AsSuggestedClass>(),
},
),
(
"AsSuggestedKind",
Layout {
size: size_of::<AsSuggestedKind>(),
alignment: align_of::<AsSuggestedKind>(),
},
),
(
"AsSystemInfo",
Layout {
size: size_of::<AsSystemInfo>(),
alignment: align_of::<AsSystemInfo>(),
},
),
(
"AsSystemInfoClass",
Layout {
size: size_of::<AsSystemInfoClass>(),
alignment: align_of::<AsSystemInfoClass>(),
},
),
(
"AsSystemInfoError",
Layout {
size: size_of::<AsSystemInfoError>(),
alignment: align_of::<AsSystemInfoError>(),
},
),
(
"AsTranslation",
Layout {
size: size_of::<AsTranslation>(),
alignment: align_of::<AsTranslation>(),
},
),
(
"AsTranslationClass",
Layout {
size: size_of::<AsTranslationClass>(),
alignment: align_of::<AsTranslationClass>(),
},
),
(
"AsTranslationKind",
Layout {
size: size_of::<AsTranslationKind>(),
alignment: align_of::<AsTranslationKind>(),
},
),
(
"AsUrgencyKind",
Layout {
size: size_of::<AsUrgencyKind>(),
alignment: align_of::<AsUrgencyKind>(),
},
),
(
"AsUrlKind",
Layout {
size: size_of::<AsUrlKind>(),
alignment: align_of::<AsUrlKind>(),
},
),
(
"AsUtilsError",
Layout {
size: size_of::<AsUtilsError>(),
alignment: align_of::<AsUtilsError>(),
},
),
(
"AsValidator",
Layout {
size: size_of::<AsValidator>(),
alignment: align_of::<AsValidator>(),
},
),
(
"AsValidatorClass",
Layout {
size: size_of::<AsValidatorClass>(),
alignment: align_of::<AsValidatorClass>(),
},
),
(
"AsValidatorError",
Layout {
size: size_of::<AsValidatorError>(),
alignment: align_of::<AsValidatorError>(),
},
),
(
"AsValidatorIssue",
Layout {
size: size_of::<AsValidatorIssue>(),
alignment: align_of::<AsValidatorIssue>(),
},
),
(
"AsValidatorIssueClass",
Layout {
size: size_of::<AsValidatorIssueClass>(),
alignment: align_of::<AsValidatorIssueClass>(),
},
),
(
"AsValueFlags",
Layout {
size: size_of::<AsValueFlags>(),
alignment: align_of::<AsValueFlags>(),
},
),
(
"AsVercmpFlags",
Layout {
size: size_of::<AsVercmpFlags>(),
alignment: align_of::<AsVercmpFlags>(),
},
),
(
"AsVideo",
Layout {
size: size_of::<AsVideo>(),
alignment: align_of::<AsVideo>(),
},
),
(
"AsVideoClass",
Layout {
size: size_of::<AsVideoClass>(),
alignment: align_of::<AsVideoClass>(),
},
),
(
"AsVideoCodecKind",
Layout {
size: size_of::<AsVideoCodecKind>(),
alignment: align_of::<AsVideoCodecKind>(),
},
),
(
"AsVideoContainerKind",
Layout {
size: size_of::<AsVideoContainerKind>(),
alignment: align_of::<AsVideoContainerKind>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) AS_AGREEMENT_KIND_EULA", "2"),
("(gint) AS_AGREEMENT_KIND_GENERIC", "1"),
("(gint) AS_AGREEMENT_KIND_PRIVACY", "3"),
("(gint) AS_AGREEMENT_KIND_UNKNOWN", "0"),
("(gint) AS_ARTIFACT_KIND_BINARY", "2"),
("(gint) AS_ARTIFACT_KIND_SOURCE", "1"),
("(gint) AS_ARTIFACT_KIND_UNKNOWN", "0"),
("(gint) AS_BUNDLE_KIND_APPIMAGE", "4"),
("(gint) AS_BUNDLE_KIND_CABINET", "7"),
("(gint) AS_BUNDLE_KIND_FLATPAK", "3"),
("(gint) AS_BUNDLE_KIND_LIMBA", "2"),
("(gint) AS_BUNDLE_KIND_LINGLONG", "8"),
("(gint) AS_BUNDLE_KIND_PACKAGE", "1"),
("(gint) AS_BUNDLE_KIND_SNAP", "5"),
("(gint) AS_BUNDLE_KIND_SYSUPDATE", "9"),
("(gint) AS_BUNDLE_KIND_TARBALL", "6"),
("(gint) AS_BUNDLE_KIND_UNKNOWN", "0"),
("(guint) AS_CACHE_FLAG_NONE", "0"),
("(guint) AS_CACHE_FLAG_NO_CLEAR", "4"),
("(guint) AS_CACHE_FLAG_REFRESH_SYSTEM", "8"),
("(guint) AS_CACHE_FLAG_USE_SYSTEM", "2"),
("(guint) AS_CACHE_FLAG_USE_USER", "1"),
("(gint) AS_CHASSIS_KIND_DESKTOP", "1"),
("(gint) AS_CHASSIS_KIND_HANDSET", "5"),
("(gint) AS_CHASSIS_KIND_LAPTOP", "2"),
("(gint) AS_CHASSIS_KIND_SERVER", "3"),
("(gint) AS_CHASSIS_KIND_TABLET", "4"),
("(gint) AS_CHASSIS_KIND_UNKNOWN", "0"),
("(gint) AS_CHECKSUM_KIND_BLAKE2B", "4"),
("(gint) AS_CHECKSUM_KIND_BLAKE3", "5"),
("(gint) AS_CHECKSUM_KIND_NONE", "0"),
("(gint) AS_CHECKSUM_KIND_SHA1", "1"),
("(gint) AS_CHECKSUM_KIND_SHA256", "2"),
("(gint) AS_CHECKSUM_KIND_SHA512", "3"),
("(gint) AS_CHECK_RESULT_ERROR", "0"),
("(gint) AS_CHECK_RESULT_FALSE", "2"),
("(gint) AS_CHECK_RESULT_TRUE", "3"),
("(gint) AS_CHECK_RESULT_UNKNOWN", "1"),
("(gint) AS_COLOR_KIND_PRIMARY", "1"),
("(gint) AS_COLOR_KIND_UNKNOWN", "0"),
("(gint) AS_COLOR_SCHEME_KIND_DARK", "2"),
("(gint) AS_COLOR_SCHEME_KIND_LIGHT", "1"),
("(gint) AS_COLOR_SCHEME_KIND_UNKNOWN", "0"),
("(guint) AS_COMPONENT_BOX_FLAG_NONE", "0"),
("(guint) AS_COMPONENT_BOX_FLAG_NO_CHECKS", "1"),
("(gint) AS_COMPONENT_KIND_ADDON", "6"),
("(gint) AS_COMPONENT_KIND_CODEC", "9"),
("(gint) AS_COMPONENT_KIND_CONSOLE_APP", "3"),
("(gint) AS_COMPONENT_KIND_DESKTOP_APP", "2"),
("(gint) AS_COMPONENT_KIND_DRIVER", "13"),
("(gint) AS_COMPONENT_KIND_FIRMWARE", "12"),
("(gint) AS_COMPONENT_KIND_FONT", "8"),
("(gint) AS_COMPONENT_KIND_GENERIC", "1"),
("(gint) AS_COMPONENT_KIND_ICON_THEME", "16"),
("(gint) AS_COMPONENT_KIND_INPUT_METHOD", "10"),
("(gint) AS_COMPONENT_KIND_LOCALIZATION", "14"),
("(gint) AS_COMPONENT_KIND_OPERATING_SYSTEM", "11"),
("(gint) AS_COMPONENT_KIND_REPOSITORY", "15"),
("(gint) AS_COMPONENT_KIND_RUNTIME", "7"),
("(gint) AS_COMPONENT_KIND_SERVICE", "5"),
("(gint) AS_COMPONENT_KIND_UNKNOWN", "0"),
("(gint) AS_COMPONENT_KIND_WEB_APP", "4"),
("(gint) AS_COMPONENT_SCOPE_SYSTEM", "1"),
("(gint) AS_COMPONENT_SCOPE_UNKNOWN", "0"),
("(gint) AS_COMPONENT_SCOPE_USER", "2"),
("(gint) AS_CONTENT_RATING_SYSTEM_ACB", "2"),
("(gint) AS_CONTENT_RATING_SYSTEM_CERO", "9"),
("(gint) AS_CONTENT_RATING_SYSTEM_DJCTQ", "3"),
("(gint) AS_CONTENT_RATING_SYSTEM_ESRA", "8"),
("(gint) AS_CONTENT_RATING_SYSTEM_ESRB", "14"),
("(gint) AS_CONTENT_RATING_SYSTEM_GRAC", "13"),
("(gint) AS_CONTENT_RATING_SYSTEM_GSRR", "4"),
("(gint) AS_CONTENT_RATING_SYSTEM_IARC", "15"),
("(gint) AS_CONTENT_RATING_SYSTEM_INCAA", "1"),
("(gint) AS_CONTENT_RATING_SYSTEM_KAVI", "6"),
("(gint) AS_CONTENT_RATING_SYSTEM_MDA", "12"),
("(gint) AS_CONTENT_RATING_SYSTEM_OFLCNZ", "10"),
("(gint) AS_CONTENT_RATING_SYSTEM_PEGI", "5"),
("(gint) AS_CONTENT_RATING_SYSTEM_RUSSIA", "11"),
("(gint) AS_CONTENT_RATING_SYSTEM_UNKNOWN", "0"),
("(gint) AS_CONTENT_RATING_SYSTEM_USK", "7"),
("(gint) AS_CONTENT_RATING_VALUE_INTENSE", "4"),
("(gint) AS_CONTENT_RATING_VALUE_MILD", "2"),
("(gint) AS_CONTENT_RATING_VALUE_MODERATE", "3"),
("(gint) AS_CONTENT_RATING_VALUE_NONE", "1"),
("(gint) AS_CONTENT_RATING_VALUE_UNKNOWN", "0"),
("(gint) AS_CONTROL_KIND_CONSOLE", "3"),
("(gint) AS_CONTROL_KIND_GAMEPAD", "5"),
("(gint) AS_CONTROL_KIND_KEYBOARD", "2"),
("(gint) AS_CONTROL_KIND_POINTING", "1"),
("(gint) AS_CONTROL_KIND_TABLET", "9"),
("(gint) AS_CONTROL_KIND_TOUCH", "4"),
("(gint) AS_CONTROL_KIND_TV_REMOTE", "8"),
("(gint) AS_CONTROL_KIND_UNKNOWN", "0"),
("(gint) AS_CONTROL_KIND_VISION", "7"),
("(gint) AS_CONTROL_KIND_VOICE", "6"),
("(guint) AS_DATA_ID_MATCH_FLAG_BRANCH", "16"),
("(guint) AS_DATA_ID_MATCH_FLAG_BUNDLE_KIND", "2"),
("(guint) AS_DATA_ID_MATCH_FLAG_ID", "8"),
("(guint) AS_DATA_ID_MATCH_FLAG_NONE", "0"),
("(guint) AS_DATA_ID_MATCH_FLAG_ORIGIN", "4"),
("(guint) AS_DATA_ID_MATCH_FLAG_SCOPE", "1"),
("(gint) AS_DISPLAY_SIDE_KIND_LONGEST", "2"),
("(gint) AS_DISPLAY_SIDE_KIND_SHORTEST", "1"),
("(gint) AS_DISPLAY_SIDE_KIND_UNKNOWN", "0"),
("(gint) AS_FORMAT_KIND_DESKTOP_ENTRY", "3"),
("(gint) AS_FORMAT_KIND_UNKNOWN", "0"),
("(gint) AS_FORMAT_KIND_XML", "1"),
("(gint) AS_FORMAT_KIND_YAML", "2"),
("(gint) AS_FORMAT_STYLE_CATALOG", "2"),
("(gint) AS_FORMAT_STYLE_METAINFO", "1"),
("(gint) AS_FORMAT_STYLE_UNKNOWN", "0"),
("(gint) AS_FORMAT_VERSION_UNKNOWN", "0"),
("(gint) AS_FORMAT_VERSION_V1_0", "1"),
("(gint) AS_ICON_KIND_CACHED", "2"),
("(gint) AS_ICON_KIND_LOCAL", "3"),
("(gint) AS_ICON_KIND_REMOTE", "4"),
("(gint) AS_ICON_KIND_STOCK", "1"),
("(gint) AS_ICON_KIND_UNKNOWN", "0"),
("(gint) AS_IMAGE_KIND_SOURCE", "1"),
("(gint) AS_IMAGE_KIND_THUMBNAIL", "2"),
("(gint) AS_IMAGE_KIND_UNKNOWN", "0"),
("(gint) AS_INTERNET_KIND_ALWAYS", "1"),
("(gint) AS_INTERNET_KIND_FIRST_RUN", "3"),
("(gint) AS_INTERNET_KIND_OFFLINE_ONLY", "2"),
("(gint) AS_INTERNET_KIND_UNKNOWN", "0"),
("(gint) AS_ISSUE_KIND_CVE", "2"),
("(gint) AS_ISSUE_KIND_GENERIC", "1"),
("(gint) AS_ISSUE_KIND_UNKNOWN", "0"),
("(gint) AS_ISSUE_SEVERITY_ERROR", "4"),
("(gint) AS_ISSUE_SEVERITY_INFO", "2"),
("(gint) AS_ISSUE_SEVERITY_PEDANTIC", "1"),
("(gint) AS_ISSUE_SEVERITY_UNKNOWN", "0"),
("(gint) AS_ISSUE_SEVERITY_WARNING", "3"),
("(gint) AS_LAUNCHABLE_KIND_COCKPIT_MANIFEST", "3"),
("(gint) AS_LAUNCHABLE_KIND_DESKTOP_ID", "1"),
("(gint) AS_LAUNCHABLE_KIND_SERVICE", "2"),
("(gint) AS_LAUNCHABLE_KIND_UNKNOWN", "0"),
("(gint) AS_LAUNCHABLE_KIND_URL", "4"),
("(gint) AS_MARKUP_KIND_MARKDOWN", "3"),
("(gint) AS_MARKUP_KIND_TEXT", "2"),
("(gint) AS_MARKUP_KIND_UNKNOWN", "0"),
("(gint) AS_MARKUP_KIND_XML", "1"),
("(gint) AS_MERGE_KIND_APPEND", "2"),
("(gint) AS_MERGE_KIND_NONE", "0"),
("(gint) AS_MERGE_KIND_REMOVE_COMPONENT", "3"),
("(gint) AS_MERGE_KIND_REPLACE", "1"),
("(gint) AS_METADATA_ERROR_FAILED", "0"),
("(gint) AS_METADATA_ERROR_FORMAT_UNEXPECTED", "2"),
("(gint) AS_METADATA_ERROR_NO_COMPONENT", "3"),
("(gint) AS_METADATA_ERROR_PARSE", "1"),
("(gint) AS_METADATA_ERROR_VALUE_MISSING", "4"),
("(gint) AS_METADATA_LOCATION_CACHE", "3"),
("(gint) AS_METADATA_LOCATION_SHARED", "1"),
("(gint) AS_METADATA_LOCATION_STATE", "2"),
("(gint) AS_METADATA_LOCATION_UNKNOWN", "0"),
("(gint) AS_METADATA_LOCATION_USER", "4"),
("(guint) AS_PARSE_FLAG_IGNORE_MEDIABASEURL", "1"),
("(guint) AS_PARSE_FLAG_NONE", "0"),
("(gint) AS_POOL_ERROR_CACHE_DAMAGED", "4"),
("(gint) AS_POOL_ERROR_CACHE_WRITE_FAILED", "3"),
("(gint) AS_POOL_ERROR_COLLISION", "2"),
("(gint) AS_POOL_ERROR_FAILED", "0"),
("(gint) AS_POOL_ERROR_INCOMPLETE", "1"),
("(guint) AS_POOL_FLAG_IGNORE_CACHE_AGE", "16"),
("(guint) AS_POOL_FLAG_LOAD_FLATPAK", "8"),
("(guint) AS_POOL_FLAG_LOAD_OS_CATALOG", "1"),
("(guint) AS_POOL_FLAG_LOAD_OS_DESKTOP_FILES", "4"),
("(guint) AS_POOL_FLAG_LOAD_OS_METAINFO", "2"),
("(guint) AS_POOL_FLAG_MONITOR", "128"),
("(guint) AS_POOL_FLAG_NONE", "0"),
("(guint) AS_POOL_FLAG_PREFER_OS_METAINFO", "64"),
("(guint) AS_POOL_FLAG_RESOLVE_ADDONS", "32"),
("(gint) AS_PROVIDED_KIND_BINARY", "2"),
("(gint) AS_PROVIDED_KIND_DBUS_SYSTEM", "7"),
("(gint) AS_PROVIDED_KIND_DBUS_USER", "8"),
("(gint) AS_PROVIDED_KIND_FIRMWARE_FLASHED", "10"),
("(gint) AS_PROVIDED_KIND_FIRMWARE_RUNTIME", "9"),
("(gint) AS_PROVIDED_KIND_FONT", "4"),
("(gint) AS_PROVIDED_KIND_ID", "11"),
("(gint) AS_PROVIDED_KIND_LIBRARY", "1"),
("(gint) AS_PROVIDED_KIND_MEDIATYPE", "3"),
("(gint) AS_PROVIDED_KIND_MODALIAS", "5"),
("(gint) AS_PROVIDED_KIND_PYTHON", "6"),
("(gint) AS_PROVIDED_KIND_UNKNOWN", "0"),
("(gint) AS_REFERENCE_KIND_CITATION_CFF", "2"),
("(gint) AS_REFERENCE_KIND_DOI", "1"),
("(gint) AS_REFERENCE_KIND_REGISTRY", "3"),
("(gint) AS_REFERENCE_KIND_UNKNOWN", "0"),
("(gint) AS_RELATION_COMPARE_EQ", "1"),
("(gint) AS_RELATION_COMPARE_GE", "6"),
("(gint) AS_RELATION_COMPARE_GT", "4"),
("(gint) AS_RELATION_COMPARE_LE", "5"),
("(gint) AS_RELATION_COMPARE_LT", "3"),
("(gint) AS_RELATION_COMPARE_NE", "2"),
("(gint) AS_RELATION_COMPARE_UNKNOWN", "0"),
("(gint) AS_RELATION_ERROR_BAD_VALUE", "1"),
("(gint) AS_RELATION_ERROR_FAILED", "0"),
("(gint) AS_RELATION_ERROR_NOT_IMPLEMENTED", "2"),
("(gint) AS_RELATION_ITEM_KIND_CONTROL", "6"),
("(gint) AS_RELATION_ITEM_KIND_DISPLAY_LENGTH", "7"),
("(gint) AS_RELATION_ITEM_KIND_FIRMWARE", "5"),
("(gint) AS_RELATION_ITEM_KIND_HARDWARE", "8"),
("(gint) AS_RELATION_ITEM_KIND_ID", "1"),
("(gint) AS_RELATION_ITEM_KIND_INTERNET", "9"),
("(gint) AS_RELATION_ITEM_KIND_KERNEL", "3"),
("(gint) AS_RELATION_ITEM_KIND_MEMORY", "4"),
("(gint) AS_RELATION_ITEM_KIND_MODALIAS", "2"),
("(gint) AS_RELATION_ITEM_KIND_UNKNOWN", "0"),
("(gint) AS_RELATION_KIND_RECOMMENDS", "2"),
("(gint) AS_RELATION_KIND_REQUIRES", "1"),
("(gint) AS_RELATION_KIND_SUPPORTS", "3"),
("(gint) AS_RELATION_KIND_UNKNOWN", "0"),
("(gint) AS_RELATION_STATUS_ERROR", "1"),
("(gint) AS_RELATION_STATUS_NOT_SATISFIED", "2"),
("(gint) AS_RELATION_STATUS_SATISFIED", "3"),
("(gint) AS_RELATION_STATUS_UNKNOWN", "0"),
("(gint) AS_RELEASE_KIND_DEVELOPMENT", "2"),
("(gint) AS_RELEASE_KIND_SNAPSHOT", "3"),
("(gint) AS_RELEASE_KIND_STABLE", "1"),
("(gint) AS_RELEASE_KIND_UNKNOWN", "0"),
("(gint) AS_RELEASE_LIST_KIND_EMBEDDED", "1"),
("(gint) AS_RELEASE_LIST_KIND_EXTERNAL", "2"),
("(gint) AS_RELEASE_LIST_KIND_UNKNOWN", "0"),
("(gint) AS_RELEASE_URL_KIND_DETAILS", "1"),
("(gint) AS_RELEASE_URL_KIND_UNKNOWN", "0"),
("(guint) AS_REVIEW_FLAG_NONE", "0"),
("(guint) AS_REVIEW_FLAG_SELF", "1"),
("(guint) AS_REVIEW_FLAG_VOTED", "2"),
("(gint) AS_SCREENSHOT_KIND_DEFAULT", "1"),
("(gint) AS_SCREENSHOT_KIND_EXTRA", "2"),
("(gint) AS_SCREENSHOT_KIND_UNKNOWN", "0"),
("(gint) AS_SCREENSHOT_MEDIA_KIND_IMAGE", "1"),
("(gint) AS_SCREENSHOT_MEDIA_KIND_UNKNOWN", "0"),
("(gint) AS_SCREENSHOT_MEDIA_KIND_VIDEO", "2"),
("(gint) AS_SIZE_KIND_DOWNLOAD", "1"),
("(gint) AS_SIZE_KIND_INSTALLED", "2"),
("(gint) AS_SIZE_KIND_UNKNOWN", "0"),
("(gint) AS_SUGGESTED_KIND_HEURISTIC", "2"),
("(gint) AS_SUGGESTED_KIND_UNKNOWN", "0"),
("(gint) AS_SUGGESTED_KIND_UPSTREAM", "1"),
("(gint) AS_SYSTEM_INFO_ERROR_FAILED", "0"),
("(gint) AS_SYSTEM_INFO_ERROR_NOT_FOUND", "1"),
("(gint) AS_TRANSLATION_KIND_GETTEXT", "1"),
("(gint) AS_TRANSLATION_KIND_QT", "2"),
("(gint) AS_TRANSLATION_KIND_UNKNOWN", "0"),
("(gint) AS_URGENCY_KIND_CRITICAL", "4"),
("(gint) AS_URGENCY_KIND_HIGH", "3"),
("(gint) AS_URGENCY_KIND_LOW", "1"),
("(gint) AS_URGENCY_KIND_MEDIUM", "2"),
("(gint) AS_URGENCY_KIND_UNKNOWN", "0"),
("(gint) AS_URL_KIND_BUGTRACKER", "2"),
("(gint) AS_URL_KIND_CONTACT", "7"),
("(gint) AS_URL_KIND_CONTRIBUTE", "9"),
("(gint) AS_URL_KIND_DONATION", "5"),
("(gint) AS_URL_KIND_FAQ", "3"),
("(gint) AS_URL_KIND_HELP", "4"),
("(gint) AS_URL_KIND_HOMEPAGE", "1"),
("(gint) AS_URL_KIND_TRANSLATE", "6"),
("(gint) AS_URL_KIND_UNKNOWN", "0"),
("(gint) AS_URL_KIND_VCS_BROWSER", "8"),
("(gint) AS_UTILS_ERROR_FAILED", "0"),
("(gint) AS_VALIDATOR_ERROR_FAILED", "0"),
("(gint) AS_VALIDATOR_ERROR_INVALID_FILENAME", "2"),
("(gint) AS_VALIDATOR_ERROR_INVALID_OVERRIDE", "1"),
("(guint) AS_VALUE_FLAG_DUPLICATE_CHECK", "1"),
("(guint) AS_VALUE_FLAG_NONE", "0"),
("(guint) AS_VALUE_FLAG_NO_TRANSLATION_FALLBACK", "2"),
("(guint) AS_VERCMP_FLAG_IGNORE_EPOCH", "1"),
("(guint) AS_VERCMP_FLAG_NONE", "0"),
("(gint) AS_VIDEO_CODEC_KIND_AV1", "2"),
("(gint) AS_VIDEO_CODEC_KIND_UNKNOWN", "0"),
("(gint) AS_VIDEO_CODEC_KIND_VP9", "1"),
("(gint) AS_VIDEO_CONTAINER_KIND_MKV", "1"),
("(gint) AS_VIDEO_CONTAINER_KIND_UNKNOWN", "0"),
("(gint) AS_VIDEO_CONTAINER_KIND_WEBM", "2"),
];