HaikuPorts
  • Login
  • Preferences
  • Help/Guide
  • Wiki
  • Timeline
  • Roadmap
  • View Tickets
  • Search
  • Port Log
  • Blog

Context Navigation

  • Back to Ticket #271

Ticket #271: f_option.haikuporter.patch

File f_option.haikuporter.patch, 2.4 KB (added by thorn, 6 years ago)
  • haikuporter

     
    105105                # read global settings 
    106106                mainConfig = Config(haikuPortsConf) 
    107107                self.confKeys = mainConfig.getKeys() 
     108                self.options = options 
    108109 
    109110                for key in self.confKeys: 
    110111                        try: 
    … …  
    291292                print '*'*80 
    292293                 
    293294                fp.close() 
     295 
     296        def setFlag(self, name): 
     297                f = open('%s/haikuports.%s' %(self.workDir, name), 'w') 
     298                f.close() 
     299                 
     300        def checkFlag(self, name): 
     301                if os.path.exists('%s/haikuports.%s' %(self.workDir, name)): 
     302                        return True 
     303                else: 
     304                        return False 
    294305         
    295306        def getTree(self): 
    296307                """ Get port tree via svn""" 
    … …  
    550561                # create work dir 
    551562                if not os.path.exists(self.workDir): 
    552563                        os.mkdir(self.workDir) 
     564                if self.checkFlag('unpack') and not self.options.force: 
     565                        return 
    553566                # unpack source archive 
    554567                os.chdir(self.workDir) 
    555568                print "Unpacking " + self.src_local 
    … …  
    565578                else: 
    566579                        print "Unrecognised archive type" 
    567580                        sys.exit() 
     581                self.setFlag('unpack')   
    568582                         
    569583        def patch(self): 
    570584                """Apply the Haiku patches to the source directory""" 
     585                if self.checkFlag('patch') and not self.options.force: 
     586                        return 
    571587                os.chdir(self.workDir) 
    572588                patchFilePath = self.patchesDir + '/' + self.portName + '-' + self.portVersion + '.patch' 
    573589                if os.path.exists(patchFilePath): 
    … …  
    575591                        # TODO: check return code 
    576592                else: 
    577593                        print "No patching required" 
     594                self.setFlag('patch') 
    578595 
    579596        def build(self): 
    580597                """Build the sources""" 
     598                if self.checkFlag('build') and not self.options.force: 
     599                        return 
    581600                os.chdir(self.workDir) 
    582601                # TODO: if self.bepKeys['BUILD'] = empty, warn user 
    583602                buildCommands = '' 
    … …  
    586605                                buildCommands = buildCommands + " && " 
    587606                        buildCommands = buildCommands + command 
    588607                os.system(buildCommands) 
     608                self.setFlag('build') 
    589609                         
    590610        def install(self): 
    591611                """Install the binaries onto the system""" 
     612                print "Installing ..." 
    592613                os.chdir(self.workDir) 
    593614                # TODO: if self.bepKeys['INSTALL'] = empty, warn user 
    594615                installCommands = '' 
    … …  
    831852        action="store_true", dest="update", default=False, 
    832853        help="update ports tree (you should get it before)") 
    833854 
     855parser.add_option("-f", "--force", 
     856        action="store_true", dest="force", default=False, 
     857        help="force to perform the steps (upack, patch, build)") 
     858 
    834859(options, args) = parser.parse_args() 
    835860 
    836861haikuporter = HaikuPorter(options, args) 

Download in other formats:

  • Original Format

Trac Powered

Powered by Trac 0.13dev-r10686
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/