Ticket #3292: modern-tap2rpm-3292.patch

File modern-tap2rpm-3292.patch, 1.8 KB (added by TimAllen, 7 years ago)

This might help the tests to pass on Ubuntu.

  • twisted/scripts/tap2rpm.py

    diff --git a/twisted/scripts/tap2rpm.py b/twisted/scripts/tap2rpm.py
    index a3888a7..3f55840 100755
    a b type_dict = { 
    167167
    168168##########################
    169169def makeBuildDir(baseDir):
    170     '''Set up the temporary directory for building RPMs.
    171     Returns: Tuple: ( buildDir, rpmrcFile )
     170    '''
     171    Set up the temporary directory for building RPMs.
     172
     173    Returns: buildDir, a randomly-named subdirectory of baseDir.
    172174    '''
    173175    import random, string
    174176
    def makeBuildDir(baseDir): 
    189191    os.makedirs(os.path.join(tmpDir, 'SOURCES'))
    190192    os.makedirs(os.path.join(tmpDir, 'SRPMS'))
    191193
    192     #  set up rpmmacros file
    193     macroFile = os.path.join(tmpDir, 'rpmmacros')
    194     rcFile = os.path.join(tmpDir, 'rpmrc')
    195     rpmrcData = open('/usr/lib/rpm/rpmrc', 'r').read()
    196     rpmrcData = string.replace(rpmrcData, '~/.rpmmacros', macroFile)
    197     fp = open(macroFile, 'w')
    198     fp.write('%%_topdir %s\n' % tmpDir)
    199     fp.close()
    200 
    201     #  set up the rpmrc file
    202     fp = open(rcFile, 'w')
    203     fp.write(rpmrcData)
    204     fp.close()
    205 
    206     return(( tmpDir, rcFile ))
     194    return tmpDir
    207195
    208196
    209197##########
    def run(options=None): 
    236224        maintainer = 'tap2rpm'
    237225
    238226    #  create source archive directory
    239     tmp_dir, rpmrc_file = makeBuildDir('/var/tmp')
     227    tmp_dir = makeBuildDir('/var/tmp')
    240228    source_dir = os.path.join(tmp_dir, directory)
    241229    os.makedirs(source_dir)
    242230
    def run(options=None): 
    257245    print 'Starting build...'
    258246    print '=' * 70
    259247    sys.stdout.flush()
    260     os.system('rpmbuild -ta --rcfile "%s" %s' % ( rpmrc_file, tarfile_name ))
     248    os.system('rpmbuild --define "_topdir %s" -ta %s' % ( tmp_dir, tarfile_name ))
    261249    print 'Done with build...'
    262250    print '=' * 70
    263251