This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: PING Jan Nieuwenhuizen re libguile17


Dave Korn writes:

>   What exactly is the nature of the problem?  It all seems fairly
> straightforward to me, but that's not to say it can't be changed if there's
> a reason to.

As I remember the problematic thing is that there are so many options
for this second variant of Cygwin's source package.

I went as far as the sorry burp of python code below before I gave up,
this works for some packages, but not for all.  The problem becomes more
clear when you imagine the different [optional stuff] mentioned in the
function's docstring.

Jan.

def untar_cygwin_src_package_variant2 (self, file_name, split=False):
    '''Unpack this unbelievably *interesting* version of Cygwin source packages.

foo[version][-split]-x.y.z-b.tar.bz2 contains
foo[-split]-x.y.z.tar.[bz2|gz] and foo[version]-x.y.z-b.patch
(and optionally foo[version]-x.y.z-b.patch2 ...).
foo-x.y.z.tar.[bz2|gz] contains foo-x.y.z.  The patch contains patches
against all foo split source balls, so applying it may fail partly and
complain about missing files.'''

    file_name = self.expand (file_name)
    unpackdir = os.path.dirname (self.expand (self.srcdir ()))
    t = misc.split_ball (file_name)
    print 'split: ' + `t`
    no_src = re.sub ('-src', '', file_name)
    base = re.sub ('\.tar\..*', '', no_src)
    # FIXME: use split iso custom ball_re macramee
    ball_re = '^([a-z]+)([.0-9]+)?(-[a-z+]+)?(.*)(-[0-9]+)'
    m = re.match (ball_re, base)
    if m.group (3):
        second_tarball = re.sub (ball_re, '\\1\\3\\4', base)
    else:
        second_tarball = re.sub (ball_re, '\\1\\4', base)
    print 'second_tarball: ' + second_tarball
    if split and m.group (3):
        second_tarball_contents = re.sub (ball_re, '\\1\\3\\4', base)
    else:
        second_tarball_contents = re.sub (ball_re, '\\1\\4', base)
    print 'second_tarball_contents: ' + second_tarball_contents
    flags = '-jxf'
    self.system ('''
rm -rf %(unpackdir)s/%(base)s
tar -C %(unpackdir)s %(flags)s %(downloads)s/%(file_name)s
''',
                 locals ())
    tgz = 'tar.bz2'
    if not os.path.exists (unpackdir + '/' + second_tarball + '.' + tgz):
        flags = '-zxf'
        tgz = 'tar.gz'
    self.system ('''
tar -C %(unpackdir)s %(flags)s %(unpackdir)s/%(second_tarball)s.%(tgz)s
''',
                 locals ())
    if split:
        return
    if m.group (2):
        patch = re.sub (ball_re, '\\1\\2\\4\\5.patch', base)
    else:
        patch = re.sub (ball_re, '\\1\\4\\5.patch', base)
    print 'patch: ' + patch
    print 'scrdir: ', self.expand ('%(srcdir)s')
    self.system ('''
cd %(unpackdir)s && mv %(second_tarball_contents)s %(base)s
cd %(srcdir)s && patch -p1 -f < %(unpackdir)s/%(patch)s || true
''',
                 locals ())
-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]