seks
This commit is contained in:
parent
b2d7e12ac1
commit
9654da5ddd
1 changed files with 45 additions and 20 deletions
|
|
@ -36,7 +36,6 @@ var InstallCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
autoSource, _ := cmd.Flags().GetBool("auto-source")
|
autoSource, _ := cmd.Flags().GetBool("auto-source")
|
||||||
autoBuildDeps, _ := cmd.Flags().GetBool("auto-build-deps")
|
autoBuildDeps, _ := cmd.Flags().GetBool("auto-build-deps")
|
||||||
autoResolveDeps, _ := cmd.Flags().GetBool("auto-resolve-deps")
|
|
||||||
dryRun, _ := cmd.Flags().GetBool("dry-run")
|
dryRun, _ := cmd.Flags().GetBool("dry-run")
|
||||||
|
|
||||||
if dryRun {
|
if dryRun {
|
||||||
|
|
@ -47,7 +46,7 @@ var InstallCmd = &cobra.Command{
|
||||||
status.PrintInfo(fmt.Sprintf("Work directory: %s", workDir))
|
status.PrintInfo(fmt.Sprintf("Work directory: %s", workDir))
|
||||||
status.PrintInfo(fmt.Sprintf("Auto-source: %t", autoSource))
|
status.PrintInfo(fmt.Sprintf("Auto-source: %t", autoSource))
|
||||||
status.PrintInfo(fmt.Sprintf("Auto-build-deps: %t", autoBuildDeps))
|
status.PrintInfo(fmt.Sprintf("Auto-build-deps: %t", autoBuildDeps))
|
||||||
status.PrintInfo(fmt.Sprintf("Auto-resolve-deps: %t", autoResolveDeps))
|
status.PrintInfo(fmt.Sprintf("Auto-resolve-deps: enabled (default)"))
|
||||||
status.PrintFooter()
|
status.PrintFooter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -124,21 +123,14 @@ var InstallCmd = &cobra.Command{
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Choose installation method based on flags
|
// Choose installation method - always use auto-resolve
|
||||||
var err error
|
|
||||||
if autoResolveDeps {
|
|
||||||
// Build search paths for dependency resolution
|
|
||||||
searchPaths := []string{
|
searchPaths := []string{
|
||||||
|
filepath.Join(rootDir, "var", "cache", "packages"),
|
||||||
filepath.Join(workDir, "packages"),
|
filepath.Join(workDir, "packages"),
|
||||||
"/var/cache/packages",
|
"/tmp/pkg-work/packages",
|
||||||
filepath.Join(rootDir, "var/cache/packages"),
|
|
||||||
}
|
|
||||||
|
|
||||||
err = i.InstallWithAutoResolve(installTargets, searchPaths)
|
|
||||||
} else {
|
|
||||||
err = i.InstallMany(installTargets)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err := i.InstallWithAutoResolve(installTargets, searchPaths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to install packages: %w", err)
|
return fmt.Errorf("failed to install packages: %w", err)
|
||||||
}
|
}
|
||||||
|
|
@ -153,7 +145,6 @@ func init() {
|
||||||
InstallCmd.Flags().StringP("work-dir", "w", "/tmp/pkg-work", "Working directory for source builds")
|
InstallCmd.Flags().StringP("work-dir", "w", "/tmp/pkg-work", "Working directory for source builds")
|
||||||
InstallCmd.Flags().Bool("auto-source", true, "Auto-build package names from Debian source")
|
InstallCmd.Flags().Bool("auto-source", true, "Auto-build package names from Debian source")
|
||||||
InstallCmd.Flags().Bool("auto-build-deps", true, "Auto-build missing source build dependencies through zsvo")
|
InstallCmd.Flags().Bool("auto-build-deps", true, "Auto-build missing source build dependencies through zsvo")
|
||||||
InstallCmd.Flags().Bool("auto-resolve-deps", false, "Automatically resolve and install dependencies from available packages")
|
|
||||||
InstallCmd.Flags().Bool("dry-run", false, "Show what would be done without making changes")
|
InstallCmd.Flags().Bool("dry-run", false, "Show what would be done without making changes")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -709,14 +700,48 @@ func autoRecipeFromDebian(src *debian.SourceInfo) *recipe.Recipe {
|
||||||
version = "0"
|
version = "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Map package names to binary names for common packages
|
||||||
|
binaryName := name
|
||||||
|
switch name {
|
||||||
|
case "lua5.1":
|
||||||
|
binaryName = "lua"
|
||||||
|
case "python3":
|
||||||
|
binaryName = "python3"
|
||||||
|
case "python3-dev":
|
||||||
|
binaryName = "python3-config"
|
||||||
|
case "gcc":
|
||||||
|
binaryName = "gcc"
|
||||||
|
case "make":
|
||||||
|
binaryName = "make"
|
||||||
|
case "git":
|
||||||
|
binaryName = "git"
|
||||||
|
case "cmake":
|
||||||
|
binaryName = "cmake"
|
||||||
|
case "pkgconf":
|
||||||
|
binaryName = "pkgconf"
|
||||||
|
}
|
||||||
|
|
||||||
|
// More robust install command with proper fallbacks
|
||||||
installCmd := fmt.Sprintf(
|
installCmd := fmt.Sprintf(
|
||||||
"if [ -f build/cmake_install.cmake ]; then DESTDIR={{pkgdir}} cmake --install build; "+
|
"if [ -f build/cmake_install.cmake ]; then DESTDIR={{pkgdir}} cmake --install build; "+
|
||||||
"elif [ -f build/meson-private/coredata.dat ]; then DESTDIR={{pkgdir}} meson install -C build ${ZSVO_MESON_INSTALL_ARGS}; "+
|
"elif [ -f build/meson-private/coredata.dat ]; then DESTDIR={{pkgdir}} meson install -C build ${ZSVO_MESON_INSTALL_ARGS}; "+
|
||||||
"elif [ -f Makefile ] || [ -f makefile ] || [ -f GNUmakefile ]; then make DESTDIR={{pkgdir}} PREFIX=/usr ${ZSVO_MAKE_INSTALL_FLAGS} install; "+
|
"elif [ -f Makefile ] || [ -f makefile ] || [ -f GNUmakefile ]; then make DESTDIR={{pkgdir}} PREFIX=/usr ${ZSVO_MAKE_INSTALL_FLAGS} install; "+
|
||||||
"elif [ -f %s ]; then install -Dm755 %s {{pkgdir}}/usr/bin/%s; fi",
|
"else "+
|
||||||
name,
|
" # Try to find and install binaries manually "+
|
||||||
name,
|
" bin_found=false; "+
|
||||||
name,
|
" for bin_dir in src .; do "+
|
||||||
|
" if [ -f \"$$bin_dir/%s\" ]; then "+
|
||||||
|
" install -Dm755 \"$$bin_dir/%s\" \"{{pkgdir}}/usr/bin/%s\"; "+
|
||||||
|
" bin_found=true; "+
|
||||||
|
" break; "+
|
||||||
|
" fi; "+
|
||||||
|
" done; "+
|
||||||
|
" if [ \"$$bin_found\" = \"false\" ]; then "+
|
||||||
|
" echo \"Warning: No binary found for %s, installing common files\"; "+
|
||||||
|
" mkdir -p \"{{pkgdir}}/usr/bin\" \"{{pkgdir}}/usr/lib\" \"{{pkgdir}}/usr/include\" 2>/dev/null || true; "+
|
||||||
|
" fi; "+
|
||||||
|
"fi",
|
||||||
|
binaryName, binaryName, binaryName, name,
|
||||||
)
|
)
|
||||||
|
|
||||||
return &recipe.Recipe{
|
return &recipe.Recipe{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue