summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevan Franchini <twitch153@hotmail.com>2013-06-21 02:06:29 -0400
committerAnthony G. Basile <blueness@gentoo.org>2013-08-03 09:04:37 -0400
commit81058b615b023de50244c200d420cbbf3f7a49d4 (patch)
treeb5270c582c12c136bb43d1be3fd1e24717fddd9a /WebappConfig
parentWebappConfig/{db,filetype,permissions}.py: code cleanup (diff)
downloadwebapp-config-81058b615b023de50244c200d420cbbf3f7a49d4.tar.gz
webapp-config-81058b615b023de50244c200d420cbbf3f7a49d4.tar.bz2
webapp-config-81058b615b023de50244c200d420cbbf3f7a49d4.zip
Webappconfig/config.py: Adds check for package name and version
This check is done in the run() function if self.work == "clean" to avoid uninstalling a webapp if the package name and version being listed exist, but aren't the ones located in the .webapp in the specified directory taken from the -d flag. X-Gentoo-Bug: 461410 X-Gentoo-Bug-URL: https://bugs.gentoo.org/461410
Diffstat (limited to 'WebappConfig')
-rw-r--r--WebappConfig/config.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index fd106c5..04fb6f2 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -937,12 +937,16 @@ class Config:
self.parser.print_help()
OUT.die('You need to specify at least the application you'
' would like to handle!')
+ else:
+ return self.config.get('USER', 'pn')
def check_version_set(self):
if not self.config.has_option('USER', 'pvr'):
OUT.die('You did not specify which version to handle.\n Use "'
+ self.config.get('USER','g_myname') +
' --help" for usage')
+ else:
+ return self.config.get('USER', 'pvr')
def split_hostname(self):
@@ -1225,10 +1229,12 @@ class Config:
self.__r = wrapper.get_root(self)
wrapper.want_category(self)
- self.check_package_set()
- self.check_version_set()
+ package = self.check_package_set()
+ version = self.check_version_set()
self.set_vars()
+ webapp = package + ' ' + version
+
# special case
#
# if a package has been specified, then chances are that they forgot
@@ -1260,6 +1266,13 @@ class Config:
self.config.set('USER', 'pn', old['WEB_PN'])
self.config.set('USER', 'pvr', old['WEB_PVR'])
+ old_webapp = old['WEB_PN'] + ' ' + old['WEB_PVR']
+
+ if not webapp == old_webapp:
+ OUT.die(webapp + ' does not match ' +
+ old_webapp + ' found in .webapp file at ' +
+ self.installdir() + '.')
+
# we don't want to read the .webapp file if we're upgrading,
# because we've just written the *new* app's details into the file!!
#