source: trunk/base/src/port1.0/portpatch.tcl @ 295

Last change on this file since 295 was 295, checked in by landonf (Landon Fuller), 18 years ago

Implement all init routines

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.1 KB
Line 
1# ex:ts=4
2#
3# Insert some license text here at some point soon.
4#
5
6package provide portpatch 1.0
7package require portutil 1.0
8
9register com.apple.patch target patch_main patch_init
10register com.apple.patch provides patch
11register com.apple.patch requires main fetch checksum extract depends_build depends_lib
12
13set UI_PREFIX "---> "
14
15proc patch_init {args} {
16    return 0
17}
18
19proc patch_main {args} {
20    global portname patchfiles distpath filedir workdir portpath UI_PREFIX
21
22    if ![info exists patchfiles] {
23        return 0
24    }
25    foreach patch $patchfiles {
26        if [file exists $portpath/$filedir/$patch] {
27            lappend patchlist $portpath/$filedir/$patch
28        } elseif [file exists $distpath/$patch] {
29            lappend patchlist $distpath/$patch
30        }
31    }
32    if ![info exists patchlist] {
33        return -code error "Patch files missing"
34    }
35    cd $portpath/$workdir
36    foreach patch $patchlist {
37        ui_info "$UI_PREFIX Applying $patch"
38        switch -glob -- [file tail $patch] {
39            *.Z -
40            *.gz {system "gzcat $patch | patch -p0"}
41            *.bz2 {system "bzcat $patch | patch -p0"}
42            default {system "patch -p0 < $patch"}
43        }
44    }
45    return 0
46}
47
Note: See TracBrowser for help on using the repository browser.