Ignore:
Timestamp:
Jun 1, 2013, 8:55:55 AM (7 years ago)
Author:
jmr@…
Message:

bring back clean --archive since files can persist in incoming/ in some circumstances

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portutil.tcl

    r106614 r106617  
    25322532}
    25332533
     2534# return the specified piece of metadata from the +CONTENTS file in the given archive
     2535proc extract_archive_metadata {archive_location archive_type metadata_type} {
     2536    set qflag ${portutil::autoconf::tar_q}
     2537    set raw_contents ""
     2538    switch -- $archive_type {
     2539        tbz -
     2540        tbz2 {
     2541            set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xOj${qflag}f $archive_location ./+CONTENTS]
     2542        }
     2543        tgz {
     2544            set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xOz${qflag}f $archive_location ./+CONTENTS]
     2545        }
     2546        tar {
     2547            set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xO${qflag}f $archive_location ./+CONTENTS]
     2548        }
     2549        txz {
     2550            set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xO${qflag}f $archive_location --use-compress-program [findBinary xz ""] ./+CONTENTS]
     2551        }
     2552        tlz {
     2553            set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xO${qflag}f $archive_location --use-compress-program [findBinary lzma ""] ./+CONTENTS]
     2554        }
     2555        xar {
     2556            system "cd ${workpath} && [findBinary xar ${portutil::autoconf::xar_path}] -xf $archive_location +CONTENTS"
     2557            set twostep 1
     2558        }
     2559        zip {
     2560            set raw_contents [exec [findBinary unzip ${portutil::autoconf::unzip_path}] -p $archive_location +CONTENTS]
     2561        }
     2562        cpgz {
     2563            system "cd ${workpath} && [findBinary pax ${portutil::autoconf::pax_path}] -rzf $archive_location +CONTENTS"
     2564            set twostep 1
     2565        }
     2566        cpio {
     2567            system "cd ${workpath} && [findBinary pax ${portutil::autoconf::pax_path}] -rf $archive_location +CONTENTS"
     2568            set twostep 1
     2569        }
     2570    }
     2571    if {[info exists twostep]} {
     2572        set fd [open "${workpath}/+CONTENTS"]
     2573        set raw_contents [read $fd]
     2574        close $fd
     2575    }
     2576    if {$metadata_type == "contents"} {
     2577        set contents {}
     2578        set ignore 0
     2579        set sep [file separator]
     2580        foreach line [split $raw_contents \n] {
     2581            if {$ignore} {
     2582                set ignore 0
     2583                continue
     2584            }
     2585            if {[string index $line 0] != "@"} {
     2586                lappend contents "${sep}${line}"
     2587            } elseif {$line == "@ignore"} {
     2588                set ignore 1
     2589            }
     2590        }
     2591        return $contents
     2592    } elseif {$metadata_type == "portname"} {
     2593        foreach line [split $raw_contents \n] {
     2594            if {[lindex $line 0] == "@portname"} {
     2595                return [lindex $line 1]
     2596            }
     2597        }
     2598        return ""
     2599    } else {
     2600        return -code error "unknown metadata_type: $metadata_type"
     2601    }
     2602}
     2603
    25342604#
    25352605# merge function for universal builds
Note: See TracChangeset for help on using the changeset viewer.