Ticket #474: haikuporter-uninstall-2.patch
| File haikuporter-uninstall-2.patch, 3.7 KB (added by triedgeai, 3 years ago) |
|---|
-
generic-1.2.3.bep
diff -urN generic_old/generic-1.2.3.bep generic_new/generic-1.2.3.bep
old new 16 16 make install 17 17 } 18 18 19 UNINSTALL { 20 cd generic-1.2.3 21 make uninstall 22 } 23 19 24 TEST { 20 25 cd generic-1.2.3 21 26 # make test -
(a) haikuporter_old vs. (b) haikuporter_new
a b 6 6 # copyright 2009 Alexander Deynichenko 7 7 # copyright 2009 HaikuBot (aka RISC) 8 8 # copyright 2010-2011 Jack Laxson (Jrabbit) 9 # copyright 2012 Tri-Edge AI 9 10 10 11 info = {} 11 12 info['version'] = 'r' + '$Rev: 1874 $'[6:-2] … … 66 67 bepTypes['DEPEND'] = [types.StringType, types.ListType, types.NoneType] 67 68 bepTypes['BUILD'] = [ShellType] 68 69 bepTypes['INSTALL'] = [ShellType] 70 bepTypes['UNINSTALL'] = [ShellType] 69 71 bepTypes['TEST'] = [ShellType] 70 72 bepTypes['MESSAGE'] = [types.StringType] 71 73 bepTypes['LICENSE'] = [types.StringType, types.ListType] … … 82 84 bepDefaults['DEPEND'] = [False, None] 83 85 bepDefaults['BUILD'] = [False, shell()] 84 86 bepDefaults['INSTALL'] = [False, shell()] 87 bepDefaults['UNINSTALL'] = [False, shell()] 85 88 bepDefaults['TEST'] = [False, shell()] 86 89 bepDefaults['MESSAGE'] = [False, None] 87 90 bepDefaults['LICENSE'] = [False, None] … … 127 130 # -- Main Program ------------------------------------------------------------ 128 131 class HaikuPorter: 129 132 def __init__(self, options, args): 130 131 133 # read global settings 132 134 mainConfig = Config(haikuPortsConf) 133 135 self.confKeys = mainConfig.getKeys() … … 291 293 self.patchSource() 292 294 if options.build: 293 295 self.buildPort() 296 if options.uninstall: 297 self.uninstallPort() 294 298 if options.install: 295 299 self.installPort() 296 300 if options.distro: … … 477 481 print 'Cleaning work directory...' 478 482 shutil.rmtree(self.workDir) 479 483 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 480 498 481 499 def checkDependencies(self): 482 500 """Print the list of ports this one depends on""" … … 767 785 sys.exit('Error: cannot install ' + self.portName 768 786 + ' using haikuporter. Build to a package instead.' 769 787 ) 788 770 789 print 'Installing ...' 771 790 self.runCommandSequence(self.bepKeys['INSTALL'], self.workDir) 791 772 792 773 793 def testPort(self): 774 794 """Test the resulting binaries""" … … 1171 1191 parser.add_option('-c', '--clean', action='store_true', dest='clean', 1172 1192 default=False, help="clean the working directory of the " 1173 1193 "specified port") 1194 parser.add_option('-u', '--uninstall', action='store_true', dest='uninstall', 1195 default=False, help="uninstall the port") 1174 1196 parser.add_option('-g', '--get', action='store_true', dest='get', 1175 1197 default=False, help="get/update the ports tree") 1176 1198 parser.add_option('-f', '--force', action='store_true', dest='force',
