Ticket #12416: mercurial-1.8.4.p0.patch

File mercurial-1.8.4.p0.patch, 11.6 KB (added by jdemeyer, 9 years ago)

Diff for the mercurial spkg, for review only

  • SPKG.txt

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1328216304 -3600
    # Node ID c1ed6d491d8d60b8a524461aeb9aa3578d964b2a
    # Parent  fd8c607b17a9f0593e2fda65211a2dc307f5460c
    Trac #12416: add backported upstream patch "xcode.patch"
    
    diff --git a/SPKG.txt b/SPKG.txt
    a b  
    2020   http://mercurial.selenic.com/wiki/MailingLists
    2121
    2222== Dependencies ==
     23 * GNU patch
    2324 * Python
    2425
    2526== Special Update/Build Instructions ==
     
    2728
    2829== Changelog ==
    2930
     31=== mercurial-1.8.4.p0 (Jeroen Demeyer, 2 February 2012) ===
     32 * Trac #12416: add backported upstream patch "xcode.patch" to fix
     33   building Mercurial on systems where XCode is installed, but where
     34   the "gcc" found in the PATH isn't XCode's gcc.
     35 * Use "patch" for patching.
     36
    3037=== mercurial-1.8.4  (Keshav Kini, 2011-06-13) ===
    3138 * Upgrade Mercurial to version 1.8.4
    3239 * Add some useful default configuration settings
  • deleted file patches/posix.py

    diff --git a/patches/posix.py b/patches/posix.py
    deleted file mode 100644
    + -  
    1 # posix.py - Posix utility function implementations for Mercurial
    2 #
    3 #  Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others
    4 #
    5 # This software may be used and distributed according to the terms of the
    6 # GNU General Public License version 2 or any later version.
    7 
    8 from i18n import _
    9 import osutil
    10 import os, sys, errno, stat, getpass, pwd, grp
    11 
    12 posixfile = open
    13 nulldev = '/dev/null'
    14 normpath = os.path.normpath
    15 samestat = os.path.samestat
    16 os_link = os.link
    17 unlink = os.unlink
    18 rename = os.rename
    19 expandglobs = False
    20 
    21 umask = os.umask(0)
    22 os.umask(umask)
    23 
    24 def openhardlinks():
    25     '''return true if it is safe to hold open file handles to hardlinks'''
    26     return True
    27 
    28 def nlinks(name):
    29     '''return number of hardlinks for the given file'''
    30     return os.lstat(name).st_nlink
    31 
    32 def rcfiles(path):
    33     rcs = [os.path.join(path, 'hgrc')]
    34     rcdir = os.path.join(path, 'hgrc.d')
    35     try:
    36         rcs.extend([os.path.join(rcdir, f)
    37                     for f, kind in osutil.listdir(rcdir)
    38                     if f.endswith(".rc")])
    39     except OSError:
    40         pass
    41     return rcs
    42 
    43 def system_rcpath():
    44     path = []
    45     # old mod_python does not set sys.argv
    46     if len(getattr(sys, 'argv', [])) > 0:
    47         path.extend(rcfiles(os.path.dirname(sys.argv[0]) +
    48                               '/../etc/mercurial'))
    49     # Disable /etc/mercurial for Sage's mercurial (because it is
    50     # likely to refer to extensions that are not installed in
    51     # Sage's mercurial).
    52     # path.extend(rcfiles('/etc/mercurial'))
    53     return path
    54 
    55 def user_rcpath():
    56     return [os.path.expanduser('~/.hgrc')]
    57 
    58 def parse_patch_output(output_line):
    59     """parses the output produced by patch and returns the filename"""
    60     pf = output_line[14:]
    61     if os.sys.platform == 'OpenVMS':
    62         if pf[0] == '`':
    63             pf = pf[1:-1] # Remove the quotes
    64     else:
    65         if pf.startswith("'") and pf.endswith("'") and " " in pf:
    66             pf = pf[1:-1] # Remove the quotes
    67     return pf
    68 
    69 def sshargs(sshcmd, host, user, port):
    70     '''Build argument list for ssh'''
    71     args = user and ("%s@%s" % (user, host)) or host
    72     return port and ("%s -p %s" % (args, port)) or args
    73 
    74 def is_exec(f):
    75     """check whether a file is executable"""
    76     return (os.lstat(f).st_mode & 0100 != 0)
    77 
    78 def set_flags(f, l, x):
    79     s = os.lstat(f).st_mode
    80     if l:
    81         if not stat.S_ISLNK(s):
    82             # switch file to link
    83             fp = open(f)
    84             data = fp.read()
    85             fp.close()
    86             os.unlink(f)
    87             try:
    88                 os.symlink(data, f)
    89             except:
    90                 # failed to make a link, rewrite file
    91                 fp = open(f, "w")
    92                 fp.write(data)
    93                 fp.close()
    94         # no chmod needed at this point
    95         return
    96     if stat.S_ISLNK(s):
    97         # switch link to file
    98         data = os.readlink(f)
    99         os.unlink(f)
    100         fp = open(f, "w")
    101         fp.write(data)
    102         fp.close()
    103         s = 0666 & ~umask # avoid restatting for chmod
    104 
    105     sx = s & 0100
    106     if x and not sx:
    107         # Turn on +x for every +r bit when making a file executable
    108         # and obey umask.
    109         os.chmod(f, s | (s & 0444) >> 2 & ~umask)
    110     elif not x and sx:
    111         # Turn off all +x bits
    112         os.chmod(f, s & 0666)
    113 
    114 def set_binary(fd):
    115     pass
    116 
    117 def pconvert(path):
    118     return path
    119 
    120 def localpath(path):
    121     return path
    122 
    123 def samefile(fpath1, fpath2):
    124     """Returns whether path1 and path2 refer to the same file. This is only
    125     guaranteed to work for files, not directories."""
    126     return os.path.samefile(fpath1, fpath2)
    127 
    128 def samedevice(fpath1, fpath2):
    129     """Returns whether fpath1 and fpath2 are on the same device. This is only
    130     guaranteed to work for files, not directories."""
    131     st1 = os.lstat(fpath1)
    132     st2 = os.lstat(fpath2)
    133     return st1.st_dev == st2.st_dev
    134 
    135 if sys.platform == 'darwin':
    136     import fcntl # only needed on darwin, missing on jython
    137     def realpath(path):
    138         '''
    139         Returns the true, canonical file system path equivalent to the given
    140         path.
    141 
    142         Equivalent means, in this case, resulting in the same, unique
    143         file system link to the path. Every file system entry, whether a file,
    144         directory, hard link or symbolic link or special, will have a single
    145         path preferred by the system, but may allow multiple, differing path
    146         lookups to point to it.
    147 
    148         Most regular UNIX file systems only allow a file system entry to be
    149         looked up by its distinct path. Obviously, this does not apply to case
    150         insensitive file systems, whether case preserving or not. The most
    151         complex issue to deal with is file systems transparently reencoding the
    152         path, such as the non-standard Unicode normalisation required for HFS+
    153         and HFSX.
    154         '''
    155         # Constants copied from /usr/include/sys/fcntl.h
    156         F_GETPATH = 50
    157         O_SYMLINK = 0x200000
    158 
    159         try:
    160             fd = os.open(path, O_SYMLINK)
    161         except OSError, err:
    162             if err.errno == errno.ENOENT:
    163                 return path
    164             raise
    165 
    166         try:
    167             return fcntl.fcntl(fd, F_GETPATH, '\0' * 1024).rstrip('\0')
    168         finally:
    169             os.close(fd)
    170 else:
    171     # Fallback to the likely inadequate Python builtin function.
    172     realpath = os.path.realpath
    173 
    174 def shellquote(s):
    175     if os.sys.platform == 'OpenVMS':
    176         return '"%s"' % s
    177     else:
    178         return "'%s'" % s.replace("'", "'\\''")
    179 
    180 def quotecommand(cmd):
    181     return cmd
    182 
    183 def popen(command, mode='r'):
    184     return os.popen(command, mode)
    185 
    186 def testpid(pid):
    187     '''return False if pid dead, True if running or not sure'''
    188     if os.sys.platform == 'OpenVMS':
    189         return True
    190     try:
    191         os.kill(pid, 0)
    192         return True
    193     except OSError, inst:
    194         return inst.errno != errno.ESRCH
    195 
    196 def explain_exit(code):
    197     """return a 2-tuple (desc, code) describing a subprocess status
    198     (codes from kill are negative - not os.system/wait encoding)"""
    199     if code >= 0:
    200         return _("exited with status %d") % code, code
    201     return _("killed by signal %d") % -code, -code
    202 
    203 def isowner(st):
    204     """Return True if the stat object st is from the current user."""
    205     return st.st_uid == os.getuid()
    206 
    207 def find_exe(command):
    208     '''Find executable for command searching like which does.
    209     If command is a basename then PATH is searched for command.
    210     PATH isn't searched if command is an absolute or relative path.
    211     If command isn't found None is returned.'''
    212     if sys.platform == 'OpenVMS':
    213         return command
    214 
    215     def findexisting(executable):
    216         'Will return executable if existing file'
    217         if os.path.exists(executable):
    218             return executable
    219         return None
    220 
    221     if os.sep in command:
    222         return findexisting(command)
    223 
    224     for path in os.environ.get('PATH', '').split(os.pathsep):
    225         executable = findexisting(os.path.join(path, command))
    226         if executable is not None:
    227             return executable
    228     return None
    229 
    230 def set_signal_handler():
    231     pass
    232 
    233 def statfiles(files):
    234     'Stat each file in files and yield stat or None if file does not exist.'
    235     lstat = os.lstat
    236     for nf in files:
    237         try:
    238             st = lstat(nf)
    239         except OSError, err:
    240             if err.errno not in (errno.ENOENT, errno.ENOTDIR):
    241                 raise
    242             st = None
    243         yield st
    244 
    245 def getuser():
    246     '''return name of current user'''
    247     return getpass.getuser()
    248 
    249 def expand_glob(pats):
    250     '''On Windows, expand the implicit globs in a list of patterns'''
    251     return list(pats)
    252 
    253 def username(uid=None):
    254     """Return the name of the user with the given uid.
    255 
    256     If uid is None, return the name of the current user."""
    257 
    258     if uid is None:
    259         uid = os.getuid()
    260     try:
    261         return pwd.getpwuid(uid)[0]
    262     except KeyError:
    263         return str(uid)
    264 
    265 def groupname(gid=None):
    266     """Return the name of the group with the given gid.
    267 
    268     If gid is None, return the name of the current group."""
    269 
    270     if gid is None:
    271         gid = os.getgid()
    272     try:
    273         return grp.getgrgid(gid)[0]
    274     except KeyError:
    275         return str(gid)
    276 
    277 def groupmembers(name):
    278     """Return the list of members of the group with the given
    279     name, KeyError if the group does not exist.
    280     """
    281     return list(grp.getgrnam(name).gr_mem)
    282 
    283 def spawndetached(args):
    284     return os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0),
    285                       args[0], args)
    286 
    287 def gethgcmd():
    288     return sys.argv[:1]
    289 
    290 def termwidth():
    291     try:
    292         import termios, array, fcntl
    293         for dev in (sys.stderr, sys.stdout, sys.stdin):
    294             try:
    295                 try:
    296                     fd = dev.fileno()
    297                 except AttributeError:
    298                     continue
    299                 if not os.isatty(fd):
    300                     continue
    301                 arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8)
    302                 return array.array('h', arri)[1]
    303             except ValueError:
    304                 pass
    305             except IOError, e:
    306                 if e[0] == errno.EINVAL:
    307                     pass
    308                 else:
    309                     raise
    310     except ImportError:
    311         pass
    312     return 80
  • new file patches/xcode.patch

    diff --git a/patches/xcode.patch b/patches/xcode.patch
    new file mode 100644
    - +  
     1--- a/setup.py  2011-06-15 00:28:19.000000000 +0200
     2+++ b/setup.py  2012-02-01 21:23:54.000000000 +0100
     3@@ -385,7 +456,7 @@
     4     # Also parse only first digit, because 3.2.1 can't be parsed nicely
     5     if (version.startswith('Xcode') and
     6         StrictVersion(version.split()[1]) >= StrictVersion('4.0')):
     7-        os.environ['ARCHFLAGS'] = '-arch i386 -arch x86_64'
     8+        os.environ['ARCHFLAGS'] = ''
     9 
     10 setup(name='mercurial',
     11       version=setupversion,
  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b  
    1717    CXXFLAGS="-O2 -g $CXXFLAGS $CFLAG64"; export CXXFLAGS
    1818fi
    1919
    20 CUR=`pwd`
    21 
    22 cp patches/posix.py src/mercurial/posix.py
    23 if [ $? -ne 0 ]; then
    24     echo "Error copying patch"
    25     exit 1
    26 fi
    27 
    2820# Remove existing copies of Mercurial:
    2921rm -rf "$SAGE_LOCAL/lib/python/mercurial"
    3022
    3123cd src
    3224
     25# Apply patches
     26for patch in ../patches/*.patch; do
     27    patch -p1 <"$patch"
     28    if [ $? -ne 0 ]; then
     29        echo >&2 "Error applying '$patch'"
     30        exit 1
     31    fi
     32done
     33
    3334python setup.py install --home="$SAGE_LOCAL" --force
    3435if [ $? -ne 0 ]; then
    3536    echo "Error building and installing Mercurial"