[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2017-06-22 Thread Devan Franchini
commit: 55b6d681dd3df9954094a5fc3732c391e9544036
Author: Devan Franchini  gentoo  org>
AuthorDate: Thu Jun 22 23:01:12 2017 +
Commit: Devan Franchini  gentoo  org>
CommitDate: Thu Jun 22 23:04:31 2017 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=55b6d681

version.py: Updates version number

 WebappConfig/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/WebappConfig/version.py b/WebappConfig/version.py
index f52527b..e41cb0c 100644
--- a/WebappConfig/version.py
+++ b/WebappConfig/version.py
@@ -13,7 +13,7 @@
 #
 # 
 
-WCVERSION = '1.54-git'
+WCVERSION = '1.55-git'
 
 if __name__ == '__main__':
 print(WCVERSION)



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2017-02-15 Thread Devan Franchini
commit: 62e968d5456f773042d66456c4f87334c3d48709
Author: Devan Franchini  gentoo  org>
AuthorDate: Thu Feb 16 02:48:17 2017 +
Commit: Devan Franchini  gentoo  org>
CommitDate: Thu Feb 16 03:03:34 2017 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=62e968d5

db.py: Uses EPREFIX variable

X-Gentoo-Bug: 608018
X-Gentoo-Bug-URL: https://bugs.gentoo.org/608018

 WebappConfig/db.py | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/WebappConfig/db.py b/WebappConfig/db.py
index 0fbd34a..698c49a 100644
--- a/WebappConfig/db.py
+++ b/WebappConfig/db.py
@@ -26,6 +26,7 @@ import time, os, os.path, re
 import WebappConfig.wrapper as wrapper
 
 from WebappConfig.debug   import OUT
+from WebappConfig.eprefix import EPREFIX
 from WebappConfig.permissions import PermissionMap
 
 
@@ -166,7 +167,7 @@ class WebappDB(AppHierarchy):
 
 def __init__(self,
  fs_root= '/',
- root   = '/var/db/webapps',
+ root   = EPREFIX + '/var/db/webapps',
  category   = '',
  package= '',
  version= '',
@@ -416,8 +417,8 @@ class WebappSource(AppHierarchy):
 '''
 
 def __init__(self,
- fs_root= '/',
- root   = '/usr/share/webapps',
+ fs_root= EPREFIX + '/',
+ root   = EPREFIX + '/usr/share/webapps',
  category   = '',
  package= '',
  version= '',



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2017-02-15 Thread Devan Franchini
commit: 192ab96f59acd4f7ddc634a49e9077f8c8aeda94
Author: Devan Franchini  gentoo  org>
AuthorDate: Thu Feb 16 02:48:03 2017 +
Commit: Devan Franchini  gentoo  org>
CommitDate: Thu Feb 16 03:03:14 2017 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=192ab96f

config.py: Uses EPREFIX variable

X-Gentoo-Bug: 608018
X-Gentoo-Bug-URL: https://bugs.gentoo.org/608018

 WebappConfig/config.py | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index 3a176a0..2c11d39 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -37,10 +37,12 @@ import WebappConfig.wrapper as wrapper
 
 from argparse import ArgumentParser
 from WebappConfig.debug   import OUT
+from WebappConfig.eprefix import EPREFIX
 from WebappConfig.version import WCVERSION
 
 from WebappConfig.permissions import PermissionMap
 
+
 # 
 # BashParser class
 # 
@@ -223,14 +225,14 @@ class Config:
 self.__d = {
 'config_protect'   : '',
 # Necessary to load the config file
-'my_etcconfig' : '/etc/vhosts/webapp-config',
+'my_etcconfig' : EPREFIX + 
'/etc/vhosts/webapp-config',
 'my_dotconfig' : '.webapp',
 'my_version'   : WCVERSION,
 'my_conf_version'  : '7',
 'my_bugsurl'   : wrapper.bugs_link,
 'g_myname' : sys.argv[0],
-'g_orig_installdir': '/',
-'g_installdir' : '/',
+'g_orig_installdir': EPREFIX + '/',
+'g_installdir' : EPREFIX + '/',
 'g_link_options'   : '',
 'g_link_type'  : 'hard',
 'g_configprefix'   : '._cfg',
@@ -265,9 +267,9 @@ class Config:
 # -- wrobel
 'vhost_server_uid'  : 'root',
 'vhost_server_gid'  : 'root',
-'my_persistroot': '/var/db/webapps',
+'my_persistroot': EPREFIX + '/var/db/webapps',
 'wa_installsbase'   : 'installs',
-'vhost_root': '/var/www/${vhost_hostname}',
+'vhost_root': EPREFIX + '/var/www/${vhost_hostname}',
 'g_htdocsdir'   : '${vhost_root}/${my_htdocsbase}',
 'my_appdir' : '${my_approot}/${my_appsuffix}',
 'my_htdocsdir'  : '${my_appdir}/htdocs',
@@ -277,7 +279,7 @@ class Config:
 'my_iconsdir'   : '${my_hostrootdir}/${my_iconsbase}',
 'my_errorsdir'  : '${my_hostrootdir}/${my_errorsbase}',
 'g_cgibindir'  : '${vhost_root}/${my_cgibinbase}',
-'my_approot': '/usr/share/webapps',
+'my_approot': EPREFIX + '/usr/share/webapps',
 'package_manager'   : 'portage',
 'allow_absolute': 'no',
 'my_hostrootbase'   : 'hostroot',



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2017-02-15 Thread Devan Franchini
commit: e9b6ef7e44c9bd9c940b60854490a894617fb3ed
Author: Devan Franchini  gentoo  org>
AuthorDate: Thu Feb 16 02:46:55 2017 +
Commit: Devan Franchini  gentoo  org>
CommitDate: Thu Feb 16 02:47:37 2017 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=e9b6ef7e

eprefix.py: Adds EPREFIX variable to import in other places

X-Gentoo-Bug: 608018
X-Gentoo-Bug-URL: https://bugs.gentoo.org/608018

 WebappConfig/eprefix.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/WebappConfig/eprefix.py b/WebappConfig/eprefix.py
new file mode 100644
index 000..7d5bd66
--- /dev/null
+++ b/WebappConfig/eprefix.py
@@ -0,0 +1,6 @@
+# Establish the eprefix, initially set so eprefixify can
+# set it on install
+EPREFIX = "@GENTOO_PORTAGE_EPREFIX@"
+# Check and set it if it wasn't
+if "GENTOO_PORTAGE_EPREFIX" in EPREFIX:
+EPREFIX = ''



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2017-02-15 Thread Devan Franchini
commit: af52e7cfec44828b3722f484f3ed4c0ee4fd22d8
Author: Devan Franchini  gentoo  org>
AuthorDate: Thu Feb 16 03:02:44 2017 +
Commit: Devan Franchini  gentoo  org>
CommitDate: Thu Feb 16 03:03:45 2017 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=af52e7cf

server.py: Uses EPREFIX variable

X-Gentoo-Bug: 608018
X-Gentoo-Bug-URL: https://bugs.gentoo.org/608018

 WebappConfig/server.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/WebappConfig/server.py b/WebappConfig/server.py
index ec9c141..4c3b571 100644
--- a/WebappConfig/server.py
+++ b/WebappConfig/server.py
@@ -22,6 +22,7 @@
 import os, os.path
 
 from WebappConfig.debugimport OUT
+from WebappConfig.eprefix  import EPREFIX
 from WebappConfig.worker   import WebappRemove, WebappAdd
 from WebappConfig.permissions  import get_group, get_user
 
@@ -195,7 +196,7 @@ class Basic:
 dir = self.__destd
 dirs = []
 
-while dir != '/':
+while dir != EPREFIX + '/':
 dirs.insert(0, dir)
 dir = os.path.dirname(dir)
 



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2016-05-12 Thread Anthony G. Basile
commit: 4db4c535273734541352bde38b658e09a20d1c22
Author: Paolo Pedroni  users  noreply  github  
com>
AuthorDate: Tue May  3 09:15:27 2016 +
Commit: Anthony G. Basile  gentoo  org>
CommitDate: Thu May 12 12:38:45 2016 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=4db4c535

ebuild.py: fix bashism

X-Gentoo-Bug: 561798
X-Gentoo-Bug-URL: https://bugs.gentoo.org/561798

Signed-off-by: Anthony G. Basile  gentoo.org>

 WebappConfig/ebuild.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/WebappConfig/ebuild.py b/WebappConfig/ebuild.py
index fecbe44..b10fe9f 100644
--- a/WebappConfig/ebuild.py
+++ b/WebappConfig/ebuild.py
@@ -101,7 +101,7 @@ class Ebuild:
 
 for i in post_instructions:
 i = i.replace('"', '\\"')
-post.append(os.popen('echo -n "' + i + '"\n').read()[:-1])
+post.append(os.popen('printf "' + i + '"\n').read()[:-1])
 
 post = post + [
 '',



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-07-10 Thread Devan Franchini
commit: 9e251c7574d074e424ea19024f743c754f321979
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sat Jul 11 01:25:17 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Sat Jul 11 01:25:20 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=9e251c75

config.py: Fixes package version checking regression

Previously webapp-config would not do any sanity checks when
setting the package version. After adding a sanity check in 1.54
I made the mistake of not being flexible enough and this caused
a regression that prevented web apps with versions such as
20140929d[1] to be installed. This commit fixes that while still
allowing for some sanity checking.

[1]: https://github.com/gentoo/webapp-config/issues/2

 WebappConfig/config.py | 21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index 6c915c3..3a176a0 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -996,17 +996,20 @@ class Config:
 OUT.die('Invalid package name')
 
 if len(args)  1:
-argsvr = args[1].split('.')
-if len(argsvr) == 1:
-OUT.die('Invalid package version: %(pvr)s'
+pvr = args[1]
+has_int = False # A package version should have at least 
one
+# numerical value, but we want to allow for
+# the flexibility of having any 
alphanumeric
+# value while checking to make sure it's 
sane.
+
+for char in pvr:
+if char.isdigit():
+has_int = True
+
+if not has_int:
+OUT.die('Invalid package version: %(pvr)s'
 % {'pvr': args[1]})
 
-pvr = ''
-for i in range(0, len(argsvr)):
-if not i == len(argsvr) - 1:
-pvr += argsvr[i] + '.'
-else:
-pvr += argsvr[i]
 self.config.set('USER', 'pvr', pvr)
 
 if (not options['dir'] and



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/, doc/

2015-07-02 Thread Devan Franchini
commit: 1d9f8b0faf147d454e997143be16a212c9c86144
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Thu Jul  2 14:25:14 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Thu Jul  2 14:25:14 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=1d9f8b0f

Bump to version 1.54

webapp-{eclass, config}.{5, 8}.xml: Adds Devan Franchini to authors

 WebappConfig/version.py |  2 +-
 doc/webapp-config.5.xml | 12 ++--
 doc/webapp-config.8.xml | 12 ++--
 doc/webapp-eclass.5.xml | 12 ++--
 4 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/WebappConfig/version.py b/WebappConfig/version.py
index 76448f2..a795719 100644
--- a/WebappConfig/version.py
+++ b/WebappConfig/version.py
@@ -13,7 +13,7 @@
 #
 # 
 
-WCVERSION = '1.53-git'
+WCVERSION = '1.54'
 
 if __name__ == '__main__':
 print(WCVERSION)

diff --git a/doc/webapp-config.5.xml b/doc/webapp-config.5.xml
index f7fdab4..a3f69b0 100644
--- a/doc/webapp-config.5.xml
+++ b/doc/webapp-config.5.xml
@@ -28,13 +28,21 @@
   addressemailp...@gunnarwrobel.de/email/address
 /affiliation
   /author
+  author
+firstnameDevan/firstname
+surnameFranchini/surname
+affiliation
+  addressemailtwitch...@gentoo.org/email/address
+/affiliation
+  /author
 /authorgroup
 
 copyright
-  year2003-2005/year
+  year2003-2015/year
   holderStuart Herbert/holder
   holderRenat Lumpau/holder
   holderGunnar Wrobel/holder
+  holderDevan Franchini/holder
 /copyright
 
   /articleinfo
@@ -45,7 +53,7 @@
 refentry
   refentryinfo
 titlewebapp-config/title
-   dateNovember 2005/date
+   dateJuly 2015/date
productnameGentoo Linux/productname
   /refentryinfo
   refmeta

diff --git a/doc/webapp-config.8.xml b/doc/webapp-config.8.xml
index 5ab475d..2214d47 100644
--- a/doc/webapp-config.8.xml
+++ b/doc/webapp-config.8.xml
@@ -28,13 +28,21 @@
   addressemailp...@gunnarwrobel.de/email/address
 /affiliation
   /author
+  author
+firstnameDevan/firstname
+surnameFranchini/surname
+affiliation
+  addressemailtwitch...@gentoo.org/email/address
+/affiliation
+  /author
 /authorgroup
 
 copyright
-  year2003-2005/year
+  year2003-2015/year
   holderStuart Herbert/holder
   holderRenat Lumpau/holder
   holderGunnar Wrobel/holder
+  holderDevan Franchini/holder
 /copyright
   /articleinfo
 
@@ -44,7 +52,7 @@
 refentry
   refentryinfo
 titlewebapp-config/title
-   dateNovember 2005/date
+   dateJuly 2015/date
productnameGentoo Linux/productname
   /refentryinfo
   refmeta

diff --git a/doc/webapp-eclass.5.xml b/doc/webapp-eclass.5.xml
index f2a0990..56a993e 100644
--- a/doc/webapp-eclass.5.xml
+++ b/doc/webapp-eclass.5.xml
@@ -28,13 +28,21 @@
   addressemailwro...@gentoo.org/email/address
 /affiliation
   /author
+  author
+firstnameDevan/firstname
+surnameFranchini/surname
+affiliation
+  addressemailtwitch...@gentoo.org/email/address
+/affiliation
+  /author
 /authorgroup
 
 copyright
-  year2003-2006/year
+  year2003-2015/year
   holderStuart Herbert/holder
   holderRenat Lumpau/holder
   holderGunnar Wrobel/holder
+  holderDevan Franchini/holder
 /copyright
   /articleinfo
 
@@ -44,7 +52,7 @@
 refentry
   refentryinfo
 titlewebapp-eclass/title
-   dateJanuary 2006/date
+   dateJuly 2015/date
productnameGentoo Linux/productname
   /refentryinfo
   refmeta



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-07-02 Thread Devan Franchini
commit: e5627dab9a94231803ba69fae4720b07b9773506
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Thu Jul  2 16:49:00 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jul  3 04:49:56 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=e5627dab

version.py: Modifies version to reflect git status

 WebappConfig/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/WebappConfig/version.py b/WebappConfig/version.py
index a795719..f52527b 100644
--- a/WebappConfig/version.py
+++ b/WebappConfig/version.py
@@ -13,7 +13,7 @@
 #
 # 
 
-WCVERSION = '1.54'
+WCVERSION = '1.54-git'
 
 if __name__ == '__main__':
 print(WCVERSION)



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-07-02 Thread Devan Franchini
commit: d4c544a1703e67630aa65a704a946e613ea2081f
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Thu Jul  2 16:49:00 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Thu Jul  2 16:49:00 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=d4c544a1

version.py: Modifies to reflect git version

 WebappConfig/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/WebappConfig/version.py b/WebappConfig/version.py
index a795719..f52527b 100644
--- a/WebappConfig/version.py
+++ b/WebappConfig/version.py
@@ -13,7 +13,7 @@
 #
 # 
 
-WCVERSION = '1.54'
+WCVERSION = '1.54-git'
 
 if __name__ == '__main__':
 print(WCVERSION)



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: 831253e2f7554a701570b71bccc6e6b9507120c7
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Fri Jun 19 22:37:38 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 22:37:40 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=831253e2

config.py: Moves setting of g_orig_installdir to allow lack of -d flag

If this is not moved the .webapp file will not have WEB_INSTALLDIR
properly set when running webapp-config -I PN PVR which causes
issues when trying to uninstall the webapp.

 WebappConfig/config.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index cb9d552..6c915c3 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -933,10 +933,6 @@ class Config:
 
 OUT.set_info_level(1)
 
-# store original installdir
-self.config.set('USER', 'g_orig_installdir',
-self.config.get('USER', 'g_installdir'))
-
 # Provide simple subdomain support
 self.split_hostname()
 
@@ -1023,6 +1019,10 @@ class Config:
 self.config.set('USER', 'g_installdir', pn)
 self.flag_dir = True
 
+# store original installdir
+self.config.set('USER', 'g_orig_installdir',
+self.config.get('USER', 'g_installdir'))
+
 
 # 
 # Helper functions



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/, WebappConfig/tests/

2015-06-19 Thread Devan Franchini
commit: c5d8aba29019bc7949058160d2f43ac3f915
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Thu Oct 30 15:54:47 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:48:01 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=c5d8aba2

Adds beginning stages of external test suite

tests/dtest.py: Removes WebappConfig.content from doctest listing
tests/external.py: Adds tests for Contents class
content.py: Removes doctests

 WebappConfig/content.py| 165 -
 WebappConfig/tests/dtest.py|   2 -
 WebappConfig/tests/external.py | 138 ++
 3 files changed, 138 insertions(+), 167 deletions(-)

diff --git a/WebappConfig/content.py b/WebappConfig/content.py
index e157d23..a582396 100644
--- a/WebappConfig/content.py
+++ b/WebappConfig/content.py
@@ -131,58 +131,6 @@ class Contents:
 def read(self):
 '''
 Reads the contents database.
-
-Some content files have been provided for test purposes:
-
- import os.path
- here = os.path.dirname(os.path.realpath(__file__))
-
-This one should succeed:
-
- a = Contents(here + '/tests/testfiles/contents/',
-...  package = 'test', version = '1.0')
- a.read()
- a.db_print()
-file 1 virtual util/icon_browser.php 1124612216 
9ffb2ca9ccd2db656b97cd26a1b06010 
-file 1 config-owned inc/prefs.php 1124612215 
ffae752dba7092cd2d1553d04a0f0045 
-file 1 virtual lib/prefs.php 1124612215 
ffae752dba7092cd2d1553d04a0f0045 
-file 1 virtual signup.php 1124612220 dc838bc375b3d02dafc414f8e71a2aec 
-file 1 server-owned data.php 1117009618 0 
-sym 1 virtual test 1124612220 dc838bc375b3d02dafc414f8e71a2aec /I link 
/ to a very / strange location
-dir 1 default-owned util 1117009618 0 
-dir 1 config-owned inc 1117009618 0 
-dir 1 default-owned lib 1117009618 0 
-dir 0 default-owned /var/www/localhost/cgi-bin 1124577741 0 
-dir 0 default-owned /var/www/localhost/error 1124577740 0 
-dir 0 default-owned /var/www/localhost/icons 1124577741 0 
-
- a.get_directories() #doctest: +ELLIPSIS
-['.../contents//util', '.../contents//inc', '.../contents//lib', 
'/var/www/localhost/cgi-bin', '/var/www/localhost/error', 
'/var/www/localhost/icons']
-
-This is a corrupted file that checks all fail safes:
-
- OUT.color_off()
- a = Contents(here + '/tests/testfiles/contents/',
-...  package = 'test', version = '1.1')
- a.read() #doctest: +ELLIPSIS
-* Invalid line in content file (dir 1 default-owned). Ignoring!
-* Content file .../tests/testfiles/contents//.webapp-test-1.1 has an 
invalid line:
-* dir 1 nobody-owned  1117009618 0
-* Invalid owner: nobody-owned
-* Invalid line in content file (dir 1 nobody-owned  1117009618 0). 
Ignoring!
-* Content file .../tests/testfiles/contents//.webapp-test-1.1 has an 
invalid line:
-* garbage 1 virtual  1124612215 ffae752dba7092cd2d1553d04a0f0045
-* Invalid file type: garbage
-* Invalid line in content file (garbage 1 virtual  1124612215 
ffae752dba7092cd2d1553d04a0f0045). Ignoring!
-* Invalid line in content file (file 1 virtual). Ignoring!
-* Content file .../tests/testfiles/contents//.webapp-test-1.1 has an 
invalid line:
-* file 1 virtual 
-* Not enough entries.
-* Invalid line in content file (file 1 virtual ). Ignoring!
-* Content file .../tests/testfiles/contents//.webapp-test-1.1 has an 
invalid line:
-* file 31 config-owned  1124612215 ffae752dba7092cd2d1553d04a0f0045
-* Invalid relative flag: 31
-* Invalid line in content file (file 31 config-owned  1124612215 
ffae752dba7092cd2d1553d04a0f0045). Ignoring!
 '''
 
 dbpath = self.appdb()
@@ -270,18 +218,6 @@ class Contents:
 def write(self):
 '''
 Write the contents file.
-
-A short test:
-
- import os.path
- here = os.path.dirname(os.path.realpath(__file__))
- a = Contents(here + '/tests/testfiles/contents/',
-...  package = 'test', version = '1.0',
-...  pretend = True)
- a.read()
- OUT.color_off()
- a.write() #doctest: +ELLIPSIS
-* Would have written content file 
.../tests/testfiles/contents//.webapp-test-1.0!
 '''
 
 dbpath = self.appdb()
@@ -378,77 +314,6 @@ class Contents:
   real_path   - for config-protected files realpath =! path
 (and this is important for md5)
   relative- 1 for storing a relative filename, 0 otherwise
-
-OUT.color_off()
-import os.path
-here = os.path.dirname(os.path.realpath(__file__))
-
- 

[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: dd0b8ce636d7a533c8e2efcfbee905d2de4ff744
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Tue Oct 14 19:15:27 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:46:57 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=dd0b8ce6

config.py: Changes --query nargs to 2

 WebappConfig/config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index 84840bb..acf7b7a 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -633,7 +633,7 @@ class Config:
'instructions when they were shown to you ;-)')
 
 info_opts.add_argument('--query',
-   action='store_true')
+   nargs=2)
 
 #-
 # Other Options



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/, WebappConfig/tests/

2015-06-19 Thread Devan Franchini
commit: 0d17ba688563a9620343bde58360b0f7206783c6
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun Nov  2 07:29:05 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:48:42 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=0d17ba68

Adds Ebuild tests to external test suite

tests/dtest.py: Removes WebappConfig.ebuild from doctest listing
tests/external.py: Adds tests for Ebuild class
ebuild.py: Removes doctests, the tests used for testing run_hooks()
were not added to the external test suite due to the fact that there
is no return to check against, just output.

 WebappConfig/ebuild.py | 141 -
 WebappConfig/tests/dtest.py|   2 -
 WebappConfig/tests/external.py |  37 +++
 3 files changed, 37 insertions(+), 143 deletions(-)

diff --git a/WebappConfig/ebuild.py b/WebappConfig/ebuild.py
index 24ef0d6..fecbe44 100644
--- a/WebappConfig/ebuild.py
+++ b/WebappConfig/ebuild.py
@@ -35,69 +35,6 @@ class Ebuild:
 This class handles all ebuild related task. Currently this includes
 displaying the post install instruction as well as running hooks
 provided by the ebuild.
-
-This creates the basic configuration defaults:
-
- import WebappConfig.config
- config = WebappConfig.config.Config()
-
-This needs to be completed with some parameters
-that would be usually provided when parsing the
-commandline:
-
- config.config.set('USER', 'my_htdocsbase',  'htdocs')
- config.config.set('USER', 'pn',   'horde')
- config.config.set('USER', 'pvr',  '3.0.5')
- config.config.set('USER', 'vhost_server_uid', 'apache')
- config.config.set('USER', 'vhost_server_gid', 'apache')
-
-And the application directory needs to be set
-to the testfile reporitory
-
- import os.path
- here = os.path.dirname(os.path.realpath(__file__))
- config.config.set('USER', 'my_approot', here +
-...   '/tests/testfiles/share-webapps')
-
-Time to create the ebuild handler:
-
- my_approot = config.config.get('USER', 'my_approot')
- my_appdir = my_approot + /horde/3.0.5
- config.config.set('USER', 'my_appdir', my_appdir)
- config.config.set('USER', 'my_hookscriptsdir', my_appdir + '/hooks')
- config.config.set('USER', 'my_cgibinbase', 'cgi-bin')
- config.config.set('USER', 'my_errorsbase', 'error')
- config.config.set('USER', 'my_iconsbase', 'icons')
- config.config.set('USER', 'my_serverconfigdir', 
'/'.join([my_appdir,'conf']))
- config.config.set('USER', 'my_hostrootdir', 
'/'.join([my_appdir,'hostroot']))
- config.config.set('USER', 'my_htdocsdir', 
'/'.join([my_appdir,'htdocs']))
- config.config.set('USER', 'my_sqlscriptsdir', 
'/'.join([my_appdir,'sqlscripts']))
- a = Ebuild(config)
-
-Run a hook script:
-
- from WebappConfig.server import Basic
- basic = Basic({'source': '', 'destination': '', 'hostroot': '', 
'vhostroot':''},
-...   config.create_permissions(),
-...   
{'source':'','content':'','protect':'','dotconfig':'','ebuild':'','db':''},
-...   {'verbose':False,'pretend':True}, 'portage')
- a.run_hooks('test', basic)
-
-The same on a directory that misses a hook dir:
-
- config.config.set('USER', 'pn',   'empty')
- config.config.set('USER', 'pvr',  '1.0')
- a = Ebuild(config)
- a.run_hooks('test', basic)
-
-This app has a hook dir but no script:
-
- config.config.set('USER', 'pn',   'uninstalled')
- config.config.set('USER', 'pvr',  '6.6.6')
- a = Ebuild(config)
- a.run_hooks('test', basic)
-
-
 '''
 
 def __init__(self, config):
@@ -197,80 +134,6 @@ class Ebuild:
 This function exports the necessary variables to the shell
 environment so that they are accessible within the shell scripts
 and/or files provided by the ebuild.
-
-The procedure from above is repeated to set up the default
-environment:
-
- import WebappConfig.config
- config = WebappConfig.config.Config()
- config.config.set('USER', 'my_htdocsbase',  'htdocs')
- config.config.set('USER', 'pn',   'horde')
- config.config.set('USER', 'pvr',  '3.0.5')
- import os.path
- here = os.path.dirname(os.path.realpath(__file__))
- config.config.set('USER', 'my_approot', here +
-...   '/tests/testfiles/share-webapps')
- my_approot = config.config.get('USER', 'my_approot')
- my_appdir = my_approot + /horde/3.0.5
- config.config.set('USER', 'my_appdir', my_appdir)
- config.config.set('USER', 'my_hookscriptsdir', my_appdir + 
'/hooks')
- config.config.set('USER', 'my_cgibinbase', 'cgi-bin')
- config.config.set('USER', 'my_errorsbase', 'error')
- config.config.set('USER', 'my_iconsbase', 'icons')
- 

[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: 440212ff44f2168a93c81bff05479c7a8335fb59
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Tue Oct 14 19:12:31 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:46:39 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=440212ff

config.py: Adds query to list of actions to get pn and pvr

 WebappConfig/config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index 7ea194f..84840bb 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -975,7 +975,7 @@ class Config:
 
 OUT.debug('Checking command line arguments', 1)
 
-if self.work in ['install', 'clean', 'show_postinst',
+if self.work in ['install', 'clean', 'query', 'show_postinst',
  'show_postupgrade', 'upgrade']:
 # get cat / pn
 args = options[self.work]



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: dfacbd61aa4c39e6518a018031fcbd9825ee80b8
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Fri Nov 14 01:06:26 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:49:35 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=dfacbd61

config.py: Modifies import strategy for config parser

On systems which had dev-python/configparser installed (a package
to add support for the py3.x configparser class in py2.x)
webapp-config would make use of that class instead of py2.x's built
in ConfigParser class. This would lead to improper interpolation of
configuration variables that follow the syntax ${var}. This
dangerous behavior could (and has) lead to webapp-config installing
a webapp to the root filesystem of a host. This danger has been
avoided by modifying the import strategy for the config parser we're
using so that we force import the ConfigParser class if using py2.x.

X-Gentoo-Bug: 528752
X-Gentoo-Bug-URL: https://bugs.gentoo.org/528752

 WebappConfig/config.py | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index cdae149..c87b93b 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -21,15 +21,12 @@
 
 import sys, os, os.path, re, socket, time
 
-try:
+if sys.hexversion = 0x300:
 # Python 3
 import configparser
-if sys.version_info = (3, 2):
-from configparser import ConfigParser as configparser_ConfigParser
-from configparser import ExtendedInterpolation
-else:
-from configparser import SafeConfigParser as configparser_ConfigParser
-except ImportError:
+from configparser import ConfigParser as configparser_ConfigParser
+from configparser import ExtendedInterpolation
+else:
 # Python 2
 import ConfigParser as configparser
 from ConfigParser import SafeConfigParser as configparser_ConfigParser



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: 45afbf20372a5466f5704397944acb5f705402fc
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun May 17 02:26:44 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:51:17 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=45afbf20

config.py: Adds optionality to --dir flag

If the --dir flag is not specified with actions that require
the dir flag then webapp-config will default to the name of the
package as the installation directory.

 WebappConfig/config.py | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index 06dfc4c..c9c0baf 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -429,8 +429,9 @@ class Config:
'--dir',
nargs = 1,
help = 'Install application into DIR under 
the'
-   ' htdocs dir. The default is '
-   + self.config.get('USER', 'g_installdir'))
+   ' htdocs dir. Not specifying using this flag'
+   ' will result in defaulting to the package '
+   ' name.')
 
 inst_locs.add_argument('-h',
'--host',
@@ -891,7 +892,6 @@ class Config:
 
 # Map command line options into the configuration
 option_to_config = {'host' : 'vhost_hostname',
-'dir'  : 'g_installdir',
 'server'   : 'vhost_server',
 'secure'   : 'g_secure',
 'user' : 'vhost_config_uid',
@@ -1009,6 +1009,15 @@ class Config:
 pvr += argsvr[i]
 self.config.set('USER', 'pvr', pvr)
 
+if not options['dir'] and self.work != 'list_installs':
+pn  = self.config.get('USER', 'pn')
+msg = 'Install dir flag not supplied, defaulting to '\
+  '%(pn)s.' % {'pn': pn}
+
+OUT.warn(msg)
+self.config.set('USER', 'g_installdir', pn)
+self.flag_dir = True
+
 
 # 
 # Helper functions



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/tests/

2015-06-19 Thread Devan Franchini
commit: c92b8de104d78fa428e909ccd4439eb809b36e09
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Thu May 14 20:19:32 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:50:27 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=c92b8de1

external.py: Modifies assertion to reflect the expected non-existant webapp 
result

 WebappConfig/tests/external.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/WebappConfig/tests/external.py b/WebappConfig/tests/external.py
index a7ac5ff..97e95fc 100755
--- a/WebappConfig/tests/external.py
+++ b/WebappConfig/tests/external.py
@@ -257,7 +257,7 @@ class WebappSourceTest(unittest.TestCase):
   package = 'nihil',
   version = '3.0.5',
   pm = 'portage')
-self.assertEqual(source.packageavail(), 1)
+self.assertEqual(source.packageavail(), 0)
 
 
 class DotConfigTest(unittest.TestCase):



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: 24a6f7413e784513d432451b92fa799980b09b1d
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sat May 16 02:10:54 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:50:52 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=24a6f741

{config, db}.py: Adds proper support for list-installs command

The webapp-config man page says that the --list-installs flag
can be the package name, and/or version, or *. So changes
needed to be made to allow for this functionality.

 WebappConfig/config.py | 43 +++
 WebappConfig/db.py |  2 +-
 2 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index c87b93b..2c14baa 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -579,7 +579,7 @@ class Config:
 
 info_opts.add_argument('-li',
'--list-installs',
-   nargs = 2,
+   nargs = '*',
help = 'List all current virtual installs for 
a'
'pplication. Use * for the package name and/or 
'
'version number to list more than one package / 
'
@@ -972,32 +972,43 @@ class Config:
 
 OUT.debug('Checking command line arguments', 1)
 
-if self.work in ['install', 'clean', 'query', 'show_postinst',
- 'show_postupgrade', 'upgrade']:
+if self.work in ['install', 'clean', 'query', 'list_installs',
+ 'show_postinst', 'show_postupgrade', 'upgrade']:
 # get cat / pn
 args = options[self.work]
+m= args[0].split('/')
+
+if self.work == 'list_installs' and len(args)  2:
+msg = os.path.basename(sys.argv[0]) + ': error: argument -li/'\
+  '--list-installs: expected up to 2 arguments'
 
-m = args[0].split('/')
+self.parser.print_usage()
+print(msg)
+sys.exit()
 
 if len(m) == 1:
-self.config.set('USER', 'pn',  m[0])
+if '*' not in m:
+self.config.set('USER', 'pn',  m[0])
 elif len(m) == 2:
 self.config.set('USER', 'cat', m[0])
-self.config.set('USER', 'pn',  m[1])
+if '*' not in m:
+self.config.set('USER', 'pn',  m[1])
 else:
 OUT.die('Invalid package name')
 
-argsvr = args[1].split('.')
-if len(argsvr) == 1:
-OUT.die('Invalid package version: %(pvr)s' % {'pvr': args[1]})
+if len(args)  1:
+argsvr = args[1].split('.')
+if len(argsvr) == 1:
+OUT.die('Invalid package version: %(pvr)s' % {'pvr': 
args[1]})
+
+pvr = ''
+for i in range(0, len(argsvr)):
+if not i == len(argsvr) - 1:
+pvr += argsvr[i] + '.'
+else:
+pvr += argsvr[i]
+self.config.set('USER', 'pvr', pvr)
 
-pvr = ''
-for i in range(0, len(argsvr)):
-if not i == len(argsvr) - 1:
-pvr += argsvr[i] + '.'
-else:
-pvr += argsvr[i]
-self.config.set('USER', 'pvr', pvr)
 
 # 
 # Helper functions

diff --git a/WebappConfig/db.py b/WebappConfig/db.py
index 0fbd34a..06d9e04 100644
--- a/WebappConfig/db.py
+++ b/WebappConfig/db.py
@@ -403,7 +403,7 @@ class WebappDB(AppHierarchy):
 OUT.info('  ' + i[3].strip(), 1)
 else:
 # This is a simplified form for the webapp.eclass
-print(i[3].strip())
+OUT.info(i[3].strip(), 1)
 
 # 
 # Handler for /usr/share/webapps



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/, WebappConfig/tests/

2015-06-19 Thread Devan Franchini
commit: d821ced503b71edda66439b19b764d3a257519c8
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Fri Oct 31 14:11:20 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:48:21 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=d821ced5

Adds WebappDB and WebappSource tests to external test suite

tests/dtest.py: Removes WebappConfig.db from doctest listing
tests/external.py: Adds tests for WebappDB and WebappSource classes
db.py: Removes doctests

 WebappConfig/db.py | 174 -
 WebappConfig/tests/dtest.py|   2 -
 WebappConfig/tests/external.py | 121 
 3 files changed, 121 insertions(+), 176 deletions(-)

diff --git a/WebappConfig/db.py b/WebappConfig/db.py
index aa33ac5..0fbd34a 100644
--- a/WebappConfig/db.py
+++ b/WebappConfig/db.py
@@ -162,100 +162,6 @@ class WebappDB(AppHierarchy):
 '''
 The DataBase class handles a file-oriented data base that stores
 information about virtual installs of web applications.
-
-Some test files are needed to test the functionality. This localizes
-the current position:
-
- import os.path
- here = os.path.dirname(os.path.realpath(__file__))
-
-Deactivates color output which is bad for the doctest
-
- OUT.color_off()
-
-Initialize the class:
-
- a = WebappDB(root = here + '/tests/testfiles/webapps')
-
-This lists the database:
- a.listinstalls()
-/var/www/localhost/htdocs/gallery
-/var/www/localhost/htdocs/horde
-/var/www/localhost/htdocs/phpldapadmin
-
-Which is also possible in a more user friendly way:
-
- b = WebappDB(root = here + '/tests/testfiles/webapps', verbose = True)
- b.listinstalls()
-* Installs for gallery-1.4.4_p6
-*   /var/www/localhost/htdocs/gallery
-* Installs for horde-3.0.5
-*   /var/www/localhost/htdocs/horde
-* Installs for phpldapadmin-0.9.7_alpha4
-*   /var/www/localhost/htdocs/phpldapadmin
-
-The function 'get_inst_files' handles the file locations within the
-database. If no package has been specified while initializing
-the database, the funtion will return all files available:
-
-(code will only return package and varsion since the actual path
- varies whith your code location)
-
- sb = [i[1] for i in b.list_locations().items()]
- sb.sort(key=lambda x: x[0]+x[1]+x[2])
- sb
-[['', 'gallery', '1.4.4_p6'], ['', 'gallery', '2.0_rc2'], ['', 'horde', 
'3.0.5'], ['', 'phpldapadmin', '0.9.7_alpha4']]
-
- c = WebappDB(root = here + '/tests/testfiles/webapps',
-...  package = 'horde', version = '3.0.5')
- [i[1] for i in c.list_locations().items()]
-[['', 'horde', '3.0.5']]
-
-Package specifiers that do not map to an install file will yield
-an empty result and a warning.
-
-The warning is turned off for the example:
- OUT.warn_off()
-
- c = WebappDB(root = here + '/tests/testfiles/webapps',
-...  package = 'garbish', version = '3.0.5')
- [i[1] for i in c.list_locations().items()]
-[]
-
-Package specifiers that do not map to an install file will yield
-an empty result and a warning:
- c = WebappDB(root = here + '/tests/testfiles/webapps',
-...  package = 'horde', version = '8.1.1')
- [i[1] for i in c.list_locations().items()]
-[]
-
-The warning is turned off for the example:
- OUT.warn_on()
-
-Virtual installs can be added or removed using the corresponding
-functions (the example will just pretend to write):
-
- d = WebappDB(root = here + '/tests/testfiles/webapps', pretend = True,
-...  package = 'horde', version = '3.0.5')
- d.add('/my/really/weird/hierarchy/for/horde', #doctest: +ELLIPSIS
-...   user = 'me', group = 'me')
-* Pretended to append installation /my/really/weird/hierarchy/for/horde
-* Entry:
-* ... me me /my/really/weird/hierarchy/for/horde
-* 
- d.remove('/var/www/localhost/htdocs/horde')
-* Pretended to remove installation /var/www/localhost/htdocs/horde
-* Final DB content:
-* 
-* 
-
- d.remove('/my/really/weird/hierarchy/for/horde')  #doctest: +ELLIPSIS
-* Installation at /my/really/weird/hierarchy/for/horde could not be 
found in the database file. Check the entries in 
.../tests/testfiles/webapps/horde/3.0.5/installs!
-* Pretended to remove installation /my/really/weird/hierarchy/for/horde
-* Final DB content:
-* 1124612110 root root /var/www/localhost/htdocs/horde
-* 
-
 '''
 
 def __init__(self,
@@ -507,28 +413,6 @@ class WebappSource(AppHierarchy):
 '''
 The WebappSource class handles a web application hierarchy under
 /usr/share/webapps.
-
-Some test files are needed to test the functionality. This localizes
-the current position:
-
- import os.path
- here = 

[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/tests/, WebappConfig/

2015-06-19 Thread Devan Franchini
commit: 4b2d150b36e01a6b11d714586f5e521db4d639e1
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Mon Nov  3 00:57:18 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:49:13 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=4b2d150b

Adds WebappAdd and WebappRemove tests to external test suite

tests/dtest.py: Deletes dtest.py
tests/external.py: Adds tests for WebappAdd and WebappRemove
worker.py: Removes doctests

 WebappConfig/tests/dtest.py|  19 ---
 WebappConfig/tests/external.py |  81 +++
 WebappConfig/worker.py | 122 -
 3 files changed, 81 insertions(+), 141 deletions(-)

diff --git a/WebappConfig/tests/dtest.py b/WebappConfig/tests/dtest.py
deleted file mode 100644
index 6931dd8..000
--- a/WebappConfig/tests/dtest.py
+++ /dev/null
@@ -1,19 +0,0 @@
-
-# KOLAB LIBRARY - TESTING CONDITION.PY
-
-# test_condition.py -- Testing condition.py
-# Copyright 2005 Gunnar Wrobel
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-import unittest, doctest, sys
-
-import WebappConfig.worker
-
-def test_suite():
-return unittest.TestSuite((
-doctest.DocTestSuite(WebappConfig.worker),
-))
-
-if __name__ == '__main__':
-unittest.main(defaultTest='test_suite')

diff --git a/WebappConfig/tests/external.py b/WebappConfig/tests/external.py
index 69fd912..a7ac5ff 100755
--- a/WebappConfig/tests/external.py
+++ b/WebappConfig/tests/external.py
@@ -31,6 +31,7 @@ from  WebappConfig.ebuildimport Ebuild
 from  WebappConfig.filetype  import FileType
 from  WebappConfig.protect   import Protection
 from  WebappConfig.serverimport Basic
+from  WebappConfig.workerimport WebappAdd, WebappRemove
 from  warnings   import filterwarnings, resetwarnings
 
 HERE = os.path.dirname(os.path.realpath(__file__))
@@ -420,6 +421,86 @@ class ProtectTest(unittest.TestCase):
 self.assertEqual(output[8], '* etc-update')
 
 
+class WebappAddTest(unittest.TestCase):
+def test_mk(self):
+OUT.color_off()
+contents = Contents('/'.join((HERE, 'testfiles', 'installtest')),
+pretend = True)
+webrm = WebappRemove(contents, True, True)
+protect = Protection('', 'horde', '3.0.5', 'portage')
+source = WebappSource(root = '/'.join((HERE, 'testfiles',
+ 'share-webapps')),
+  category = '', package = 'installtest',
+  version = '1.0')
+source.read()
+source.ignore = ['.svn']
+
+webadd = WebappAdd('htdocs',
+   '/'.join((HERE, 'testfiles', 'installtest')),
+   {'dir': {'default-owned': ('root',
+  'root',
+  '0644')},
+'file': {'virtual':  ('root',
+   'root',
+   '0644'),
+ 'server-owned': ('apache',
+  'apache',
+  '0660'),
+ 'config-owned': ('nobody',
+  'nobody',
+  '0600')}
+   },
+   {'content': contents,
+'removal': webrm,
+'protect': protect,
+'source' : source},
+   {'relative': 1,
+'upgrade' : False,
+'pretend' : True,
+'verbose' : False,
+'linktype': 'soft'})
+webadd.mkfile('test1')
+webadd.mkfile('test4')
+webadd.mkfile('test2')
+webadd.mkfile('test3')
+webadd.mkdir('dir1')
+webadd.mkdir('dir2')
+
+output = sys.stdout.getvalue().split('\n')
+
+self.assertEqual(output[0], '* pretending to add: sym 1 virtual ' +
+'test1')
+self.assertEqual(output[1], '* pretending to add: file 1 ' +
+'server-owned test4')
+self.assertEqual(output[3], '* pretending to add: sym 1 virtual ' +
+'test2')
+self.assertEqual(output[4], '^o^ hiding test3')
+self.assertEqual(output[6], '* pretending to add: dir 1 ' +
+ 

[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/tests/, WebappConfig/

2015-06-19 Thread Devan Franchini
commit: 15149d31eaaca1a97c83adc437505210bfdd467c
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun Nov  2 08:15:18 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:48:55 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=15149d31

Adds FileType tests to external test suite

tests/dtest.py: Removes WebappConfig.filetype from doctest listing
tests/external.py: Adds tests for FileType class
filetype.py: Removes doctests

 WebappConfig/filetype.py   | 79 --
 WebappConfig/tests/dtest.py|  2 --
 WebappConfig/tests/external.py | 37 
 3 files changed, 37 insertions(+), 81 deletions(-)

diff --git a/WebappConfig/filetype.py b/WebappConfig/filetype.py
index 63d7e5f..d677189 100644
--- a/WebappConfig/filetype.py
+++ b/WebappConfig/filetype.py
@@ -36,80 +36,6 @@ class FileType:
 
 - a list of all files and directories owned by the config user
 - a list of all files and directories owned by the server user
-
-This creates such lists:
-
- config_owned = [ 'a', 'a/b/c/d', '/e', '/f/', '/g/h/', 'i\\n']
- server_owned = [ 'j', 'k/l/m/n', '/o', '/p/', '/q/r/', 's\\n']
-
-The class is initialized with these two arrays:
-
- a = FileType(config_owned, server_owned)
-
-This class provides three functions to retrieve information about
-the file or directory type.
-
-File types
---
-
- a.filetype('a')
-'config-owned'
- a.filetype('a/b/c/d')
-'config-owned'
-
- a.filetype('j')
-'server-owned'
- a.filetype('/o')
-'server-owned'
-
-File names - whether specified as input in the
-{config,server}_owned lists or as key for retrieving the type - may
-have leading or trailing whitespace. It will be removed. Trailing
-
- a.filetype('\\n s')
-'server-owned'
- a.filetype('/g/h\\n')
-'config-owned'
-
-Unspecified files will result in a virtual type:
-
- a.filetype('unspecified.txt')
-'virtual'
-
-This behaviour can be influenced by setting the 'virtual_files'
-option for the class (which corresponds to the --virtual-files command
-line option):
-
- b = FileType(config_owned, server_owned,
-...  virtual_files = 'server-owned')
- b.filetype('unspecified.txt')
-'server-owned'
-
-Directory types
----
-
-The class does not know if the given keys are files or directories.
-This is specified using the correct function for them. So the same
-keys that were used above can also be used here:
-
- a.dirtype('a')
-'config-owned'
- a.dirtype('j')
-'server-owned'
-
-The same whitespace and trailing slash fixing rules apply for
-directory names:
-
- a.dirtype('\\n s')
-'server-owned'
- a.dirtype('/g/h\\n')
-'config-owned'
-
-Unspecified directories are 'default-owned' and not marked 'virtual':
-
- a.dirtype('unspecified.txt')
-'default-owned'
-
 '''
 
 def __init__(self,
@@ -224,8 +150,3 @@ class FileType:
 filename = re.compile('/+').sub('/', filename) 
 
 return filename
-
-
-if __name__ == '__main__':
-import doctest, sys
-doctest.testmod(sys.modules[__name__])

diff --git a/WebappConfig/tests/dtest.py b/WebappConfig/tests/dtest.py
index a46be2c..bfb82fa 100644
--- a/WebappConfig/tests/dtest.py
+++ b/WebappConfig/tests/dtest.py
@@ -8,13 +8,11 @@
 
 import unittest, doctest, sys
 
-import WebappConfig.filetype
 import WebappConfig.protect
 import WebappConfig.worker
 
 def test_suite():
 return unittest.TestSuite((
-doctest.DocTestSuite(WebappConfig.filetype),
 doctest.DocTestSuite(WebappConfig.protect),
 doctest.DocTestSuite(WebappConfig.worker),
 ))

diff --git a/WebappConfig/tests/external.py b/WebappConfig/tests/external.py
index 88b98c8..c8b0646 100755
--- a/WebappConfig/tests/external.py
+++ b/WebappConfig/tests/external.py
@@ -28,6 +28,7 @@ from  WebappConfig.dbimport WebappDB, WebappSource
 from  WebappConfig.debug import OUT
 from  WebappConfig.dotconfig import DotConfig
 from  WebappConfig.ebuildimport Ebuild
+from  WebappConfig.filetype  import FileType
 from  WebappConfig.serverimport Basic
 from  warnings   import filterwarnings, resetwarnings
 
@@ -329,6 +330,42 @@ class EbuildTest(unittest.TestCase):
  'hostroot')))
 
 
+class FileTypeTest(unittest.TestCase):
+def test_filetypes(self):
+config_owned = ('a', 'a/b/c/d', '/e', '/f/', '/g/h/', 'i\\n')
+server_owned = ('j', 'k/l/m/n', '/o', '/p/', '/q/r/', 's\\n')
+
+types = FileType(config_owned, server_owned)
+
+self.assertEqual(types.filetype('a'),   'config-owned')
+self.assertEqual(types.filetype('a/b/c/d'), 'config-owned')
+self.assertEqual(types.filetype('j'),   

[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: eb983fc49914c942d476c62f73e025b1e95c8748
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun May 17 03:44:03 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:52:03 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=eb983fc4

db.py: Reverts OUT.info() call to print() in listinstalls()

 WebappConfig/db.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/WebappConfig/db.py b/WebappConfig/db.py
index 06d9e04..0fbd34a 100644
--- a/WebappConfig/db.py
+++ b/WebappConfig/db.py
@@ -403,7 +403,7 @@ class WebappDB(AppHierarchy):
 OUT.info('  ' + i[3].strip(), 1)
 else:
 # This is a simplified form for the webapp.eclass
-OUT.info(i[3].strip(), 1)
+print(i[3].strip())
 
 # 
 # Handler for /usr/share/webapps



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/tests/, WebappConfig/

2015-06-19 Thread Devan Franchini
commit: bbf371a6dd55427e4a44b8566b63caa4b8507b32
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun Nov  2 05:56:40 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:48:33 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=bbf371a6

Adds DotConfig tests to external test suite

tests/dtest.py: Removes WebappConfig.dotconfig from doctest listing
tests/external.py: Adds tests for DotConfig class
dotconfig.py: Removes doctests

 WebappConfig/dotconfig.py  | 61 --
 WebappConfig/tests/dtest.py|  2 --
 WebappConfig/tests/external.py | 47 +---
 3 files changed, 43 insertions(+), 67 deletions(-)

diff --git a/WebappConfig/dotconfig.py b/WebappConfig/dotconfig.py
index 948fa90..0d5f661 100644
--- a/WebappConfig/dotconfig.py
+++ b/WebappConfig/dotconfig.py
@@ -35,63 +35,6 @@ class DotConfig:
 '''
 This class handles the dotconfig file that will be written to all
 virtual install locations.
-
-A virtual install location has been prepared in the testfiles
-directory:
-
- import os.path
- here = os.path.dirname(os.path.realpath(__file__))
- a = DotConfig(here + '/tests/testfiles/htdocs/horde')
- a.has_dotconfig()
-True
-
-This directory contains no virtual install:
-
- b = DotConfig(here + '/tests/testfiles/htdocs/empty')
- b.has_dotconfig()
-False
-
-The horde install directory is empty:
-
- a.is_empty()
-
-This install location has another web application installed::
-
- b = DotConfig(here + '/tests/testfiles/htdocs/complain')
- b.is_empty()
-'!morecontents .webapp-cool-1.1.1'
-
-This prints what is installed in the horde directory (and
-tests the read() function):
-
- a.show_installed()
-horde 3.0.5
-
-This will pretend to write a .webapp file (this test has too many 
ellipsis):
-
- OUT.color_off() 
- a = DotConfig('/nowhere', pretend = True)
- a.write('www-apps', 'horde', '5.5.5', 'localhost', '/horde3', 'me:me') 
#doctest: +ELLIPSIS
-* Would have written the following information into /nowhere/.webapp:
-* # .webapp
-...
-* 
-* WEB_CATEGORY=www-apps
-* WEB_PN=horde
-* WEB_PVR=5.5.5
-* WEB_INSTALLEDBY=...
-* WEB_INSTALLEDDATE=...
-* WEB_INSTALLEDFOR=me:me
-* WEB_HOSTNAME=localhost
-* WEB_INSTALLDIR=/horde3
-
-Delete the .webapp file if possible:
-
- a = DotConfig(here + '/tests/testfiles/htdocs/horde', pretend = True)
- a.kill() #doctest: +ELLIPSIS
-* Would have removed .../tests/testfiles/htdocs/horde/.webapp
-True
-
 '''
 
 def __init__(self,
@@ -290,7 +233,3 @@ class DotConfig:
 else:
 OUT.notice('--- ' + empty)
 return False
-
-if __name__ == '__main__':
-import doctest, sys
-doctest.testmod(sys.modules[__name__])

diff --git a/WebappConfig/tests/dtest.py b/WebappConfig/tests/dtest.py
index 645aee7..8dab47a 100644
--- a/WebappConfig/tests/dtest.py
+++ b/WebappConfig/tests/dtest.py
@@ -8,7 +8,6 @@
 
 import unittest, doctest, sys
 
-import WebappConfig.dotconfig
 import WebappConfig.ebuild
 import WebappConfig.filetype
 import WebappConfig.protect
@@ -16,7 +15,6 @@ import WebappConfig.worker
 
 def test_suite():
 return unittest.TestSuite((
-doctest.DocTestSuite(WebappConfig.dotconfig),
 doctest.DocTestSuite(WebappConfig.ebuild),
 doctest.DocTestSuite(WebappConfig.filetype),
 doctest.DocTestSuite(WebappConfig.protect),

diff --git a/WebappConfig/tests/external.py b/WebappConfig/tests/external.py
index 3263c1a..ffe76e8 100755
--- a/WebappConfig/tests/external.py
+++ b/WebappConfig/tests/external.py
@@ -22,10 +22,11 @@ import os
 import unittest
 import sys
 
-from  WebappConfig.content import Contents
-from  WebappConfig.db  import WebappDB, WebappSource
-from  WebappConfig.debug   import OUT
-from  warnings import filterwarnings, resetwarnings
+from  WebappConfig.content   import Contents
+from  WebappConfig.dbimport WebappDB, WebappSource
+from  WebappConfig.debug import OUT
+from  WebappConfig.dotconfig import DotConfig
+from  warnings   import filterwarnings, resetwarnings
 
 HERE = os.path.dirname(os.path.realpath(__file__))
 
@@ -253,6 +254,44 @@ class WebappSourceTest(unittest.TestCase):
 self.assertEqual(source.packageavail(), 1)
 
 
+class DotConfigTest(unittest.TestCase):
+def test_has_dotconfig(self):
+dotconf = DotConfig('/'.join((HERE, 'testfiles', 'htdocs', 'horde')))
+self.assertTrue(dotconf.has_dotconfig())
+
+dotconf = DotConfig('/'.join((HERE, 'testfiles', 'htdocs', 'empty')))
+self.assertFalse(dotconf.has_dotconfig())
+
+def test_is_empty(self):
+dotconf = DotConfig('/'.join((HERE, 'testfiles', 'htdocs', 'horde')))
+self.assertEqual(dotconf.is_empty(), None)

[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: 9f682ae6eaa6b51d38e0d842dd7e65ca7ed89e54
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun May 17 03:19:16 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:51:54 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=9f682ae6

config.py: Readds the dir key to the option_to_config term

 WebappConfig/config.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index 8d6a0ae..ab19ee3 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -892,6 +892,7 @@ class Config:
 
 # Map command line options into the configuration
 option_to_config = {'host' : 'vhost_hostname',
+'dir'  : 'g_installdir',
 'server'   : 'vhost_server',
 'secure'   : 'g_secure',
 'user' : 'vhost_config_uid',



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: a72f0889c57d2bff26078123ca1b6c814c547c21
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Thu Oct 16 19:16:58 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:47:38 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=a72f0889

config.py: Improves package version checking

With the previous method of setting the package version you were
unable to pass the package version to webapp-config if it had more
than one decimal point (ex: 1.0.1 wouldn't work), this commit attempts
to fix that issue.

 WebappConfig/config.py | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index 10a6f26..5eb4584 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -990,11 +990,18 @@ class Config:
 else:
 OUT.die('Invalid package name')
 
-try:
-self.config.set('USER', 'pvr', str(float(args[1])))
-except ValueError:
+argsvr = args[1].split('.')
+if len(argsvr) == 1:
 OUT.die('Invalid package version: %(pvr)s' % {'pvr': args[1]})
 
+pvr = ''
+for i in range(0, len(argsvr)):
+if not i == len(argsvr) - 1:
+pvr += argsvr[i] + '.'
+else:
+pvr += argsvr[i]
+self.config.set('USER', 'pvr', pvr)
+
 # 
 # Helper functions
 



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: e61bebefada3a9f61940824e348cb5f25e901911
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Tue Oct 14 19:26:36 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:47:08 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=e61bebef

config.py: Adds more thorough checking for setting self.work

 WebappConfig/config.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index acf7b7a..99ccedd 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -582,7 +582,7 @@ class Config:
 
 info_opts.add_argument('-li',
'--list-installs',
-   action='store_true',
+   nargs = 2,
help = 'List all current virtual installs for 
a'
'pplication. Use * for the package name and/or 
'
'version number to list more than one package / 
'
@@ -966,7 +966,7 @@ class Config:
 sys.exit()
 
 for i in work:
-if options.get(i):
+if options.get(i) != None and options.get(i) != False:
 self.work = i
 break
 



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: f65ecf2f00848079cda820d2de65152b29129033
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun May 17 03:54:16 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:52:10 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=f65ecf2f

config.py: Suppresses warning message for lack of -d flag for --query

 WebappConfig/config.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index ab19ee3..cb9d552 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -1013,7 +1013,8 @@ class Config:
 pvr += argsvr[i]
 self.config.set('USER', 'pvr', pvr)
 
-if not options['dir'] and self.work != 'list_installs':
+if (not options['dir'] and
+self.work not in ('list_installs', 'query')):
 pn  = self.config.get('USER', 'pn')
 msg = 'Install dir flag not supplied, defaulting to '\
   '%(pn)s.' % {'pn': pn}



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: 8ac9e0dbf2a8d871887a3b577515662f57874c17
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun May 17 02:40:12 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:51:37 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=8ac9e0db

config.py: Allows for -lui to not have any arguments passed

Other command line flags such as -I, -C, or -U will always expect
2 command line args. If they are not properly supplied then that
is handled by argparse. This commit allows for the -lui flag that
can have 0 up to 2 optional flags passed to have that 0 flags passed.

 WebappConfig/config.py | 84 ++
 1 file changed, 43 insertions(+), 41 deletions(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index c9c0baf..37c2982 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -976,47 +976,49 @@ class Config:
  'show_postinst', 'show_postupgrade', 'upgrade']:
 # get cat / pn
 args = options[self.work]
-m= args[0].split('/')
-
-if self.work == 'list_installs' and len(args)  2:
-msg = os.path.basename(sys.argv[0]) + ': error: argument -li/'\
-  '--list-installs: expected up to 2 arguments'
-
-self.parser.print_usage()
-print(msg)
-sys.exit()
-
-if len(m) == 1:
-if '*' not in m:
-self.config.set('USER', 'pn',  m[0])
-elif len(m) == 2:
-self.config.set('USER', 'cat', m[0])
-if '*' not in m:
-self.config.set('USER', 'pn',  m[1])
-else:
-OUT.die('Invalid package name')
-
-if len(args)  1:
-argsvr = args[1].split('.')
-if len(argsvr) == 1:
-OUT.die('Invalid package version: %(pvr)s' % {'pvr': 
args[1]})
-
-pvr = ''
-for i in range(0, len(argsvr)):
-if not i == len(argsvr) - 1:
-pvr += argsvr[i] + '.'
-else:
-pvr += argsvr[i]
-self.config.set('USER', 'pvr', pvr)
-
-if not options['dir'] and self.work != 'list_installs':
-pn  = self.config.get('USER', 'pn')
-msg = 'Install dir flag not supplied, defaulting to '\
-  '%(pn)s.' % {'pn': pn}
-
-OUT.warn(msg)
-self.config.set('USER', 'g_installdir', pn)
-self.flag_dir = True
+
+if len(args):
+m= args[0].split('/')
+
+if self.work == 'list_installs' and len(args)  2:
+msg = os.path.basename(sys.argv[0]) + ': error: argument '\
+  '-li/--list-installs: expected up to 2 arguments'
+
+self.parser.print_usage()
+print(msg)
+sys.exit()
+
+if len(m) == 1:
+if '*' not in m:
+self.config.set('USER', 'pn',  m[0])
+elif len(m) == 2:
+self.config.set('USER', 'cat', m[0])
+if '*' not in m:
+self.config.set('USER', 'pn',  m[1])
+else:
+OUT.die('Invalid package name')
+
+if len(args)  1:
+argsvr = args[1].split('.')
+if len(argsvr) == 1:
+OUT.die('Invalid package version: %(pvr)s' % {'pvr': 
args[1]})
+
+pvr = ''
+for i in range(0, len(argsvr)):
+if not i == len(argsvr) - 1:
+pvr += argsvr[i] + '.'
+else:
+pvr += argsvr[i]
+self.config.set('USER', 'pvr', pvr)
+
+if not options['dir'] and self.work != 'list_installs':
+pn  = self.config.get('USER', 'pn')
+msg = 'Install dir flag not supplied, defaulting to '\
+  '%(pn)s.' % {'pn': pn}
+
+OUT.warn(msg)
+self.config.set('USER', 'g_installdir', pn)
+self.flag_dir = True
 
 
 # 



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: 04c567f09d9230f65fbe37ccd29789c6d010dec5
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun May 17 02:51:31 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:51:47 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=04c567f0

config.py: Message clean ups

 WebappConfig/config.py | 23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index 37c2982..8d6a0ae 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -1001,7 +1001,8 @@ class Config:
 if len(args)  1:
 argsvr = args[1].split('.')
 if len(argsvr) == 1:
-OUT.die('Invalid package version: %(pvr)s' % {'pvr': 
args[1]})
+OUT.die('Invalid package version: %(pvr)s'
+% {'pvr': args[1]})
 
 pvr = ''
 for i in range(0, len(argsvr)):
@@ -1384,17 +1385,15 @@ class Config:
 # upgrade
 
 # okay - what do we have?
-
-OUT.info('Removing '
- + old['WEB_CATEGORY'] + '/'
- + old['WEB_PN'] + '-'
- + old['WEB_PVR'] + ' from '
- + self.installdir() + '\n'
- + '  Installed by '
- + old['WEB_INSTALLEDBY'] + ' on '
- + old['WEB_INSTALLEDDATE'] + '\n'
- +'  Config files owned by '
- + old['WEB_INSTALLEDFOR'], 1)
+msg = 'Removing '
+if old['WEB_CATEGORY']:
+msg += old['WEB_CATEGORY'] + '/'
+msg += old['WEB_PN'] + '-' + old['WEB_PVR'] + ' from '\
+   + self.installdir() + '\n  Installed by '\
+   + old['WEB_INSTALLEDBY'] + ' on ' + 
old['WEB_INSTALLEDDATE']\
+   + '\n  Config files owned by ' + old['WEB_INSTALLEDFOR']
+
+OUT.info(msg, 1)
 
 content = self.create_content(old['WEB_CATEGORY'], old['WEB_PN'], 
old['WEB_PVR'])
 content.read()



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: fe9d834d80fe9c7de334619f4b37469d769558d6
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun May 17 00:38:26 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:51:01 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=fe9d834d

config.py: Removes unnecessary .keys() call for option_to_config dict

 WebappConfig/config.py | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index 2c14baa..06dfc4c 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -904,15 +904,15 @@ class Config:
 'verbose'  : 'g_verbose',
 'bug_report'   : 'g_bugreport'}
 
-for i in list(option_to_config.keys()):
-if i in options and options[i]:
+for key in option_to_config:
+if key in options and options[key]:
 # If it's a list, we're expecting only one value in the list.
-if isinstance(options[i], list):
-self.config.set('USER', option_to_config[i],
-str(options[i][0]))
+if isinstance(options[key], list):
+self.config.set('USER', option_to_config[key],
+str(options[key][0]))
 else:
-self.config.set('USER', option_to_config[i],
-str(options[i]))
+self.config.set('USER', option_to_config[key],
+str(options[key]))
 
 # handle verbosity
 if ('pretend' in options



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/

2015-06-19 Thread Devan Franchini
commit: 42279c7cd61ddfb9504bb7cb2ee05f65d4f851eb
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Tue Oct 14 19:30:40 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:47:20 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=42279c7c

config.py: Modifies --list_unused_installed to nargs = *

In order to allow the nature of --list_unused_installed to remain true
to the nature of the command line arg, the nargs has been changed to
*. This allows --list_unused_installed to be called with 0 or more
args via the argparse python class.

 WebappConfig/config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index 99ccedd..10a6f26 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -598,7 +598,7 @@ class Config:
 
 info_opts.add_argument('-lui',
'--list-unused-installs',
-   action='store_true',
+   nargs = '*',
help = 'List all master images which currently 
a'
're not used. Optionally, provide a package 
and/'
'or version number as arguments to restrict the 
'



[gentoo-commits] proj/webapp-config:master commit in: WebappConfig/tests/, WebappConfig/

2015-06-19 Thread Devan Franchini
commit: 9b10c59abfc75813670eea42a3ebdb6337265960
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun Nov  2 23:50:23 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Jun 19 19:49:05 2015 +
URL:https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=9b10c59a

Adds Protection tests to external test suite

tests/dtest.py: Removes WebappConfig.protect from doctest listing
tests/external.py: Adds tests for Protection class
protect.py: Removes doctests

 WebappConfig/protect.py| 80 --
 WebappConfig/tests/dtest.py|  2 --
 WebappConfig/tests/external.py | 55 +
 3 files changed, 55 insertions(+), 82 deletions(-)

diff --git a/WebappConfig/protect.py b/WebappConfig/protect.py
index 4a24d55..6055d17 100644
--- a/WebappConfig/protect.py
+++ b/WebappConfig/protect.py
@@ -64,25 +64,6 @@ class Protection:
 Inputs:
   destination -  the directory that the file is being installed into
   filename- the original name of the file
-
-Let's test the code on some examples:
-
- import os.path
- here = os.path.dirname(os.path.realpath(__file__))
-
- a = Protection('','horde','3.0.5','portage')
- a.get_protectedname(here + '/tests/testfiles/protect/empty',
-... 'test')#doctest: +ELLIPSIS
-'.../tests/testfiles/protect/empty//._cfg_test'
-
- a.get_protectedname(here + '/tests/testfiles/protect/simple',
-... 'test')#doctest: +ELLIPSIS
-'.../tests/testfiles/protect/simple//._cfg0001_test'
-
- a.get_protectedname(here + '/tests/testfiles/protect/complex',
-... 'test')#doctest: +ELLIPSIS
-'.../tests/testfiles/protect/complex//._cfg0801_test'
-
 '''
 
 my_file= os.path.basename(filename)
@@ -117,30 +98,6 @@ class Protection:
 Traverses the path of parent directories for the
 given install dir and checks if any matches the list
 of config protected files.
-
- a = Protection('','horde','3.0.5','portage')
-
-Add a virtual config protected directory:
-
- a.config_protect += ' /my/strange/htdocs/'
- a.dirisconfigprotected('/my/strange/htdocs/where/i/installed/x')
-True
- a.dirisconfigprotected('/my/strange/htdocs/where/i/installed/x/')
-True
- a.config_protect += ' /my/strange/htdocs'
- a.dirisconfigprotected('/my/strange/htdocs/where/i/installed/x')
-True
- a.dirisconfigprotected('/my/strange/htdocs/where/i/installed/x/')
-True
-
- a.config_protect += ' bad_user /my/strange/htdocs'
- a.dirisconfigprotected('/my/bad_user/htdocs/where/i/installed/x')
-False
- a.dirisconfigprotected('/my/strange/htdocs/where/i/installed/x/')
-True
-
- a.dirisconfigprotected('/')
-False
 '''
 
 my_master = []
@@ -176,39 +133,6 @@ class Protection:
 def how_to_update(self, dirs):
 '''
 Instruct the user how to update the application.
-
- OUT.color_off()
- a = Protection('','horde','3.0.5','portage')
-
- a.how_to_update(['/my/strange/htdocs/where/i/installed/x'])
-* One or more files have been config protected
-* To complete your install, you need to run the following command(s):
-* 
-* CONFIG_PROTECT=/my/strange/htdocs/where/i/installed/x etc-update
-* 
- a.how_to_update(['/a/','/c/'])
-* One or more files have been config protected
-* To complete your install, you need to run the following command(s):
-* 
-* CONFIG_PROTECT=/a/ etc-update
-* CONFIG_PROTECT=/c/ etc-update
-* 
- a.how_to_update(['/a//test3','/a//test3/abc', '/c/'])
-* One or more files have been config protected
-* To complete your install, you need to run the following command(s):
-* 
-* CONFIG_PROTECT=/a//test3 etc-update
-* CONFIG_PROTECT=/c/ etc-update
-* 
-
-Add a virtual config protected directory:
-
- a.config_protect += ' /my/strange/htdocs/'
- a.how_to_update(['/my/strange/htdocs/where/i/installed/x'])
-* One or more files have been config protected
-* To complete your install, you need to run the following command(s):
-* 
-* etc-update
 '''
 my_command = self.update_command
 
@@ -237,7 +161,3 @@ class Protection:
 OUT.warn('One or more files have been config protected\nTo comple'
  'te your install, you need to run the following 
command(s):\n\n'
  + my_command_list)
-
-if __name__ == '__main__':
-import doctest, sys
-doctest.testmod(sys.modules[__name__])

diff --git a/WebappConfig/tests/dtest.py b/WebappConfig/tests/dtest.py