> Test if base_dir is a writable directory. [1]
Check diff4vsorig.txt or http://pastebin.com/raw.php?i=KrySEn7b

I'm not sure that's a good place for a check, but I haven't found a better one.
BTW, I checked it this way:
debderiver_patch4_test.py or http://pastebin.com/raw.php?i=VzpEGqR3
(I haven't tested it in the main code.)

[1] http://bzr.savannah.gnu.org/lh/gnewsense/debderiver/annotate/head:/TODO

Cheers
--- debderiver
+++ debderiver_patch4.py
@@ -257,7 +257,7 @@
 
         # Reprepro wants some fields after others (e.g. Codename first). 
         # Sorting them all is the easiest way to do that. We take scalars 
-        #first, lists second, each alphabetically in so far as reprepro allows.
+        # first, lists second, each alphabetically in so far as reprepro 
allows.
         FIELD_ORDER_DISTS = ('Codename', 'Description', 'FakeComponentPrefix', 
                 'Label', 'Origin', 'SignWith', 'Suite', 'Update', 'Version', 
                 'Architectures', 'Components', 'DebIndices', 'DscIndices', 
@@ -435,6 +435,9 @@
     # Pour into objects.
     opsys = OperatingSystem(main_conf['os'], main_conf['description'], \
             main_conf['base_dir'])
+    if not os.access(opsys.base_dir, os.W_OK):
+        sys.stderr.write('"%s" is not a writable directory\n' % opsys.base_dir)
+        sys.exit(1)
     opsys.signing_key = str(main_conf['signing_key'])
 
     for dist in dists:
#!/usr/bin/env python

import yaml
import os
import sys

# Place your user here
main_conf = yaml.load(open('/home/user/debderiver/examples/debderiver.yaml', 'r'))

class OperatingSystem(object):
    """Operating System."""

    def __init__(self, name, description, base_dir):
        self.name = name
        self.description = description
        self.base_dir = base_dir

opsys = OperatingSystem(main_conf['os'], main_conf['description'], \
            main_conf['base_dir'])
if not os.access(opsys.base_dir, os.W_OK):
    sys.stderr.write('"%s" is not a writable directory\n' % opsys.base_dir)
    sys.exit(1)
    
_______________________________________________
gNewSense-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/gnewsense-dev

Reply via email to