Skip to main content
Glama

analyze_makepkg_conf

Parse and analyze makepkg.conf to extract CFLAGS, MAKEFLAGS, compression settings, and build configuration for Arch Linux package building.

Instructions

[CONFIG] Parse and analyze makepkg.conf. Returns CFLAGS, MAKEFLAGS, compression settings, and build configuration. Only works on Arch Linux.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that reads makepkg.conf, parses it as shell variables using regex, extracts and processes key settings (CFLAGS, CXXFLAGS, MAKEFLAGS with job parsing, BUILDENV, OPTIONS, CARCH, PKGEXT), handles errors, and returns structured JSON-like dictionary. Only available on Arch Linux.
    async def analyze_makepkg_conf() -> Dict[str, Any]: """ Parse and analyze makepkg.conf. Returns: Dict with parsed makepkg configuration """ if not IS_ARCH: return create_error_response( "NotSupported", "This feature is only available on Arch Linux" ) logger.info("Analyzing makepkg.conf") try: makepkg_conf = Path(MAKEPKG_CONF) if not makepkg_conf.exists(): return create_error_response( "NotFound", f"makepkg.conf not found at {MAKEPKG_CONF}" ) config = {} # Parse as shell script variables with open(makepkg_conf, 'r') as f: for line in f: line = line.strip() # Skip comments and empty lines if not line or line.startswith('#'): continue # Match VAR=value or VAR="value" match = re.match(r'^([A-Z_]+)=(.+)$', line) if match: key = match.group(1) value = match.group(2) # Remove quotes value = value.strip('"').strip("'") config[key] = value # Extract important settings cflags = config.get("CFLAGS", "") cxxflags = config.get("CXXFLAGS", "") makeflags = config.get("MAKEFLAGS", "") buildenv = config.get("BUILDENV", "") options = config.get("OPTIONS", "") # Parse MAKEFLAGS for job count jobs = 1 jobs_match = re.search(r'-j\s*(\d+)', makeflags) if jobs_match: jobs = int(jobs_match.group(1)) # Parse BUILDENV buildenv_list = [opt.strip() for opt in buildenv.split()] if buildenv else [] # Parse OPTIONS options_list = [opt.strip() for opt in options.split()] if options else [] # Detect architecture carch = config.get("CARCH", "unknown") # Compression settings pkgext = config.get("PKGEXT", ".pkg.tar.zst") logger.info(f"Parsed makepkg.conf: {jobs} jobs, {carch} arch") return { "config_path": str(makepkg_conf), "cflags": cflags, "cxxflags": cxxflags, "makeflags": makeflags, "jobs": jobs, "buildenv": buildenv_list, "options": options_list, "carch": carch, "pkgext": pkgext, "all_config": config } except Exception as e: logger.error(f"Failed to analyze makepkg.conf: {e}") return create_error_response( "ConfigParseError", f"Failed to analyze makepkg.conf: {str(e)}" )
  • MCP tool registration in @server.list_tools(). Defines the tool name, description, and empty input schema (no parameters required).
    name="analyze_makepkg_conf", description="[CONFIG] Parse and analyze makepkg.conf. Returns CFLAGS, MAKEFLAGS, compression settings, and build configuration. Only works on Arch Linux.", inputSchema={ "type": "object", "properties": {} } ),
  • Tool dispatcher in @server.call_tool(). Checks if on Arch Linux, calls the analyze_makepkg_conf handler from config.py, JSON serializes the result, and returns as TextContent.
    elif name == "analyze_makepkg_conf": if not IS_ARCH: return [TextContent(type="text", text="Error: analyze_makepkg_conf only available on Arch Linux systems")] result = await analyze_makepkg_conf() return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • Import statement in __init__.py that exposes the analyze_makepkg_conf function for use in the server module.
    from .config import ( analyze_pacman_conf, analyze_makepkg_conf, check_ignored_packages, get_parallel_downloads_setting )
  • Tool metadata definition categorizing it as config tool for Arch Linux, read-only, exploration workflow, related to pacman.conf analysis.
    "analyze_makepkg_conf": ToolMetadata( name="analyze_makepkg_conf", category="config", platform="arch", permission="read", workflow="explore", related_tools=["analyze_pacman_conf"], prerequisite_tools=[] ),

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nihalxkumar/arch-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server