gnewsense-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnewsense-dev] Debderive


From: Stayvoid
Subject: Re: [Gnewsense-dev] Debderive
Date: Sun, 12 Feb 2012 01:51:56 +0300

Hi!

1.
os.system(' '.join(('reprepro --noskipold -Vb', self._base_path, command)))

# Could you explain how these functions work?
# And what will we get as a result?
# I was trying to follow the code, but I've got lost.

# It should be something like this:
# os.system(' '.join((reprepro --noskipold -Vb',
main_conf['base_dir'], command)))
# But I don't know the value of the 'base_dir' key and the syntax of
os.system is unfamiliar to me.

# Here is my attempt to understand it.

class Reprepro(object):
    # skipped
    def __init__(self, op_sys):
        self._base_path = op_sys.base_dir

rr = Reprepro(conf)

# self._base_path = main_conf['base_dir']

conf = parse(CONF_DIR_PATH)

# self.name = main_conf['os']
# self.description = main_conf['description']
# self.base_dir = main_conf['base_dir']

CONF_DIR_PATH = '/etc/debderiver'

def parse(conf_dir_path):
        conf_file_path = os.path.join(conf_dir_path, MAIN_CONF_FILE_NAME)
        # skipped
        opsys = OperatingSystem(main_conf['os'], main_conf['description'], \
                                    main_conf['base_dir'])

MAIN_CONF_FILE_NAME = 'debderiver.yaml'

# conf_file_path = '/etc/debderiver/debderiver.yaml'

main_conf = yaml.load(open(conf_file_path, 'r'))

# I'm not familiar with Yaml. When did we start to fill debderiver.yaml?
# I understand that it's a dict that could be shown in a readable form.
# 'os', 'description' and 'base_dir' are the keys that we're trying to access.
# But when did we fill them with values?

2.
self._do(' '.join(('include' + ext, suite, p)))

# Could you explain the syntax of this join()?
# ext should be a list. How can we concatenate str and list?

3. I've also tried to write some tests. Here is the result. (Maybe we
shouldn't use IOError for this purpose. I'm not sure.)

if __name__ == "__main__":
+    # Check for debderiver.py in `/usr/local/bin'
+    if os.path.abspath(__file__) != '/usr/local/bin/debderiver.py':
+        raise IOError, 'Copy debderiver.py to `/usr/local/bin\''
+
+    # Check if `/etc/debderiver' already exists
+    # Create it if the dir doesn't exist
+    if not os.path.exists('/etc/debderiver'):
+        print 'Creating `/etc/debderiver\'...'
+        os.makedirs('/etc/debderiver')
+        print 'Done.'
+
+    # Check for reprepro
+    if not os.path.exists('/usr/bin/reprepro'):
+        raise IOError, 'Missing dependency: install reprepro and try again.'
+
     CONF_DIR_PATH = '/etc/debderiver'

     conf = parse(CONF_DIR_PATH)

4.
Can I write to http://bzr.savannah.gnu.org/lh/gnewsense/debderiver by myself?

> I don't think Savannah supports personal (i.e. linked to user instead of 
> project) branches, but maybe you have your own hosting or you could use 
> Launchpad.
I'm going to run my own server soon. Could you tell me more about the
options I have?

Cheers.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]