Exemplo n.º 1
0
    def packageDigests( self, name, version, ext='.tar.bz2', packagetypes=None ): # pylint: disable=W0613
        """ return archive file based package digests relating to info.infoclass.packageUrls()

The expected digest keys are build in the form <version>[<architecture>]-<compiler>-<packagetype> where
version=<value from version parameter>
compiler='vc90'|'mingw4'
packagetype=<keys from packagestypes parameter>
architecture=<empty for x86>|'-x64'
exception: the mingw-w32 compiler uses x86-mingw4 to not collide with the mingw.org compiler

example:
    # for x86
    self.targetDigests['2.4.2-3-vc90-bin'] = '1b7c2171fb60669924c9d7174fc2e39161f7ef7b'
    self.targetDigests['2.4.2-3-vc90-lib'] = 'e48d8c535cd245bfcc617590d3142035c77b8aa2'
    # for x64
    self.targetDigests['2.4.2-3-x64-vc90-lib'] = 'e48d8c535cd245bfcc617590d3142035c77b8aa2'

    self.targets['2.4.2-3'] = self.packageUrls(repoUrl, "fontconfig", "2.4.2-3")
    self.targetDigests['2.4.2-3'] = self.packageDigests("fontconfig", "2.4.2-3")

        """
        if packagetypes is None:
            packagetypes = ['bin', 'lib']
        if ("General", "EMERGE_PACKAGETYPES") in emergeSettings:
            packagetypes += emergeSettings.get("General", "EMERGE_PACKAGETYPES").split(',')
        arch = infoclass.getArchitecture()
        # TODO: use list comprehension
        ret = []
        for packageType in packagetypes:
            key = version + '-' + compiler.getShortName() + '-' + packageType + arch
            ret.append(self.targetDigests[key])
        return ret
Exemplo n.º 2
0
    def binaryArchiveName(self,
                          pkgSuffix=None,
                          fileType=emergeSettings.get("Packager",
                                                      "7ZipArchiveType",
                                                      "7z")):
        if not pkgSuffix:
            pkgSuffix = ''
            if hasattr(self.subinfo.options.package, 'packageSuffix'
                       ) and self.subinfo.options.package.packageSuffix:
                pkgSuffix = self.subinfo.options.package.packageSuffix

        return "%s-%s-%s-%s%s.%s" % (
            self.package, compiler.architecture(), self.getPackageVersion()[0],
            compiler.getShortName(), pkgSuffix, fileType)
Exemplo n.º 3
0
    def getPackage( self, repoUrl, name, version, ext='.tar.bz2', packagetypes=None, scheme=None, compiler_name=None):
        """return archive file based package url"""
        if packagetypes is None:
            packagetypes = ['bin', 'lib']
        if not os.getenv("EMERGE_PACKAGETYPES") is None:
            packagetypes += os.getenv("EMERGE_PACKAGETYPES").split(',')
        arch = self.getArchitecture();
        if compiler_name == None:
            compiler_name = compiler.getShortName()
        ret = ''
        # TODO: return '\n'.join(repoUrl + '/' + name + arch + '-' + compilerName + '-' + version + '-' + p + ext for p in packagetypes)
        if scheme == 'sf':
            for packageType in packagetypes:
                ret += repoUrl + '/' + name + '/' + version + '/' + name + arch + '-' + compiler_name + '-' + version + '-' + packageType + ext + '\n'
        else:
            for packageType in packagetypes:
                ret += repoUrl + '/' + name + arch + '-' + compiler_name + '-' + version + '-' + packageType + ext + '\n'

        return ret
Exemplo n.º 4
0
    def createPackage(self):
        """packaging according to the gnuwin32 packaging rules.
        This requires the kdewin-packager"""

        if not self.packagerExe:
            utils.die("could not find kdewin-packager in your path!")

        if self.subinfo.options.package.packageName != None:
            pkgName = self.subinfo.options.package.packageName
        else:
            pkgName = self.package

        if pkgName.endswith('-src') or pkgName.endswith('-pkg'):
            pkgName = pkgName[:-4]

        pkgVersion, pkgNotesVersion = self.getPackageVersion()

        # kdewin packager creates his own manifest files, so there is no need to add
        # if self.subinfo.options.package.withDigests:
        #    utils.createManifestFiles(filesDir, filesDir, "", self.package, pkgVersion)

        # FIXME: add a test for the installer later
        dstpath = self.packageDestinationDir()

        if ( self.subinfo.options.package.packSources ) and os.path.exists( self.sourceDir() ):
            srcCmd = " -srcroot " + self.sourceDir()
        else:
            if not os.path.exists( self.sourceDir() ):
                utils.warning( "The source directory %s doesn't exist and can't be used for packaging." % self.sourceDir() )
            srcCmd = ""

        # copy pdb/sym files to a temporary directory, because they can be scattered all over the build directory
        # plus, different build types copy files to different directories (could be buildDir(), buildDir()/bin, buildDir()/bin/Debug...),
        # so let's copy them to one precise location, package them, then delete that directory

        symCmd = ""
        if self.useDebugPackages:
            # directories to ignore: cmake temporary files, and dbg so it won't try to copy a file to itself
            dirsToIgnore = [ 'cmake', 'CMakeFiles', 'CMakeTmp', 'CMakeTmp2', 'CMakeTmp3', 'dbg' ]
            path = self.buildDir()
            # where to copy the debugging information files
            symRoot = os.path.join( self.buildDir(), "dbg" )
            symPath = os.path.join( symRoot, "bin" )
            if not os.path.exists( symPath ):
                utils.createDir( symPath )
            # shouldn't be needed, usually; but if files are present, that could lead to errors
            utils.cleanDirectory ( symRoot )

            utils.debug( "Copying debugging files to 'dbg'..." )
            for path, _, files in os.walk( path ):
                found = 0
                for directory in range( 0, len( dirsToIgnore ) ):
                    if path.find( dirsToIgnore[directory] ) > 0:
                        found = 1
                        break
                if found == 1:
                    continue
                utils.debug( "Checking: %s" % path, 3 )
                for fileName in files:
                    if ( fileName.endswith( ".pdb" ) ):
                        utils.copyFile( os.path.join( path, fileName ), os.path.join( symPath, fileName ) )
                    elif not self.subinfo.options.package.disableStriping:
                        if ( fileName.endswith( ".exe" ) or fileName.endswith( ".dll" ) or fileName.endswith( ".obf" ) ):
                            if compiler.isMinGW():
                                symFilename = fileName[:-4] + ".sym"
                                utils.system( "strip --only-keep-debug " + " -o " + os.path.join( path, symFilename ) \
                                        + " " + os.path.join( path, fileName ) )
                                # utils.system( "strip --strip-all " + os.path.join( path, fileName ) )
                                utils.copyFile( os.path.join(path, symFilename), os.path.join( symPath, symFilename ) )

            if not self.subinfo.options.package.disableStriping and compiler.isMinGW() :
                symCmd += "-strip "
            symCmd += "-debug-package "
            symCmd += "-symroot " + symRoot
            utils.debug ( symCmd, 2 )

        cmd = "-name %s -root %s -version %s -destdir %s %s %s -checksum sha1 " % \
                  ( pkgName, self.imageDir(), pkgVersion, dstpath, srcCmd, symCmd )
        xmltemplate = self.xmlTemplate()
        if os.path.exists(xmltemplate):
            cmd = self.packagerExe + " " + cmd + " -template " + xmltemplate + " -notes " + \
                    "%s/%s:%s:unknown " % ( self.category, self.package, pkgNotesVersion ) + "-compression 2 "
            utils.debug("using xml template for package generating", 1)
        elif self.package == "qt":
            cmd = self.packagerExe + " " + cmd + " -template :/template-qt.xml -notes " + \
                    "%s/%s:%s:unknown " % ( self.category, self.package, pkgNotesVersion ) + "-compression 2 "
            utils.debug("using xml template for package generating", 1)
        else:
            cmd = self.packagerExe + " " + cmd + " -verbose -notes " + \
                    "%s/%s:%s:unknown " % ( self.category, self.package, pkgNotesVersion ) + "-compression 2 "
            utils.debug(" xml template %s for package generating not found" % xmltemplate, 1)

        if( self.subinfo.options.package.withCompiler ):
            cmd += " -type "
            if compiler.isMinGW():
                if self.buildArchitecture() == "x64":
                    cmd += "x64-"
                else:
                    cmd += "x86-"                
            cmd += compiler.getShortName()


#        not needed anymore
#        if self.subinfo.options.package.specialMode:
#            cmd += " -special"

        if not utils.system(cmd):
            utils.die( "while packaging. cmd: %s" % cmd )

        if self.useDebugPackages:
            utils.rmtree( symPath )
        return True
Exemplo n.º 5
0
    def createPackage(self):
        """packaging according to the gnuwin32 packaging rules.
        This requires the kdewin-packager"""

        if not self.packagerExe:
            EmergeDebug.die("could not find kdewin-packager in your path!")

        if self.subinfo.options.package.packageName != None:
            pkgName = self.subinfo.options.package.packageName
        else:
            pkgName = self.package

        if pkgName.endswith('-src') or pkgName.endswith('-pkg'):
            pkgName = pkgName[:-4]

        pkgVersion, pkgNotesVersion = self.getPackageVersion()

        # kdewin packager creates his own manifest files, so there is no need to add
        # if self.subinfo.options.package.withDigests:
        #    utils.createManifestFiles(filesDir, filesDir, "", self.package, pkgVersion)

        # FIXME: add a test for the installer later
        dstpath = self.packageDestinationDir()

        if (self.subinfo.options.package.packSources) and os.path.exists(
                self.sourceDir()):
            srcCmd = " -srcroot " + self.sourceDir()
        else:
            if not os.path.exists(self.sourceDir()):
                EmergeDebug.warning(
                    "The source directory %s doesn't exist and can't be used for packaging."
                    % self.sourceDir())
            srcCmd = ""

        # copy pdb/sym files to a temporary directory, because they can be scattered all over the build directory
        # plus, different build types copy files to different directories (could be buildDir(), buildDir()/bin, buildDir()/bin/Debug...),
        # so let's copy them to one precise location, package them, then delete that directory

        symCmd = ""
        if self.useDebugPackages:
            # directories to ignore: cmake temporary files, and dbg so it won't try to copy a file to itself
            dirsToIgnore = [
                'cmake', 'CMakeFiles', 'CMakeTmp', 'CMakeTmp2', 'CMakeTmp3',
                'dbg'
            ]
            path = self.buildDir()
            # where to copy the debugging information files
            symRoot = os.path.join(self.buildDir(), "dbg")
            symPath = os.path.join(symRoot, "bin")
            if not os.path.exists(symPath):
                utils.createDir(symPath)
            # shouldn't be needed, usually; but if files are present, that could lead to errors
            utils.cleanDirectory(symRoot)

            EmergeDebug.debug("Copying debugging files to 'dbg'...")
            for path, _, files in os.walk(path):
                found = 0
                for directory in range(0, len(dirsToIgnore)):
                    if path.find(dirsToIgnore[directory]) > 0:
                        found = 1
                        break
                if found == 1:
                    continue
                EmergeDebug.debug("Checking: %s" % path, 3)
                for fileName in files:
                    if (fileName.endswith(".pdb")):
                        utils.copyFile(os.path.join(path, fileName),
                                       os.path.join(symPath, fileName))
                    elif not self.subinfo.options.package.disableStriping:
                        if (fileName.endswith(".exe")
                                or fileName.endswith(".dll")
                                or fileName.endswith(".obf")):
                            if compiler.isMinGW():
                                symFilename = fileName[:-4] + ".sym"
                                utils.system( "strip --only-keep-debug " + " -o " + os.path.join( path, symFilename ) \
                                        + " " + os.path.join( path, fileName ) )
                                # utils.system( "strip --strip-all " + os.path.join( path, fileName ) )
                                utils.copyFile(
                                    os.path.join(path, symFilename),
                                    os.path.join(symPath, symFilename))

            if not self.subinfo.options.package.disableStriping and compiler.isMinGW(
            ):
                symCmd += "-strip "
            symCmd += "-debug-package "
            symCmd += "-symroot " + symRoot
            EmergeDebug.debug(symCmd, 2)

        cmd = "-name %s -root %s -version %s -destdir %s %s %s -checksum sha1 " % \
                  ( pkgName, self.imageDir(), pkgVersion, dstpath, srcCmd, symCmd )
        xmltemplate = self.xmlTemplate()
        if os.path.exists(xmltemplate):
            cmd = self.packagerExe + " " + cmd + " -template " + xmltemplate + " -notes " + \
                    "%s/%s:%s:unknown " % ( self.category, self.package, pkgNotesVersion ) + "-compression 2 "
            EmergeDebug.debug("using xml template for package generating", 1)
        elif self.package == "qt":
            cmd = self.packagerExe + " " + cmd + " -template :/template-qt.xml -notes " + \
                    "%s/%s:%s:unknown " % ( self.category, self.package, pkgNotesVersion ) + "-compression 2 "
            EmergeDebug.debug("using xml template for package generating", 1)
        else:
            cmd = self.packagerExe + " " + cmd + " -verbose -notes " + \
                    "%s/%s:%s:unknown " % ( self.category, self.package, pkgNotesVersion ) + "-compression 2 "
            EmergeDebug.debug(
                " xml template %s for package generating not found" %
                xmltemplate, 1)

        if (self.subinfo.options.package.withCompiler):
            cmd += " -type "
            if compiler.isMinGW():
                if self.buildArchitecture() == "x64":
                    cmd += "x64-"
                else:
                    cmd += "x86-"
            cmd += compiler.getShortName()

#        not needed anymore
#        if self.subinfo.options.package.specialMode:
#            cmd += " -special"

        if not utils.system(cmd):
            EmergeDebug.die("while packaging. cmd: %s" % cmd)

        if self.useDebugPackages:
            utils.rmtree(symPath)
        return True