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

Last change on this file since 13738 was 13738, checked in by pguyot (Paul Guyot), 15 years ago

Add a lot of missing $Id$

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 3.0 KB
Line 
1# et:ts=4
2# portpatch.tcl
3# $Id: portpatch.tcl,v 1.29 2005/08/27 00:07:30 pguyot Exp $
4#
5# Copyright (c) 2002 - 2003 Apple Computer, Inc.
6# All rights reserved.
7#
8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions
10# are met:
11# 1. Redistributions of source code must retain the above copyright
12#    notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright
14#    notice, this list of conditions and the following disclaimer in the
15#    documentation and/or other materials provided with the distribution.
16# 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
17#    may be used to endorse or promote products derived from this software
18#    without specific prior written permission.
19#
20# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30# POSSIBILITY OF SUCH DAMAGE.
31#
32
33package provide portpatch 1.0
34package require portutil 1.0
35
36set com.apple.patch [target_new com.apple.patch patch_main]
37target_provides ${com.apple.patch} patch
38target_requires ${com.apple.patch} main fetch checksum extract
39
40set_ui_prefix
41
42# Add command patch
43commands patch
44# Set up defaults
45default patch.dir {${worksrcpath}}
46default patch.cmd patch
47default patch.pre_args -p0
48
49proc patch_main {args} {
50    global UI_PREFIX
51   
52    # First make sure that patchfiles exists and isn't stubbed out.
53    if {![exists patchfiles]} {
54        return 0
55    }
56   
57        ui_msg "$UI_PREFIX [format [msgcat::mc "Applying patches to %s"] [option portname]]"
58
59    foreach patch [option patchfiles] {
60        if {[file exists [option filespath]/$patch]} {
61            lappend patchlist [option filespath]/$patch
62        } elseif {[file exists [option distpath]/$patch]} {
63            lappend patchlist [option distpath]/$patch
64        }
65    }
66    if {![info exists patchlist]} {
67        return -code error [msgcat::mc "Patch files missing"]
68    }
69    cd [option worksrcpath]
70    foreach patch $patchlist {
71        ui_info "$UI_PREFIX [format [msgcat::mc "Applying %s"] $patch]"
72        if {[option os.platform] == "linux"} {
73            set gzcat "zcat"
74        } else {
75            set gzcat "gzcat"
76        }
77        switch -glob -- [file tail $patch] {
78            *.Z -
79            *.gz {system "$gzcat \"$patch\" | ([command patch])"}
80            *.bz2 {system "bzcat \"$patch\" | ([command patch])"}
81            default {system "[command patch] < \"$patch\""}
82        }
83    }
84    return 0
85}
Note: See TracBrowser for help on using the repository browser.