diff --git a/cmd/install.go b/cmd/install.go index f48a896..8273eb6 100644 --- a/cmd/install.go +++ b/cmd/install.go @@ -184,7 +184,7 @@ func looksLikeFilePath(target string) bool { strings.HasSuffix(target, ".zov") } -const maxAutoBuildDepth = 3 // Уменьшим для тестов +const maxAutoBuildDepth = 15 // Увеличим для сложных цепочек зависимостей type autoBuildSession struct { workDir string diff --git a/pkg/builder/builder.go b/pkg/builder/builder.go index caebd87..33eaccc 100644 --- a/pkg/builder/builder.go +++ b/pkg/builder/builder.go @@ -665,7 +665,6 @@ func (b *Builder) validateCommand(command string) error { "init 6", "eval", "$(", // command substitution - "${", // parameter expansion } // Check against original diff --git a/pkg/fetcher/fetcher.go b/pkg/fetcher/fetcher.go index fbfb0a3..629b02d 100644 --- a/pkg/fetcher/fetcher.go +++ b/pkg/fetcher/fetcher.go @@ -201,8 +201,19 @@ func (f *Fetcher) downloadAndExtractFromDebianDSC(dscURL, dscHash, destDir strin origEntries = append(origEntries, entry) } } + + // If no orig archives found, this might be a Debian-native package + // Fall back to the main source tarball (which doesn't have .orig in name) if len(origEntries) == 0 { - return fmt.Errorf("debian dsc does not contain upstream orig archive") + for _, entry := range entries { + if isDebianSourceArchive(entry.Name) { + origEntries = append(origEntries, entry) + } + } + } + + if len(origEntries) == 0 { + return fmt.Errorf("debian dsc does not contain any recognizable source archive") } base, err := neturl.Parse(dscURL) @@ -312,6 +323,34 @@ func isDebianOrigArchive(name string) bool { return false } +func isDebianSourceArchive(name string) bool { + // Debian-native packages have .tar.gz or .tar.xz without .orig in the name + // e.g., package_1.0.tar.gz (not package_1.0.orig.tar.gz) + if isDebianOrigArchive(name) { + return false // This is an orig archive, not a native source + } + + // Check if it looks like a source tarball (has .tar suffix) + if !strings.Contains(name, ".tar") { + return false + } + + // Exclude .dsc and .debian.tar files + if strings.HasSuffix(name, ".dsc") { + return false + } + if strings.Contains(name, ".debian.tar") { + return false + } + if strings.Contains(name, ".diff.") { + return false + } + if strings.Contains(name, ".asc") { // signature files + return false + } + + return hasTarSuffix(name) +} func hasTarSuffix(s string) bool { if !strings.HasPrefix(s, ".tar") { return false