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

Context Navigation

  • Back to Ticket #474

Ticket #474: haikuporter-uninstall-2.patch

File haikuporter-uninstall-2.patch, 3.7 KB (added by triedgeai, 3 years ago)

GCI2012 Task Work - Adds an experimental -u (--uninstal) option. Can be used in conjunction with any other option. With -u -i for example it would mean REinstall.

  • generic-1.2.3.bep

    diff -urN generic_old/generic-1.2.3.bep generic_new/generic-1.2.3.bep
    old new  
    1616        make install 
    1717} 
    1818 
     19UNINSTALL { 
     20        cd generic-1.2.3 
     21        make uninstall 
     22} 
     23 
    1924TEST { 
    2025        cd generic-1.2.3 
    2126#       make test 
  • (a) haikuporter_old vs. (b) haikuporter_new

    a b  
    66# copyright 2009 Alexander Deynichenko 
    77# copyright 2009 HaikuBot (aka RISC) 
    88# copyright 2010-2011 Jack Laxson (Jrabbit) 
     9# copyright 2012 Tri-Edge AI 
    910 
    1011info = {} 
    1112info['version'] = 'r' + '$Rev: 1874 $'[6:-2] 
    … …  
    6667bepTypes['DEPEND'] = [types.StringType, types.ListType, types.NoneType] 
    6768bepTypes['BUILD'] = [ShellType] 
    6869bepTypes['INSTALL'] = [ShellType] 
     70bepTypes['UNINSTALL'] = [ShellType] 
    6971bepTypes['TEST'] = [ShellType] 
    7072bepTypes['MESSAGE'] = [types.StringType] 
    7173bepTypes['LICENSE'] = [types.StringType, types.ListType] 
    … …  
    8284bepDefaults['DEPEND'] = [False, None] 
    8385bepDefaults['BUILD'] = [False, shell()] 
    8486bepDefaults['INSTALL'] = [False, shell()] 
     87bepDefaults['UNINSTALL'] = [False, shell()] 
    8588bepDefaults['TEST'] = [False, shell()] 
    8689bepDefaults['MESSAGE'] = [False, None] 
    8790bepDefaults['LICENSE'] = [False, None] 
    … …  
    127130# -- Main Program ------------------------------------------------------------ 
    128131class HaikuPorter: 
    129132    def __init__(self, options, args): 
    130  
    131133        # read global settings 
    132134        mainConfig = Config(haikuPortsConf) 
    133135        self.confKeys = mainConfig.getKeys() 
    … …  
    291293            self.patchSource() 
    292294        if options.build: 
    293295            self.buildPort() 
     296        if options.uninstall: 
     297            self.uninstallPort() 
    294298        if options.install: 
    295299            self.installPort() 
    296300        if options.distro: 
    … …  
    477481            print 'Cleaning work directory...' 
    478482            shutil.rmtree(self.workDir) 
    479483 
     484    def uninstallPort(self): 
     485        """Uninstall the binaries from the system""" 
     486        # Make sure the bep file for the package has a UNINSTALL section. 
     487        if 'UNINSTALL' not in self.bepKeys or not self.bepKeys['UNINSTALL']: 
     488            sys.exit('Error: bep file has no UNINSTALL section.') 
     489 
     490        # Check if port is python or perl as uninstalling them with haikuporter may break haikuporter 
     491        if self.portName == 'python' or self.portName == 'perl': 
     492            sys.exit('Error: cannot uninstall ' + self.portName 
     493                      + ' using haikuporter.' 
     494                     ) 
     495        print 'Uninstalling ...' 
     496        self.runCommandSequence(self.bepKeys['UNINSTALL'], self.workDir) 
     497 
    480498 
    481499    def checkDependencies(self): 
    482500        """Print the list of ports this one depends on""" 
    … …  
    767785            sys.exit('Error: cannot install ' + self.portName 
    768786                      + ' using haikuporter.  Build to a package instead.' 
    769787                     ) 
     788                      
    770789        print 'Installing ...' 
    771790        self.runCommandSequence(self.bepKeys['INSTALL'], self.workDir) 
     791         
    772792 
    773793    def testPort(self): 
    774794        """Test the resulting binaries""" 
    … …  
    11711191parser.add_option('-c', '--clean', action='store_true', dest='clean', 
    11721192                  default=False, help="clean the working directory of the " 
    11731193                                      "specified port") 
     1194parser.add_option('-u', '--uninstall', action='store_true', dest='uninstall', 
     1195                  default=False, help="uninstall the port") 
    11741196parser.add_option('-g', '--get', action='store_true', dest='get', 
    11751197                  default=False, help="get/update the ports tree") 
    11761198parser.add_option('-f', '--force', action='store_true', dest='force', 

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/