On Tuesday 09 March 2010, Thomas Friedrichsmeier wrote: > Hi! Ping.
Bad time to ask? Bad question(s)? Bad way of asking? I'm attaching an updated diff. If you don't have time to go into any detail, ATM, I'm happy to live with these scripts as they are now. I'd really appreciate answers on the key questions, though: 1. Ok to commit? 2. If so, which category should I place these in? "contributed"? 3. Will this lead to automatic inclusion of RKWard and R in the nightly builds/kdewin installer? Thanks! Thomas
Index: portage/testing/r-base/r-base-2010-03-16-autoupdate.py =================================================================== --- portage/testing/r-base/r-base-2010-03-16-autoupdate.py (revision 0) +++ portage/testing/r-base/r-base-2010-03-16-autoupdate.py (revision 0) @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- +import info +import utils +import subprocess + +PACKAGE_CRAN_MIRROR = 'http://ftp5.gwdg.de/pub/misc/cran' +PACKAGE_PATH = '/bin/windows/base/' + +class subinfo(info.infoclass): + def setDependencies( self ): + self.hardDependencies['gnuwin32/wget'] = 'default' + + def setTargets( self ): + self.targets['stable_latest'] = PACKAGE_CRAN_MIRROR + PACKAGE_PATH + 'R-release.exe' + self.targets['devel'] = PACKAGE_CRAN_MIRROR + PACKAGE_PATH + 'R-devel.exe' + self.defaultTarget = 'stable_latest' + +from Package.BinaryPackageBase import * + +# Installation approach based on expat-src-2.0.1.py. +# This basically just runs the upstream binary installer, then moves files to the KDE dir. +# Installation goes to dstdir/lib/R, since R comes with *a lot* of files in several subdirectories. +# This approach is also taken in the Debian packages, and probably other *n*x distributions. +# A convenience R.bat is added to dstdir/bin to have "R" in the path. +# Compiling R from source is possible, but terribly complex on Windows. See +# http://cran.r-project.org/doc/manuals/R-admin.html#Installing-R-under-Windows for details. +# +# TODO: +# - adding icons would really be nice (icons do get added on the build-machine, but not in the package) +# - is there a way to run updatePackages() (in R) after an update? Do we even want this? +class Package(BinaryPackageBase): + def __init__( self ): + self.subinfo = subinfo() + BinaryPackageBase.__init__( self ) + # don't use shortcut to unpack into imageDir() + self.buildSystemType = 'custom' + # create combined package + self.subinfo.options.package.withCompiler = None + + def unpack( self ): + # hopefully only one... + for filename in self.localFileNames(): + self.system( os.path.join( self.downloadDir(), filename ) + " /DIR=\"" + self.workDir() + "\" /SILENT") + return True + + def install( self ): + srcdir = self.sourceDir() + dstdir = self.installDir() + + utils.cleanDirectory( dstdir ) + os.makedirs (os.path.join (dstdir, "lib", "R")) + os.makedirs (os.path.join (dstdir, "bin")) + + # place everything in dstdir/lib/R (similar to debian packaging) + portage.remInstalled( self.category, self.package, "stablelatest" ) + utils.copyDir (srcdir, os.path.join (dstdir, "lib", "R")) + + # create a shortcut in dstdir/bin + f = open(os.path.join (dstdir, "bin", "R.bat"), "w") + f.write("REM redirect to R.exe, autocreated during installation\n" + os.path.join ("%~dsp0", "..", "lib", "R", "bin", "R.exe") + " %1 %2 %3 %4 %5 %6 %7 %8 %9\n") + f.close() + + return True + + # Determine real version number by querying the installed R + def getVersionFromR( self ): + rcmd = os.path.join (self.installDir(), "lib", "R", "bin", "R.exe") + if self.buildTarget == 'devel': + version = subprocess.Popen([rcmd, '--no-save', '--slave', '-e', '"cat(paste(R.version$major,R.version$minor,sep=\'.\'),\'devel\',R.version$svn,sep=\'\')"'], stdout=subprocess.PIPE).communicate()[0] + else: + version = subprocess.Popen([rcmd, '--no-save', '--slave', '-e', '"cat(R.version$major,R.version$minor,sep=\'.\')"'], stdout=subprocess.PIPE).communicate()[0] + return version + + # Mesing with the manifest appears to be a no-no. + #def manifest( self ): + ## HACK: register the correct version number with portage + #self.version = self.getVersionFromR() + #return BinaryPackageBase.manifest(self) + + def createPackage( self ): + # HACK: assign to the magic var that appears to control the version naming + self.subinfo.options.package.version = self.getVersionFromR() + return BinaryPackageBase.createPackage(self) + +if __name__ == '__main__': + Package().execute() Index: portage/testing/rkward/rkward-0.5.2.py =================================================================== --- portage/testing/rkward/rkward-0.5.2.py (revision 0) +++ portage/testing/rkward/rkward-0.5.2.py (revision 0) @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +import base +import utils +import os +import sys +import info +import xml.dom.minidom +import subprocess + +class subinfo(info.infoclass): + def setTargets( self ): + self.svnTargets['svnHEAD'] = 'http://rkward.svn.sourceforge.net/svnroot/rkward/trunk/rkward' + # no "release" targets defined, yet. Releases up to RKWard 0.5.2 (current) had an additional dependency on PHP, which we do not provide + self.defaultTarget = 'svnHEAD' + + def setDependencies( self ): + self.hardDependencies['testing/r-base'] = 'default' + self.hardDependencies['kde/kdebase-runtime'] = 'default' + +class subclass(base.baseclass): + def __init__( self, **args ): + base.baseclass.__init__( self, args=args ) + self.subinfo = subinfo() + + # What is the recommended way to fetch SVN sources from a repository that is not on the KDE SVN server? + def fetch( self ): + ok = utils.svnFetch (self.subinfo.svnTargets['svnHEAD'], self.svndir) + # This is plainly wrong, but somehow ok is False even though the checkout/update succeeded. Why? + return True + + def realSvnPath( self ): + return os.path.join (self.svndir, "rkward") + + def unpack( self ): + utils.cleanDirectory( self.workdir ) # side-effect of creating the dir, if needed + return True + + def compile( self ): + self.kde.sourcePath = self.realSvnPath() + return self.kde.kdeCompile(" -DR_EXECUTABLE=" + self.rootdir + "/lib/R/bin/R.exe") + + def install( self ): + return self.kde.kdeInstall() + + def getSvnVersion( self ): + svninfo = subprocess.Popen(['svn', 'info', '--xml', self.realSvnPath()], shell=True, stdout=subprocess.PIPE).communicate()[0] + doc = xml.dom.minidom.parseString(svninfo) + latestcommit = doc.getElementsByTagName("commit")[0] + rev = latestcommit.getAttribute("revision") + if rev == "": + rev = "-unknown" + return "svn" + rev + + # Mesing with the manifest appears to be a no-no. + #def manifest( self ): + #if self.buildTarget == 'svnHEAD': + ## this seems a bit hacky... + #self.version = self.getSvnVersion() + #return base.manifest(self) + + def make_package( self ): + # I'm sure this is not the right way to do it, but then, what is the right way? + self.kde.kdesvndir = "" + self.kde.kdeSvnPath = self.realSvnPath # NOTE: We are assinging the function, here, not the return value. + + if not self.buildTarget == 'svnHEAD': + return self.doPackaging( "rkward", self.buildTarget, True ) + else: + return self.doPackaging( "rkward", self.getSvnVersion(), True ) + +if __name__ == '__main__': + subclass().execute()
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Kde-windows mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-windows
