|
@@ -116,29 +116,97 @@ class ManifestGenerator:
|
|
|
"""
|
|
"""
|
|
|
resource_refs = []
|
|
resource_refs = []
|
|
|
|
|
|
|
|
|
|
+ # Define categories of dependencies to filter out
|
|
|
|
|
+ system_libraries = {
|
|
|
|
|
+ # Standard C library
|
|
|
|
|
+ 'libc', 'libc6', 'glibc', 'musl', 'bsdlibc',
|
|
|
|
|
+ # Core system libraries that are always present
|
|
|
|
|
+ 'libm', 'libpthread', 'libdl', 'librt', 'libutil',
|
|
|
|
|
+ # Dynamic linker
|
|
|
|
|
+ 'ld-linux', 'ld.so', 'ld64.so',
|
|
|
|
|
+ # Other fundamental system libraries
|
|
|
|
|
+ 'libgcc_s', 'libstdc++', 'libxcb', 'libx11', 'libxext', 'libxrender',
|
|
|
|
|
+ 'libfontconfig', 'libfreetype', 'libexpat', 'libz', 'libbz2',
|
|
|
|
|
+ 'libpng', 'libjpeg', 'libtiff', 'libgif', 'libwebp',
|
|
|
|
|
+ 'libssl', 'libcrypto', 'libgssapi_krb5', 'libkrb5', 'libcom_err',
|
|
|
|
|
+ 'libresolv', 'libnss_dns', 'libnss_files', 'libnss_compat',
|
|
|
|
|
+ 'libdbus', 'libsystemd', 'libudev', 'libEGL', 'libGL', 'libGLES',
|
|
|
|
|
+ 'libasound', 'libpulse', 'libgtk', 'libgdk', 'libglib', 'libgobject',
|
|
|
|
|
+ 'libgio', 'libcairo', 'libpango', 'libatk', 'libgdk_pixbuf',
|
|
|
|
|
+ 'libsqlite3', 'libxml2', 'libxslt', 'libcurl', 'libnghttp2',
|
|
|
|
|
+ 'libreadline', 'libncurses', 'libtinfo', 'libhistory',
|
|
|
|
|
+ 'libffi', 'libgmp', 'libmpfr', 'libmpc', 'libisl'
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ build_time_dependencies = {
|
|
|
|
|
+ # Build tools that shouldn't be runtime dependencies
|
|
|
|
|
+ 'gcc', 'g++', 'cc', 'c++', 'clang', 'clang++', 'rustc', 'cargo',
|
|
|
|
|
+ 'make', 'cmake', 'ninja', 'meson', 'autotools', 'autoconf', 'automake',
|
|
|
|
|
+ 'libtool', 'pkg-config', 'yacc', 'bison', 'flex', 'm4', 'perl',
|
|
|
|
|
+ 'python', 'python3', 'node', 'nodejs', 'ruby', 'gem', 'java', 'javac',
|
|
|
|
|
+ 'mvn', 'gradle', 'go', 'rust', 'cargo', 'npm', 'pip', 'pecl',
|
|
|
|
|
+ 'doxygen', 'sphinx', 'pandoc', 'groff', 'texinfo', 'help2man',
|
|
|
|
|
+ # Rust-specific build dependencies (crates)
|
|
|
|
|
+ 'generic_format_parser', 'serde', 'serde_derive', 'serde_json', 'tokio',
|
|
|
|
|
+ 'log', 'env_logger', 'clap', 'anyhow', 'thiserror', 'rayon', 'crossbeam',
|
|
|
|
|
+ 'regex', 'lazy_static', 'once_cell', 'parking_lot', 'rand', 'uuid',
|
|
|
|
|
+ 'chrono', 'time', 'bytes', 'futures', 'async_trait', 'tokio',
|
|
|
|
|
+ 'hyper', 'reqwest', 'serde', 'serde_json', 'toml', 'yaml', 'config',
|
|
|
|
|
+ 'tracing', 'slog', 'log', 'env_logger', 'fern', 'pretty_env_logger',
|
|
|
|
|
+ 'criterion', 'proptest', 'quickcheck', 'mockall', 'tempfile'
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
for dep in dependencies:
|
|
for dep in dependencies:
|
|
|
- # This is a simplified conversion
|
|
|
|
|
- # In a real implementation, you'd need more sophisticated mapping
|
|
|
|
|
- dep_lower = dep.lower()
|
|
|
|
|
|
|
+ dep_lower = dep.lower().strip()
|
|
|
|
|
|
|
|
- # Common package name to resource reference mappings
|
|
|
|
|
- if dep_lower.startswith("lib"):
|
|
|
|
|
- # Library dependency
|
|
|
|
|
|
|
+ # Skip empty dependencies
|
|
|
|
|
+ if not dep_lower:
|
|
|
|
|
+ continue
|
|
|
|
|
+
|
|
|
|
|
+ # Filter out system libraries - they're always present and shouldn't be explicit dependencies
|
|
|
|
|
+ if dep_lower in system_libraries:
|
|
|
|
|
+ logger.debug(f"Filtering out system library dependency: {dep}")
|
|
|
|
|
+ continue
|
|
|
|
|
+
|
|
|
|
|
+ # Filter out build-time dependencies - they're not needed at runtime
|
|
|
|
|
+ if dep_lower in build_time_dependencies:
|
|
|
|
|
+ logger.debug(f"Filtering out build-time dependency: {dep}")
|
|
|
|
|
+ continue
|
|
|
|
|
+
|
|
|
|
|
+ # Filter out Rust crates (they typically end with common patterns)
|
|
|
|
|
+ if (dep_lower.endswith('_parser') or dep_lower.endswith('_generator') or
|
|
|
|
|
+ dep_lower.endswith('_serializer') or dep_lower.endswith('_deserializer') or
|
|
|
|
|
+ dep_lower.endswith('_derive') or dep_lower.endswith('_macro') or
|
|
|
|
|
+ dep_lower.startswith('serde_') or dep_lower.startswith('tokio_') or
|
|
|
|
|
+ dep_lower.startswith('tracing_') or dep_lower.startswith('async_') or
|
|
|
|
|
+ '_' in dep_lower and any(suffix in dep_lower for suffix in ['_io', '_util', '_core', '_base', '_common'])):
|
|
|
|
|
+ logger.debug(f"Filtering out Rust crate dependency: {dep}")
|
|
|
|
|
+ continue
|
|
|
|
|
+
|
|
|
|
|
+ # Only process dependencies that are likely to be actual runtime dependencies
|
|
|
|
|
+ # Common package name to resource reference mappings for valid runtime dependencies
|
|
|
|
|
+ if dep_lower.startswith("lib") and not dep_lower.startswith("libformat_parser"):
|
|
|
|
|
+ # Library dependency (but not our internal ones)
|
|
|
lib_name = dep_lower.replace("lib", "")
|
|
lib_name = dep_lower.replace("lib", "")
|
|
|
resource_refs.append(f"lib:{dep_lower}")
|
|
resource_refs.append(f"lib:{dep_lower}")
|
|
|
elif dep_lower.endswith("-dev") or dep_lower.endswith("-devel"):
|
|
elif dep_lower.endswith("-dev") or dep_lower.endswith("-devel"):
|
|
|
- # Development dependency
|
|
|
|
|
- base_name = dep_lower.replace("-dev", "").replace("-devel", "")
|
|
|
|
|
- resource_refs.append(f"inc:{base_name}")
|
|
|
|
|
- elif dep_lower in ["gcc", "clang", "rustc"]:
|
|
|
|
|
- # Compiler dependency
|
|
|
|
|
|
|
+ # Development dependency - skip for runtime
|
|
|
|
|
+ logger.debug(f"Skipping development dependency for runtime: {dep}")
|
|
|
|
|
+ continue
|
|
|
|
|
+ elif dep_lower in ["bash", "sh", "zsh", "fish", "dash"]:
|
|
|
|
|
+ # Shell dependencies
|
|
|
resource_refs.append(f"bin:{dep_lower}")
|
|
resource_refs.append(f"bin:{dep_lower}")
|
|
|
- elif dep_lower in ["python", "python3", "node", "nodejs"]:
|
|
|
|
|
- # Runtime dependency
|
|
|
|
|
|
|
+ elif dep_lower in ["perl", "python", "python3", "ruby", "java", "node", "nodejs"]:
|
|
|
|
|
+ # Runtime interpreter dependencies
|
|
|
resource_refs.append(f"bin:{dep_lower}")
|
|
resource_refs.append(f"bin:{dep_lower}")
|
|
|
- else:
|
|
|
|
|
- # Default to bin for unknown dependencies
|
|
|
|
|
|
|
+ elif dep_lower in ["gzip", "bzip2", "xz", "zip", "unzip", "tar"]:
|
|
|
|
|
+ # Compression utilities
|
|
|
resource_refs.append(f"bin:{dep_lower}")
|
|
resource_refs.append(f"bin:{dep_lower}")
|
|
|
|
|
+ else:
|
|
|
|
|
+ # For unknown dependencies, be conservative and don't include them
|
|
|
|
|
+ # rather than potentially creating invalid dependencies
|
|
|
|
|
+ logger.debug(f"Skipping unknown dependency type: {dep}")
|
|
|
|
|
+ continue
|
|
|
|
|
|
|
|
return resource_refs
|
|
return resource_refs
|
|
|
|
|
|