def set_postsh(self, builddir, postsh_file): if not os.path.exists(builddir): raise ElbeDBError("project directory does not exist") with session_scope(self.session) as s: p = None try: p = s.query (Project). \ filter(Project.builddir == builddir).one() except NoResultFound: raise ElbeDBError( "project %s is not registered in the database" % builddir) if p.status == "busy": raise ElbeDBError( "cannot set postsh file while project %s is busy" % builddir) p.edit = datetime.utcnow() if p.status == "empty_project" or p.status == "build_failed": p.status = "needs_build" elif p.status == "build_done": p.status = "has_changes" with open(builddir + "/post.sh", 'w') as dst: copyfileobj(postsh_file, dst) dos2unix(builddir + "/post.sh") return self._update_project_file(s, builddir, "post.sh", "application/sh", "post install script")
def set_postsh (self, builddir, postsh_file): if not os.path.exists (builddir): raise ElbeDBError( "project directory does not exist" ) with session_scope(self.session) as s: p = None try: p = s.query (Project). \ filter(Project.builddir == builddir).one() except NoResultFound: raise ElbeDBError( "project %s is not registered in the database" % builddir ) if p.status == "busy": raise ElbeDBError( "cannot set postsh file while project %s is busy" % builddir ) p.edit = datetime.utcnow () if p.status == "empty_project" or p.status == "build_failed": p.status = "needs_build" elif p.status == "build_done": p.status = "has_changes" with open (builddir+"/post.sh", 'w') as dst: copyfileobj (postsh_file, dst) dos2unix (builddir+"/post.sh") return self._update_project_file( s, builddir, "post.sh", "application/sh", "post install script" )
def set_postbuild(self, builddir, postbuild_file): if not os.path.exists(builddir): raise ElbeDBError("project directory does not exist") with session_scope(self.session) as s: p = None try: p = s.query (Project). \ filter(Project.builddir == builddir).one() except NoResultFound: raise ElbeDBError( "project %s is not registered in the database" % builddir) if p.status == "busy": raise ElbeDBError( "cannot set postbuild file while project %s is busy" % builddir) p.edit = datetime.utcnow() with open(builddir + "/postbuild.sh", 'w') as dst: copyfileobj(postbuild_file, dst) os.chmod(builddir + "/postbuild.sh", 0755) dos2unix(builddir + "/postbuild.sh") return self._update_project_file(s, builddir, "postbuild.sh", "application/sh", "postbuild script")
def set_postbuild (self, builddir, postbuild_file): if not os.path.exists (builddir): raise ElbeDBError( "project directory does not exist" ) with session_scope(self.session) as s: p = None try: p = s.query (Project). \ filter(Project.builddir == builddir).one() except NoResultFound: raise ElbeDBError( "project %s is not registered in the database" % builddir ) if p.status == "busy": raise ElbeDBError( "cannot set postbuild file while project %s is busy" % builddir ) p.edit = datetime.utcnow () with open (builddir+"/postbuild.sh", 'w') as dst: copyfileobj (postbuild_file, dst) os.chmod (builddir+"/postbuild.sh", 0755) dos2unix (builddir+"/postbuild.sh") return self._update_project_file( s, builddir, "postbuild.sh", "application/sh", "postbuild script" )