def __dounpack(packpath, dest): try: puke.unpack(packpath, dest, verbose = False) # puke.FileSystem.remove(packpath) except Exception as e: puke.sh("cd %s; 7z x %s" % (dest, packpath)); puke.FileSystem.remove(packpath)
def __dogit(packpath, dest, version = ""): # Require git on the system to have it puke.System.check_package('git') # If directory exist, then update the tree if puke.FileSystem.exists(dest): console.info('Updating') that = 'cd %s; git stash; git stash drop' % dest puke.sh(that, output=True) that = 'cd %s; git checkout master; git pull --rebase; ' % dest else: if not puke.FileSystem.exists(puke.FileSystem.dirname(dest)): puke.FileSystem.makedir(puke.FileSystem.dirname(dest)) console.info('Cloning') that = 'cd %s; git clone %s; ' % (puke.FileSystem.dirname(dest), packpath) if version: that = "%s git checkout %s" % (that, version) # Do the deed try: std = puke.Std() puke.sh(that, std=std, output=True) if std.err: raise std.err except: # if puke.FileSystem.exists(dest): # puke.FileSystem.remove(dest) console.error('Git operation failed! %s You need to manually fix or remove the directory.' % std.err)
def execute(envcopy, command, path = "", preexec = "", silent = False): if path: envcopy.append('cd "%s"' % path) if preexec: envcopy.append(preexec) # envcopy.append('entryenv=`env`') # envcopy.append('if %s; then exitenv=`env`; if [[ "$entryenv" == "$exitenv" ]]; then exit 0; fi; echo "Env change!" >&2; echo $entryenv >&2; echo $exitenv >&2; fi; exit 1' % command) envcopy.append('if %s; then exit 0; fi; exit 1' % command) std = puke.Std() console.info('Running command:') for i in envcopy: console.info(i) puke.sh(envcopy, std=std, output = False) if std.code == 1: if silent: raise() console.debug("Monade shell stdout:", std.out) console.fail("Monade shell stderr: %s" % std.err) console.debug("Monade shell stdout:", std.out) if std.err: console.warn("Monade shell stderr:", std.err) return std
def __wrap__(self, path, command): if fs.realpath('.') == fs.realpath(path): raise error.License(error.TERRIBLE, "Trying to manipulate current path .git (%s)!" % path) std = Std() sh('cd "%s";' % path, std = std) # XXX dead broken right now # if std.err: # raise error.License(error.TERRIBLE, "Can't change pwd! (%s)!" % path) sh('cd "%s"; git %s' % (path, command), std = std)
def __dopkg(path): console.info('Processing pkg') try: std = puke.Std() puke.sh('sudo installer -pkg %s -target /' % path, std = std) if std.err: raise std.err except: console.fail('Retry your task with the following stance: sudo echo "lame workaround"; puke MYTASK')
def edit(self, name): if not name: raise error.License(error.WRONG_ARGUMENT, "You need to pass a non-empty license name to the edit method") name = name.upper() path = fs.join(AIRSTRIP_LICENSES, name) if not name in self.licenses: self.licenses[name] = EMPTY_LICENSE.replace('{name}', name) fs.writefile(path, self.licenses[name]) sh('open "%s"' % path, output = False)
def __dodmg(packpath, localname, dest): # http://hints.macworld.com/article.php?story=2005050606123892 ret = puke.sh('hdid %s' % packpath, output = False) ret = ret.split("\n") ret.pop() ret = ret.pop() ret = ret.split("\t") vol = ret.pop() ret.pop() disk = ret.pop() puke.FileSystem.makedir(dest) list = puke.FileList(puke.FileSystem.join(vol, localname), filter = "*") puke.deepcopy(list, dest) puke.sh('hdid hdiutil detach %s -force' % disk, output = False)
def configure(args = "", preexec= "", debug='disable', shared='shared', deptrack = '', hosttarget = 'both'): if not shared: shared = '' else: shared = '--disable-shared --enable-static' if environ.static else '--enable-shared --disable-static' if not debug: debug = '' else: debug = '--enable-debug' if environ.debug else '--disable-debug' if deptrack == 'disable': deptrack = '--disable-dependency-tracking' else: deptrack = '' # XXXXXXXXXXXS STOOOPID # x86_64-apple-darwin11.2.0 host = '' if hosttarget == 'both': build = sh('echo `uname -m`-apple-darwin`uname -r`', output = False) if environ.get('MONADE_HOST') != build.strip(): host = '--host=%s --build=%s' % (environ.get('MONADE_HOST'), build.strip()) act = fs.join(environ.src, technicolor.local, 'configure') command = '%s %s --with-pic --prefix="%s" %s %s %s %s' % (act, deptrack, environ.prefix, shared, debug, host, args) shell.execute(environ.flush(), command, environ.pwd, preexec)
def make(): base = puke.FileSystem.join(monade.environ.src, monade.technicolor.local, 'VLC.app', 'Contents', 'MacOS') dylibs = puke.FileList(puke.FileSystem.join(base, 'lib')) plugins = puke.FileList(puke.FileSystem.join(base, 'plugins'), exclude = "*growl*,*libqt*,*libmacosx_plugin*") includes = puke.FileList(puke.FileSystem.join(base, 'include')) libpath = puke.FileSystem.join(monade.environ.prefix, 'lib') puke.deepcopy(dylibs, libpath) puke.sh('cd %s; rm libvlc.dylib; rm libvlccore.dylib; ln -s libvlccore.5.dylib libvlccore.dylib; ln -s libvlc.5.dylib libvlc.dylib;' % libpath); puke.sh('cd %s; install_name_tool -id %s/libvlc.5.dylib libvlc.5.dylib;' % (libpath, libpath)); puke.sh('cd %s; install_name_tool -id %s/libvlccore.5.dylib libvlccore.5.dylib;' % (libpath, libpath)); puke.deepcopy(includes, puke.FileSystem.join(monade.environ.prefix, 'include')) puke.deepcopy(plugins, puke.FileSystem.join(monade.environ.prefix, 'lib', 'vlc', 'plugins'))