def make_package( self ):
        self.svnpath = os.path.join( self.kdesvndir, self.subinfo.svnTargets['svnHEAD'] )
        dstpath = self.packageDestinationDir(withBuildType=False)

        if not utils.test4application( "kdewin-packager" ):
            utils.die( "kdewin-packager not found - please make sure it is in your path" )

        for pkg in self.subinfo.languages.split():
            workdir = os.path.join( self.workdir, pkg )
            cmd = "kdewin-packager -name kde-l10n-%s -version %s -hashfirst -compression 2 -root %s/%s -destdir %s" % \
                  ( pkg, self.buildTarget, self.imagedir, pkg, dstpath )
            utils.system( cmd )
        return True
示例#2
0
    def doPackaging( self, pkg_name, pkg_version = str( datetime.date.today() ).replace('-', ''), packSources = True, special = False ):
        """packaging according to the gnuwin32 packaging rules
        this requires the kdewin-packager"""

        # FIXME: add a test for the installer later
        dstpath = self.packageDestinationDir(withBuildType=False)
        binpath = os.path.join( self.imagedir, self.instdestdir )
        tmp = os.path.join( binpath, "kde" )

        patchlevel = os.getenv( "EMERGE_PKGPATCHLVL" )
        if patchlevel:
            pkg_version += "-" + patchlevel

        if( os.path.exists( tmp ) ):
            binpath = tmp

        if not utils.test4application( "kdewin-packager" ):
            utils.die( "kdewin-packager not found - please make sure it is in your path" )

        for pkgtype in ['bin', 'lib', 'doc', 'src']:
            script = os.path.join( self.packagedir, "post-install-%s.cmd" ) % pkgtype
            scriptName = "post-install-%s-%s-%s.cmd" % ( self.package, self.version, pkgtype )
            destscript = os.path.join( self.imagedir, "manifest", scriptName )
            if os.path.exists( script ):
                if not os.path.exists( os.path.join( self.imagedir, "manifest" ) ):
                    os.mkdir( os.path.join( self.imagedir, "manifest" ) )
                shutil.copyfile( script, destscript )

        if ( packSources and not ( self.noCopy and self.kde.kdeSvnPath() ) ):
            srcpath = os.path.join( self.workdir, self.instsrcdir )
            cmd = "-name %s -root %s -srcroot %s -version %s -destdir %s" % \
                  ( pkg_name, binpath, srcpath, pkg_version, dstpath )
        elif packSources and self.noCopy and self.kde.kdeSvnPath():
            srcpath = os.path.join( self.kde.kdesvndir, self.kde.kdeSvnPath() ).replace( "/", "\\" )
            if not os.path.exists( srcpath ):
                srcpath = self.kde.sourcePath
            cmd = "-name %s -root %s -srcroot %s -version %s -destdir %s" % \
                  ( pkg_name, binpath, srcpath, pkg_version, dstpath )
        else:
            cmd = "-name %s -root %s -version %s -destdir %s" % \
                  ( pkg_name, binpath, pkg_version, dstpath )
        xmltemplate = os.path.join(self.packagedir, pkg_name+"-package.xml")
        if os.path.exists(xmltemplate):
            cmd = "kdewin-packager.exe " + cmd + " -template " + xmltemplate + " -notes " + \
                    "%s/%s:%s:unknown " % ( self.category, self.package, self.version ) + "-compression 2 "
        else:
            cmd = "kdewin-packager.exe " + cmd + " -notes " + \
                    "%s/%s:%s:unknown " % ( self.category, self.package, self.version ) + "-compression 2 "

        if( not self.createCombinedPackage ):
            if( self.compiler == "mingw"):
                cmd += " -type mingw "
            elif self.compiler == "mingw4":
                cmd += " -type mingw4 "
            elif self.compiler == "msvc2005":
                cmd += " -type msvc "
            elif self.compiler == "msvc2008":
                cmd += " -type vc90 "
            elif self.compiler == "msvc2010":
                cmd += " -type vc100 "
            elif self.compiler == "msvc2011":
                cmd += " -type vc110 "
            else:
                cmd += " -type unknown "

        if special:
            cmd += " -special"
        if utils.verbose():
            print "running %s" % cmd
        if not utils.system(cmd):
            utils.die( "while packaging. cmd: %s" % cmd )
        return True