Documentation
¶
Index ¶
- Constants
- func DetectBuildSystem(dir string) (string, error)
- func ExportModuleBundle(options *ExportBundleOptions) error
- func ImportModuleBundle(options *ImportBundleOptions) error
- type BuildAndInstallModuleFunc
- type BuildProgressCallback
- type BuildProgressStage
- type CheckOutdatedOptions
- type DirectoryCandidate
- type DownloadModuleFunc
- type DownloadOptions
- type DownloadResult
- type ExportBundleOptions
- type ExtractModuleArchiveFunc
- type ExtractionResult
- type ImportBundleOptions
- type InstallProgressCallback
- type InstallProgressStage
- type InstalledModule
- type MirrorSettings
- type ModuleBuildOptions
- type ModuleBuildResult
- type ModuleBundleEntry
- type ModuleBundleInfo
- type ModuleInstallFailure
- type ModuleInstallOptions
- type ModuleInstallResult
- type ModuleInstallTask
- type ModuleListOptions
- type OutdatedModuleInfo
- type ParallelInstallOptions
- type ParallelInstallResult
- type ProgressCallback
- type RemoveModuleOptions
- type RemoveModuleResult
- type TAPParser
Constants ¶
const ( ErrBuildFailed = "PVI-4201" // Failed to build module ErrTestFailed = "PVI-4202" // Module tests failed ErrInstallFailed = "PVI-4203" // Failed to install module ErrDependencyFailed = "PVI-4204" // Failed to resolve dependencies ErrInvalidBuildOpts = "PVI-4205" // Invalid build options ErrBuildCancelled = "PVI-4206" // Build process cancelled ErrBadBuildSystem = "PVI-4207" // Unsupported build system ErrPerlNotFound = "PVI-4208" // Perl interpreter not found ErrCleanupFailed = "PVI-4209" // Failed to clean up build files ErrPrereqFailed = "PVI-4210" // Failed to install prerequisites )
Error codes for build operations
const ( ErrDownloadFailed = "PVI-4001" // Failed to download module archive ErrChecksumMismatch = "PVI-4002" // Checksum validation failed ErrCacheFailed = "PVI-4003" // Failed to cache downloaded file ErrInvalidMirror = "PVI-4004" // Invalid or unreachable mirror ErrInvalidDestination = "PVI-4005" // Invalid destination path ErrModuleNotFound = "PVI-4006" // Module not found in the registry )
Error codes for module download operations
const ( MaxRetries = 3 // Maximum number of download retries RetryDelay = 3 // Delay between retries in seconds DefaultTTL = 24 * 7 // Default cache TTL in hours (1 week) MaxProgress = 10 // Maximum number of progress updates per second MaxTimeout = 10 * 60 // Maximum download timeout in seconds (10 minutes) )
Default values and constants
const ( ErrExtractionFailed = "PVI-4101" // Failed to extract module archive ErrBadArchiveFormat = "PVI-4102" // Unsupported or corrupted archive format ErrBuildDirFailed = "PVI-4103" // Failed to create build directory )
Error codes for extraction operations
const ( ErrInstallationFailed = "PVI-4301" // General installation failure ErrModuleNotResolved = "PVI-4302" // Module could not be resolved ErrModuleMissing = "PVI-4303" // Module not found in registry ErrDependencyFailure = "PVI-4304" // Dependency resolution failed )
Error codes for module installation operations
const ( ErrListModulesFailed = "PVI-4401" // Failed to list installed modules ErrUpdateModuleFailed = "PVI-4402" // Failed to update module ErrRemoveModuleFailed = "PVI-4403" // Failed to remove module ErrBundleExportFailed = "PVI-4404" // Failed to export module bundle ErrBundleImportFailed = "PVI-4405" // Failed to import module bundle )
Error codes for module management operations
Variables ¶
This section is empty.
Functions ¶
func DetectBuildSystem ¶
DetectBuildSystem determines the build system used by a module
func ExportModuleBundle ¶
func ExportModuleBundle(options *ExportBundleOptions) error
ExportModuleBundle exports installed modules to a bundle file
func ImportModuleBundle ¶
func ImportModuleBundle(options *ImportBundleOptions) error
ImportModuleBundle imports modules from a bundle file
Types ¶
type BuildAndInstallModuleFunc ¶
type BuildAndInstallModuleFunc func(options *ModuleBuildOptions) (*ModuleBuildResult, error)
BuildAndInstallModuleFunc is the function type for building and installing a Perl module
var BuildAndInstallModule BuildAndInstallModuleFunc = buildAndInstallModule
BuildAndInstallModule is a variable that holds the module build and install function It can be replaced in tests
type BuildProgressCallback ¶
type BuildProgressCallback func(stage BuildProgressStage, details string, progress float64)
BuildProgressCallback is called to report progress during the build process
type BuildProgressStage ¶
type BuildProgressStage int
BuildProgressStage represents a stage in the module build process
const ( // Module build stages StagePrepare BuildProgressStage = iota StageCreateBuildScript StageBuild StageTest StageInstall StageCleanup StageDone )
func (BuildProgressStage) String ¶
func (s BuildProgressStage) String() string
String returns a string representation of the build stage
type CheckOutdatedOptions ¶
type CheckOutdatedOptions struct {
// Path to the Perl interpreter to use
PerlPath string
// Pattern to filter modules by name
Pattern string
// Include core modules
IncludeCore bool
// CPAN provider for metadata
Provider interface{} // This should be cpan.Provider but avoiding circular imports
// Context for cancellation
Context context.Context
}
CheckOutdatedOptions contains options for checking outdated modules
type DirectoryCandidate ¶
DirectoryCandidate represents a potential root directory
type DownloadModuleFunc ¶
type DownloadModuleFunc func(options *DownloadOptions) (*DownloadResult, error)
DownloadModuleFunc is the function type for downloading a CPAN module
var DownloadModule DownloadModuleFunc = downloadModule
DownloadModule is a variable that holds the module downloading function It can be replaced in tests
type DownloadOptions ¶
type DownloadOptions struct {
// Module name to download
ModuleName string
// Version constraint for the module
VersionConstraint string
// CPAN mirror URL to use
Mirror string
// Directory to store downloaded files
CacheDir string
// TTL for cached files in hours
CacheTTL int
// Skip using cache
SkipCache bool
// Progress callback function
ProgressCallback ProgressCallback
// Maximum number of retries for failed downloads
MaxRetries int
// Skip checksum validation
SkipChecksum bool
// CPAN provider for metadata
Provider cpan.Provider
// Context for cancellation
Context context.Context
}
DownloadOptions contains options for downloading modules
type DownloadResult ¶
type DownloadResult struct {
// Path to the downloaded file
Path string
// Module name
ModuleName string
// Version of the downloaded module
Version string
// Size of the downloaded file in bytes
Size int64
// Checksum of the downloaded file
Checksum string
// Whether the file was loaded from cache
FromCache bool
// Time taken to download
Duration time.Duration
// Distribution name (module distribution on CPAN)
Distribution string
// Author of the module
Author string
}
DownloadResult contains information about the downloaded module
type ExportBundleOptions ¶
type ExportBundleOptions struct {
// Path to the output file
OutputPath string
// Bundle name
Name string
// Bundle description
Description string
// Path to the Perl interpreter to use
PerlPath string
// Pattern to filter modules by name
Pattern string
// Include core modules
IncludeCore bool
// Include version constraints
IncludeVersions bool
// Context for cancellation
Context context.Context
}
ExportBundleOptions contains options for exporting a module bundle
type ExtractModuleArchiveFunc ¶
type ExtractModuleArchiveFunc func(archivePath, targetDir string, ctx context.Context) (*ExtractionResult, error)
ExtractModuleArchiveFunc is the function type for extracting a module archive
var ExtractModuleArchive ExtractModuleArchiveFunc = extractModuleArchive
ExtractModuleArchive is a variable that holds the module extraction function It can be replaced in tests
type ExtractionResult ¶
type ExtractionResult struct {
// Path to the extracted directory
ExtractedDir string
// Module name
ModuleName string
// Original archive path
ArchivePath string
// Distribution name from CPAN
Distribution string
// Root directory of the extraction
RootDir string
}
ExtractionResult contains information about the extracted module
type ImportBundleOptions ¶
type ImportBundleOptions struct {
// Path to the input file
InputPath string
// Path to the Perl interpreter to use
PerlPath string
// Installation directory (usually site_perl)
InstallDir string
// Skip tests during installation
SkipTests bool
// Force installation even if tests fail
Force bool
// Include verbose output
Verbose bool
// Skip prerequisite installation (dependencies)
SkipDependencies bool
// CPAN provider for metadata
Provider interface{} // This should be cpan.Provider but avoiding circular imports
// Dependency resolver
DependencyResolver interface{} // This should be deps.DependencyResolver
// Progress callback
ProgressCallback func(module string, current, total int, details string)
// Context for cancellation
Context context.Context
}
ImportBundleOptions contains options for importing a module bundle
type InstallProgressCallback ¶
type InstallProgressCallback func(stage InstallProgressStage, moduleName string, details string, progress float64)
InstallProgressCallback is called to report progress during installation
type InstallProgressStage ¶
type InstallProgressStage int
InstallProgressStage represents a stage in the module installation process
const ( // Module installation stages StageResolving InstallProgressStage = iota StageDownloading StageExtracting StageBuilding StageTesting StageInstallingModule StageCleaningUp StageFinished )
func (InstallProgressStage) String ¶
func (s InstallProgressStage) String() string
String returns a string representation of the installation stage
type InstalledModule ¶
type InstalledModule struct {
Name string `json:"name"`
Version string `json:"version"`
Path string `json:"path"`
InstallationTime time.Time `json:"installation_time,omitempty"`
Description string `json:"description,omitempty"`
PerlVersion string `json:"perl_version,omitempty"`
CoreModule bool `json:"core_module,omitempty"`
}
InstalledModule represents an installed Perl module
func ListInstalledModules ¶
func ListInstalledModules(options *ModuleListOptions) ([]*InstalledModule, error)
ListInstalledModules lists all installed Perl modules
type MirrorSettings ¶
type MirrorSettings struct {
// Default mirror
DefaultMirror string `json:"default_mirror"`
// Additional mirrors
AdditionalMirrors []string `json:"additional_mirrors"`
}
MirrorSettings represents the mirror configuration
type ModuleBuildOptions ¶
type ModuleBuildOptions struct {
// Path to the extracted module directory
ModuleDir string
// Module name
ModuleName string
// Distribution name
Distribution string
// Path to the Perl interpreter to use
PerlPath string
// Installation directory (usually site_perl)
InstallDir string
// BuildDir is the directory for temporary build files
BuildDir string
// Run tests before installation
RunTests bool
// Skip tests completely
NoTest bool
// Force installation even if tests fail
Force bool
// Clean build directory after installation
Cleanup bool
// Include verbose output
Verbose bool
// Additional arguments to pass to build commands
BuildArgs []string
// Additional arguments to pass to test commands
TestArgs []string
// Additional arguments to pass to install commands
InstallArgs []string
// Skip prerequisite installation
SkipPrereqs bool
// Environment variables for the build process (e.g., local::lib setup)
Environment map[string]string
// Progress callback
ProgressCallback BuildProgressCallback
// Context for cancellation
Context context.Context
}
ModuleBuildOptions contains options for building a module
type ModuleBuildResult ¶
type ModuleBuildResult struct {
// Module name
ModuleName string
// Distribution name
Distribution string
// Whether the module was successfully built
Success bool
// Whether the module was successfully installed
Installed bool
// Whether tests were run and passed
TestsPassed bool
// Detailed test results if tests were run
TestResults *errors.TestResults
// Warning messages from the build process
Warnings []string
// Error messages from the build process
Errors []string
// Output from the build process
Output string
// Duration is the total time taken to build
Duration time.Duration
// Stages contains timing information for each stage
Stages map[BuildProgressStage]time.Duration
}
ModuleBuildResult contains information about the build
type ModuleBundleEntry ¶
type ModuleBundleEntry struct {
// Module name
Name string `json:"name"`
// Module version constraint (e.g., ">=2.0.0")
VersionConstraint string `json:"version_constraint,omitempty"`
// Development dependency
IsDev bool `json:"is_dev,omitempty"`
// Optional dependency
IsOptional bool `json:"is_optional,omitempty"`
}
ModuleBundleEntry represents a module in a bundle
type ModuleBundleInfo ¶
type ModuleBundleInfo struct {
// Name of the bundle
Name string `json:"name"`
// Description of the bundle
Description string `json:"description"`
// Created timestamp
Created time.Time `json:"created"`
// Perl version used to create the bundle
PerlVersion string `json:"perl_version"`
// Modules included in the bundle
Modules []*ModuleBundleEntry `json:"modules"`
}
ModuleBundleInfo represents a bundle of modules for export/import
type ModuleInstallFailure ¶
ModuleInstallFailure represents a failed module installation
type ModuleInstallOptions ¶
type ModuleInstallOptions struct {
// Module name to install
ModuleName string
// Version constraint for the module
VersionConstraint string
// Path to the Perl interpreter to use
PerlPath string
// Installation directory (optional - if empty, will use XDG data directory)
InstallDir string
// Run tests before installation
RunTests bool
// Skip tests completely
NoTest bool
// Force installation even if tests fail
Force bool
// Clean build directory after installation
Cleanup bool
// Include verbose output
Verbose bool
// Skip prerequisite installation (dependencies)
SkipDependencies bool
// Additional build arguments
BuildArgs []string
// CPAN provider for metadata
Provider cpan.Provider
// Dependency resolver
DependencyResolver deps.DependencyResolver
// Progress callback
ProgressCallback InstallProgressCallback
// Context for cancellation
Context context.Context
// Project context (nil means no project context)
ProjectContext *project.ProjectContext
// Force global installation even in project context
ForceGlobal bool
}
ModuleInstallOptions contains options for installing a module
type ModuleInstallResult ¶
type ModuleInstallResult struct {
// Module name
ModuleName string
// Module version
Version string
// Whether the module was successfully installed
Success bool
// Warning messages from the installation process
Warnings []string
// Error messages from the installation process
Errors []string
// The path where the module was installed
InstallPath string
// List of dependencies that were resolved and installed
Dependencies []*ModuleInstallResult
// Total time taken for installation
Duration time.Duration
}
ModuleInstallResult contains information about the installation
func InstallModule ¶
func InstallModule(options *ModuleInstallOptions) (*ModuleInstallResult, error)
InstallModule installs a Perl module and its dependencies
type ModuleInstallTask ¶
type ModuleInstallTask struct {
// contains filtered or unexported fields
}
ModuleInstallTask implements the parallel.Task interface for module installation
func NewModuleInstallTask ¶
func NewModuleInstallTask(options *ModuleInstallOptions, priority int) *ModuleInstallTask
NewModuleInstallTask creates a new module installation task
func (*ModuleInstallTask) Execute ¶
func (t *ModuleInstallTask) Execute(ctx context.Context) error
Execute implements the Task interface
func (*ModuleInstallTask) GetResult ¶
func (t *ModuleInstallTask) GetResult() *ModuleInstallResult
GetResult returns the installation result (safe to call after Execute)
func (*ModuleInstallTask) ID ¶
func (t *ModuleInstallTask) ID() string
ID implements the Task interface
func (*ModuleInstallTask) Priority ¶
func (t *ModuleInstallTask) Priority() int
Priority implements the Task interface
type ModuleListOptions ¶
type ModuleListOptions struct {
// Path to the Perl interpreter to use
PerlPath string
// Pattern to filter modules by name
Pattern string
// Include core modules
IncludeCore bool
// Show only the latest version of each module
LatestOnly bool
// Context for cancellation
Context context.Context
}
ModuleListOptions contains options for listing installed modules
type OutdatedModuleInfo ¶
type OutdatedModuleInfo struct {
// Name of the module
Name string `json:"name"`
// Currently installed version
InstalledVersion string `json:"installed_version"`
// Latest available version
LatestVersion string `json:"latest_version"`
// Upgrade available flag
UpgradeAvailable bool `json:"upgrade_available"`
}
OutdatedModuleInfo represents information about an outdated module
func CheckOutdatedModules ¶
func CheckOutdatedModules(options *CheckOutdatedOptions, checkLatest func(string) (string, error)) ([]*OutdatedModuleInfo, error)
CheckOutdatedModules checks for modules that have newer versions available
type ParallelInstallOptions ¶
type ParallelInstallOptions struct {
// Modules to install with their individual options
Modules []*ModuleInstallOptions
// Number of parallel workers (0 = auto-detect)
Workers int
// Whether to stop on first error
StopOnError bool
// Maximum time to wait for all installations
Timeout time.Duration
// Progress callback for overall progress
ProgressCallback func(completed, total int, currentModule string, stage InstallProgressStage)
// Context for cancellation
Context context.Context
}
ParallelInstallOptions contains options for parallel module installation
type ParallelInstallResult ¶
type ParallelInstallResult struct {
// Individual results for each module
Results []*ModuleInstallResult
// Modules that failed to install
Failures []ModuleInstallFailure
// Total time taken
Duration time.Duration
// Number of successful installations
SuccessCount int
// Number of failed installations
FailureCount int
// Installation order (modules installed in parallel may complete out of order)
InstallationOrder []string
}
ParallelInstallResult contains results from parallel installation
func InstallModulesBatch ¶
func InstallModulesBatch(moduleNames []string, options *ModuleInstallOptions) (*ParallelInstallResult, error)
InstallModulesBatch is a convenience function for batch installation with sensible defaults
func InstallModulesParallel ¶
func InstallModulesParallel(options *ParallelInstallOptions) (*ParallelInstallResult, error)
InstallModulesParallel installs multiple modules in parallel using the worker pool
type ProgressCallback ¶
ProgressCallback is a function that reports download progress
type RemoveModuleOptions ¶
type RemoveModuleOptions struct {
// Module name to remove
ModuleName string
// Path to the Perl interpreter to use
PerlPath string
// Force removal even if there are dependencies
Force bool
// Include verbose output
Verbose bool
// Context for cancellation
Context context.Context
}
RemoveModuleOptions contains options for removing a module
type RemoveModuleResult ¶
type RemoveModuleResult struct {
// Module name that was removed
ModuleName string
// Command output (for verbose mode)
Output string
// Success indicates if the removal was successful
Success bool
}
RemoveModuleResult contains the result of a module removal operation
func RemoveModule ¶
func RemoveModule(options *RemoveModuleOptions) (*RemoveModuleResult, error)
RemoveModule uninstalls a Perl module
type TAPParser ¶
type TAPParser struct {
// contains filtered or unexported fields
}
TAPParser parses test output in TAP format
func NewTAPParser ¶
NewTAPParser creates a new TAP output parser
func (*TAPParser) AnalyzeFailureCause ¶
func (p *TAPParser) AnalyzeFailureCause(results *errors.TestResults) string
AnalyzeFailureCause analyzes test results to determine likely failure cause
func (*TAPParser) GetRecoveryActions ¶
func (p *TAPParser) GetRecoveryActions(module string, results *errors.TestResults) []errors.ActionOption
GetRecoveryActions suggests recovery actions based on failure analysis
func (*TAPParser) ParseTestOutput ¶
func (p *TAPParser) ParseTestOutput(output string) *errors.TestResults
ParseTestOutput parses test output and returns structured results