diff --git a/bin/Package/PackageBase.py b/bin/Package/PackageBase.py --- a/bin/Package/PackageBase.py +++ b/bin/Package/PackageBase.py @@ -50,7 +50,7 @@ ignoreInstalled = True self.unmerge() - + EmergeDebug.debug("qmerge package to %s" % self.mergeDestinationDir(), 2) utils.mergeImageDirToRootDir( self.mergeSourceDir(), self.mergeDestinationDir() ) @@ -138,15 +138,15 @@ return True - def cleanImage( self ): + def cleanImage( self ) -> bool: """cleanup before install to imagedir""" if ( os.path.exists( self.imageDir() ) ): EmergeDebug.debug("cleaning image dir: %s" % self.imageDir(), 1) utils.cleanDirectory( self.imageDir() ) os.rmdir(self.imageDir()) return True - def cleanBuild( self ): + def cleanBuild( self ) -> bool: """cleanup currently used build dir""" if os.path.exists( self.buildDir() ): utils.cleanDirectory( self.buildDir() ) @@ -156,11 +156,11 @@ def stripLibs( self, pkgName ): """strip debugging informations from shared libraries - mingw only!!! """ - return self.strip(pkgName + ".dll" ) - + return self.strip(pkgName + ".dll" ) + def strip( self , fileName ): """strip debugging informations from shared libraries and executables - mingw only!!! """ - if self.subinfo.options.package.disableStriping or not isMinGW(): + if self.subinfo.options.package.disableStriping or not isMinGW(): EmergeDebug.debug("Skiping stipping of " + fileName, 2) return True basepath = os.path.join( self.installDir() ) @@ -213,6 +213,31 @@ return self.runAction(command) + + def binaryArchiveName(self, pkgSuffix = None): + if not pkgSuffix: + pkgSuffix = '' + if hasattr(self.subinfo.options.package, 'packageSuffix') and self.subinfo.options.package.packageSuffix: + pkgSuffix = self.subinfo.options.package.packageSuffix + + pkgVersion, _ = self.getPackageVersion() + if self.package.endswith( "-package" ): + shortPackage = self.package[ : -8 ] + else: + shortPackage = self.package + + return "%s-%s-%s%s%s.%s" % (shortPackage, compiler.architecture(), pkgVersion, compiler.getShortName(), pkgSuffix, emergeSettings.get("Packager", "7ZipArchiveType", "7z")) + + def fetchBinary(self) -> bool: + archiveName = self.binaryArchiveName() + downloadFolder = os.path.join(EmergeStandardDirs.downloadDir(), "binary") + if not os.path.exists(downloadFolder): + os.mkdir(downloadFolder) + return utils.getFile("%s/%s" % (emergeSettings.get("ContinuousIntegration", "BinaryUrl"), archiveName), downloadFolder )\ + and self.cleanImage()\ + and utils.unpackFile(downloadFolder, archiveName, self.imageDir())\ + and self.qmerge() + def runAction( self, command ): """ \todo TODO: rename the internal functions into the form cmdFetch, cmdCheckDigest etc then we get by without this dict: @@ -235,7 +260,8 @@ "print-revision": "printSourceVersion", "print-files": "printFiles", "checkdigest": "checkDigest", - "dumpdeps": "dumpDependencies"} + "dumpdeps": "dumpDependencies", + "fetch-binary": "fetchBinary"} if command in functions: try: ok = getattr(self, functions[command])() diff --git a/bin/Packager/PortablePackager.py b/bin/Packager/PortablePackager.py --- a/bin/Packager/PortablePackager.py +++ b/bin/Packager/PortablePackager.py @@ -27,7 +27,7 @@ if not "setupname" in self.defines or not self.defines[ "setupname" ]: - self.defines[ "setupname" ] = self._archiveName("") + self.defines[ "setupname" ] = self.binaryArchiveName("") if not "srcdir" in self.defines or not self.defines[ "srcdir" ]: self.defines[ "srcdir" ] = self.imageDir() diff --git a/bin/Packager/SevenZipPackager.py b/bin/Packager/SevenZipPackager.py --- a/bin/Packager/SevenZipPackager.py +++ b/bin/Packager/SevenZipPackager.py @@ -29,15 +29,6 @@ if self.packagerExe: EmergeDebug.debug("using 7za from %s" % self.packagerExe, 2) - def _archiveName(self, pkgSuffix): - pkgVersion, _ = self.getPackageVersion() - if self.package.endswith( "-package" ): - shortPackage = self.package[ : -8 ] - else: - shortPackage = self.package - - return "%s-%s-%s%s%s.%s" % (shortPackage, compiler.architecture(), pkgVersion, compiler.getShortName(), pkgSuffix, emergeSettings.get("Packager", "7ZipArchiveType", "7z")) - def _compress(self, archiveName, sourceDir, destDir): utils.deleteFile(archiveName) cmd = "%s a -r %s %s/*" % (self.packagerExe, os.path.join(destDir, archiveName), sourceDir ) @@ -54,17 +45,12 @@ dstpath = self.packageDestinationDir() print(dstpath) - pkgSuffix = '' - if hasattr(self.subinfo.options.package, 'packageSuffix') and self.subinfo.options.package.packageSuffix: - pkgSuffix = self.subinfo.options.package.packageSuffix - - - self._compress(self._archiveName( pkgSuffix), self.imageDir(), dstpath) + self._compress(self.binaryArchiveName(), self.imageDir(), dstpath) if not self.subinfo.options.package.packSources: return True - self._compress(self._archiveName( "-src"), self.sourceDir(), dstpath) + self._compress(self.binaryArchiveName("-src"), self.sourceDir(), dstpath) return True diff --git a/bin/emerge.py b/bin/emerge.py --- a/bin/emerge.py +++ b/bin/emerge.py @@ -78,7 +78,7 @@ if buildAction == "full-package": success = success and doExec( package, "package" ) success = success or continueFlag - elif buildAction in [ "fetch", "unpack", "configure", "compile", "make", "checkdigest", + elif buildAction in [ "fetch", "fetch-binary", "unpack", "configure", "compile", "make", "checkdigest", "dumpdeps", "test", "package", "unmerge", "cleanimage", "cleanbuild", "createpatch", "geturls", @@ -368,7 +368,7 @@ help = "By default emerge resolves the whole dependency graph, this option limits the depth of the graph, so a value of 1 would mean only dependencies defined in that package" ) actionHandler = ActionHandler(parser) - for x in sorted( [ "fetch", "unpack", "configure", "compile", "make", + for x in sorted( [ "fetch", "fetch-binary", "unpack", "configure", "compile", "make", "install", "install-deps", "qmerge", "manifest", "package", "unmerge", "test", "checkdigest", "dumpdeps", "full-package", "cleanimage", "cleanbuild", "createpatch", "geturls"] ): diff --git a/bin/utils.py b/bin/utils.py --- a/bin/utils.py +++ b/bin/utils.py @@ -119,7 +119,7 @@ return True -def getFile( url, destdir , filename='' ): +def getFile( url, destdir , filename='' ) -> bool: """download file from 'url' into 'destdir'""" EmergeDebug.debug("getFile called. url: %s" % url, 1) if url == "": diff --git a/kdesettings.ini b/kdesettings.ini --- a/kdesettings.ini +++ b/kdesettings.ini @@ -156,6 +156,8 @@ ## If you are using mingw please make sure you have installed the mingw using the Qt installer. Compiler = mingw482_32 +[ContinuousIntegration] +BinaryUrl = "" [Version] EMERGE_SETTINGS_VERSION = 2