Julien Jehannet avatar Julien Jehannet committed 5dc6dd4

(mq: checkpoint)

Comments (0)

Files changed (8)

clcommands-build-source.diff

 # HG changeset patch
-# Date 1304025165 -7200
+# Date 1304119096 -7200
 # User Julien Jehannet <julien@smaf.org>
-# Parent 01356719a559ade5741313ff76e073db5a7f2587
+# Parent 5eabc7c273120b9ca480875efd290b06827d8a10
 [command] build-source: new lgp command for Debian source archive creation and multiprocessing capabilities
 
 New:
 new file mode 100644
 --- /dev/null
 +++ b/lgp/build_source.py
-@@ -0,0 +1,223 @@
+@@ -0,0 +1,229 @@
 +# -*- coding: utf-8 -*-
 +#
 +# Copyright (c) 2011 LOGILAB S.A. (Paris, FRANCE).
 +    # hotlist of the recent generated package files
 +    packages = []
 +
++    def guess_environment(self):
++        # if no default value for distribution, try to retrieve it from changelog
++        if self.config.distrib is None or 'changelog' in self.config.distrib:
++            self.config.distrib = 'changelog'
++        super(DscBuilder, self).guess_environment()
++
 +    def run(self, args):
 +        Cleaner(None).run(args)
 +
 +
 +        return self.origpath
 +
+diff --git a/lgp/login.py b/lgp/login.py
+--- a/lgp/login.py
++++ b/lgp/login.py
+@@ -54,9 +54,8 @@ class Login(SetupInfo):
+     def _prune_pkg_dir(self):
+         pass
+ 
+-    @property
+-    def other_mirror(self):
+-        dirname, basename = os.path.split(self.get_distrib_dir())
++    def other_mirror(self, resultdir):
++        dirname, basename = os.path.split(self.get_distrib_dir(resultdir))
+         return "'deb file://%s %s/'" % (dirname, basename)
+ 
+     def run(self, args):
+@@ -64,9 +63,10 @@ class Login(SetupInfo):
+             for distrib in self.distributions:
+                 image = self.get_basetgz(distrib, arch)
+ 
++                resultdir = self.get_distrib_dir(distrib)
+                 cmd = self.cmd % (image, distrib, arch, self.sudo_cmd,
+                                   self.pbuilder_cmd, CONFIG_FILE, HOOKS_DIR,
+-                                  self.get_distrib_dir(), self.other_mirror)
++                                  resultdir, self.other_mirror(resultdir))
+ 
+                 logging.info("login into '%s/%s' image" % (distrib, arch))
+                 logging.debug("run command: %s", cmd)
 diff --git a/lgp/setupinfo.py b/lgp/setupinfo.py
 --- a/lgp/setupinfo.py
 +++ b/lgp/setupinfo.py

clcommands-login.diff

 diff --git a/lgp/login.py b/lgp/login.py
 --- a/lgp/login.py
 +++ b/lgp/login.py
-@@ -1,83 +1,80 @@
+@@ -1,83 +1,81 @@
  # -*- coding: utf-8 -*-
 -# Copyright (c) 2003-2008 LOGILAB S.A. (Paris, FRANCE).
 +#
 +               })
 +              ]
 +    cmd = ("IMAGE=%s DIST=%s ARCH=%s %s %s --configfile %s "
-+           "--hookdir %s --bindmounts %s --othermirror %s")
++           "--hookdir %s --bindmounts %s --othermirror %s "
++           "--override-config")
 +    pbuilder_cmd = "/usr/sbin/pbuilder %s" % name
 +    sudo_cmd = "/usr/bin/sudo -E"
 +

clcommands-tag.diff

 # HG changeset patch
-# Date 1302950720 -7200
+# Date 1304126636 -7200
 # User Julien Jehannet <julien@smaf.org>
-# Parent 76f267c30bd79fa6edabeae3fff44aef1026164b
+# Parent 20c182d7a6225096bac5aecaafe59158f19928ff
 [command] tag: migrate command to clcommands api + refactoring
 
 Changes:
  # http://www.logilab.fr/ -- mailto:contact@logilab.fr
  #
  # This program is free software; you can redistribute it and/or modify it under
-@@ -16,93 +15,66 @@
+@@ -16,93 +15,65 @@
  # You should have received a copy of the GNU General Public License along with
  # this program; if not, write to the Free Software Foundation, Inc.,
  # 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 -__docformat__ = "restructuredtext en"
 -
 -import os, os.path as osp
+-import logging
 +import os.path as osp
- import logging
  import ConfigParser
  from string import Template
  from subprocess import check_call
  
 -from logilab.devtools.lgp import LGP_CONFIG_FILE
-+from logilab.devtools.lgp import LGP, LGP_CONFIG_FILE, utils
++from logilab.devtools.lgp import LGP, LGP_CONFIG_FILE
 +from logilab.devtools.lgp.vcslib import get_vcs_agent
  from logilab.devtools.lgp.setupinfo import SetupInfo
  from logilab.devtools.lgp.exceptions import LGPException
 -    options = (('template',
 +    name = "tag"
 +    arguments = "[-f | --force] [-t | --template <tag template>] [project directory]"
-+    options = [('template',
++    options = SetupInfo.options + [('template',
                  {'type': 'csv',
 -                 'dest' : "default",
 +                 'default' : ['$version'],
 +
 +        command = self.vcs_agent.tag(self.config.pkg_dir, tag,
 +                                     force=bool(self.config.force))
-+        logging.debug('run command: %s' % command)
++        self.logger.debug('run command: %s' % command)
 +        check_call(command, shell=True)
-+        logging.info("add tag to repository: %s" % tag)
++        self.logger.info("add tag to repository: %s" % tag)
 +
 +    def run(self, args):
 +        # Not even try to continue if version mismatch (dangerous command)
          self.vcs_agent = get_vcs_agent(self.config.pkg_dir)
          self.version = self.get_upstream_version()
          self.project = self.get_upstream_name()
-@@ -118,109 +90,31 @@ class Tagger(SetupInfo):
+@@ -112,115 +83,36 @@ class Tagger(SetupInfo):
+             self.debian_revision = self.debian_version.rsplit('-', 1)[-1]
+         except IndexError:
+             # can be a false positive due to native package
+-            logging.warn('Debian version info cannot be retrieved')
++            self.logger.warn('Debian version info cannot be retrieved')
+ 
+         # poor cleaning for having unique string
          self.distrib = '+'.join(self.distributions)
          self.archi   = '+'.join(self.architectures)
  
 +                if config.has_option("LGP-TAG", tag):
 +                    new_tags = config.get("LGP-TAG", tag).split(',')
 +                    if new_tags:
-+                        logging.debug("detected alias '%s' expanded to '%s'" % (tag, new_tags))
++                        self.logger.debug("detected alias '%s' expanded to '%s'" % (tag, new_tags))
 +                        tags.extend(new_tags)
 +                # apply now
 +                self.apply(tag)
 -                             arch=self.archi,
 -                             project=self.project
 -                            )
--
++    def guess_environment(self):
++        # if no default value for distribution, try to retrieve it from changelog
++        if self.config.distrib is None or 'changelog' in self.config.distrib:
++            self.config.distrib = 'changelog'
++        super(Tagger, self).guess_environment()
+ 
 -        command = self.vcs_agent.tag(self.config.pkg_dir, tag,
 -                                     force=bool(self.config.force))
 -        logging.debug('run command: %s' % command)
 -               "I don't know how to deal with filepath and <hg tag>"
 -        return "hg tag %s %s" % (force, tagname)
 -
-+    def guess_environment(self):
-+        # no default value for distribution. Try to retrieve it in changelog
-+        if self.config.distrib is None or 'changelog' in self.config.distrib:
-+            self.config.distrib = utils.guess_debian_distribution()
-+        # set default distrib/archi template values
-+        self.distributions = self.config.distrib
-+        self.architectures = utils.get_architectures(self.config.archi or "current")
 diff --git a/lgp/vcslib.py b/lgp/vcslib.py
 new file mode 100644
 --- /dev/null

logger-improvements.diff

 # HG changeset patch
-# Date 1304113420 -7200
+# Date 1304119510 -7200
 # User Julien Jehannet <julien@smaf.org>
-# Parent 2abacbff550141162e9687f0c2cd930a43cf3020
+# Parent 911fe980d04d78b981a0e3b55b993871f2ece377
 lgp: use internal logger instance when possible
 
 diff --git a/lgp/__init__.py b/lgp/__init__.py
  from subprocess import check_call, CalledProcessError
  
  from logilab.devtools.lgp import LGP, CONFIG_FILE, HOOKS_DIR
-@@ -67,14 +66,14 @@ class Login(SetupInfo):
+@@ -69,14 +68,13 @@ class Login(SetupInfo):
                                    self.pbuilder_cmd, CONFIG_FILE, HOOKS_DIR,
-                                   self.get_distrib_dir(), self.other_mirror)
+                                   resultdir, other_mirror)
  
 -                logging.info("login into '%s/%s' image" % (distrib, arch))
 -                logging.debug("run command: %s", cmd)
                      check_call(cmd, shell=True,
                                 env={'DIST': distrib, 'ARCH': arch, 'IMAGE': image,
                                      'DISPLAY': os.environ.get('DISPLAY', ""),
-                                     'OTHERMIRROR': self.other_mirror})
+                                     'OTHERMIRROR': other_mirror})
                  except CalledProcessError, err:
 -                    logging.warn("returned non-zero exit status %s",
 -                                 err.returncode)
+-
 +                    self.logger.warn("returned non-zero exit status %s",
 +                                     err.returncode)
- 
 diff --git a/lgp/piuparts.py b/lgp/piuparts.py
 --- a/lgp/piuparts.py
 +++ b/lgp/piuparts.py
 diff --git a/lgp/setupinfo.py b/lgp/setupinfo.py
 --- a/lgp/setupinfo.py
 +++ b/lgp/setupinfo.py
-@@ -153,6 +153,8 @@ class SetupInfo(clcommands.Command):
+@@ -153,6 +153,7 @@ class SetupInfo(clcommands.Command):
                      }),
                    ]
          self.options.extend(options) # merge parent options
-+        if logger is None:
-+            logger = logging.getLogger(self.name)
++        logger = logging.getLogger(self.name)
          super(SetupInfo, self).__init__(logger)
          self._set_package_format()
  
+@@ -187,6 +188,7 @@ class SetupInfo(clcommands.Command):
+ 
+         self.check_args(arguments)
+         self.go_into_package_dir(arguments)
++        self._set_package_format()
+         self.guess_environment()
+         # Some package formats expect a clean state with no troubling file
+         # (ex: distutils)...
 @@ -217,7 +219,7 @@ class SetupInfo(clcommands.Command):
                  # (since this option accept url path name as well)
                  self.config.orig_tarball = osp.abspath(osp.expanduser(self.config.orig_tarball))

multiprocess.diff

 # HG changeset patch
-# Date 1304111663 -7200
+# Date 1304119464 -7200
 # User Julien Jehannet <julien@smaf.org>
-# Parent 99ab9d78c2e28925396262d4824084b952026cb5
+# Parent f45748a87093864db5e11ec69849b4eeefe799fb
 lgp: limit number of parallel build (I/O bound)
 
 diff --git a/lgp/build.py b/lgp/build.py
 +            cmd = debuilder.split()
 +        assert isinstance(cmd, list)
 +        return cmd
+diff --git a/lgp/login.py b/lgp/login.py
+--- a/lgp/login.py
++++ b/lgp/login.py
+@@ -63,9 +63,10 @@ class Login(SetupInfo):
+                 image = self.get_basetgz(distrib, arch)
+ 
+                 resultdir = self.get_distrib_dir(distrib)
++                other_mirror = self.other_mirror(resultdir)
+                 cmd = self.cmd % (image, distrib, arch, self.sudo_cmd,
+                                   self.pbuilder_cmd, CONFIG_FILE, HOOKS_DIR,
+-                                  resultdir, self.other_mirror(resultdir))
++                                  resultdir, other_mirror)
+ 
+                 logging.info("login into '%s/%s' image" % (distrib, arch))
+                 logging.debug("run command: %s", cmd)
+@@ -73,7 +74,7 @@ class Login(SetupInfo):
+                     check_call(cmd, shell=True,
+                                env={'DIST': distrib, 'ARCH': arch, 'IMAGE': image,
+                                     'DISPLAY': os.environ.get('DISPLAY', ""),
+-                                    'OTHERMIRROR': self.other_mirror})
++                                    'OTHERMIRROR': other_mirror})
+                 except CalledProcessError, err:
+                     logging.warn("returned non-zero exit status %s",
+                                  err.returncode)
 diff --git a/lgp/setupinfo.py b/lgp/setupinfo.py
 --- a/lgp/setupinfo.py
 +++ b/lgp/setupinfo.py

redefine-guess-environment.diff

+# HG changeset patch
+# Date 1304126672 -7200
+# User Julien Jehannet <julien@smaf.org>
+# Parent 2270bf61011dab37734b13daaf50aac6b652b0c8
+
+diff --git a/lgp/setupinfo.py b/lgp/setupinfo.py
+--- a/lgp/setupinfo.py
++++ b/lgp/setupinfo.py
+@@ -204,30 +204,25 @@ class SetupInfo(clcommands.Command):
+ 
+     def go_into_package_dir(self, arguments):
+         """go into package directory"""
+-        # XXX move to LgpCommandCli
+-        if self.config.pkg_dir is None:
+-            if arguments and os.path.exists(arguments[0]):
++        if arguments:
++            if os.path.exists(arguments[0]):
+                 self.config.pkg_dir = osp.abspath(arguments[0])
+             else:
+-                self.config.pkg_dir = os.getcwd()
+-        try:
++                raise LGPException("directory doesn't exist: %s" % arguments[0])
+             if os.path.isfile(self.config.pkg_dir):
+                 self.config.pkg_dir = os.path.dirname(self.config.pkg_dir)
+-            # FIXME Keep working relative pathnames provided in line arguments after chdir
+-            if getattr(self.config, "orig_tarball", None) and osp.exists(self.config.orig_tarball):
+-                # we use osp.exists to rewrite only with valid path name
+-                # (since this option accept url path name as well)
+-                self.config.orig_tarball = osp.abspath(osp.expanduser(self.config.orig_tarball))
+             os.chdir(self.config.pkg_dir)
+             self.logger.debug('change the current working directory to: %s' % self.config.pkg_dir)
+-        except OSError, err:
+-            raise LGPException(err)
++        else:
++            self.config.pkg_dir = os.getcwd()
++
++        # FIXME Keep working relative pathnames provided in line arguments after chdir
++        if getattr(self.config, "orig_tarball", None) and osp.exists(self.config.orig_tarball):
++            # we use osp.exists to rewrite only with valid path name
++            # (since this option accept url path name as well)
++            self.config.orig_tarball = osp.abspath(osp.expanduser(self.config.orig_tarball))
+ 
+     def guess_environment(self):
+-        # no default value for distribution. Try to retrieve it in changelog
+-        if self.config.distrib is None or 'changelog' in self.config.distrib:
+-            self.config.distrib = utils.guess_debian_distribution()
+-
+         # just a warning issuing for possibly confused configuration
+         if self.config.archi and 'all' in self.config.archi:
+             self.logger.warn('the "all" keyword can be confusing about the '
+diff --git a/lgp/utils.py b/lgp/utils.py
+--- a/lgp/utils.py
++++ b/lgp/utils.py
+@@ -152,7 +152,9 @@ def get_distributions(distrib=None, base
+                    'None' to detect available images by cdebootstrap
+     param basetgz: location of the pbuilder images
+     """
+-    if distrib is None:
++    if distrib is "changelog":
++        distrib = guess_debian_distribution()
++    elif distrib is None:
+         distrib = [osp.basename(f).split('.', 1)[0]
+                    for f in glob.glob(osp.join(LGP_SUITES,'*'))]
+     elif 'all' in distrib or len(distrib)==0:

refactor-pbuilderrc.diff

 # HG changeset patch
-# Date 1304117708 -7200
+# Date 1304121693 -7200
 # User Julien Jehannet <julien@smaf.org>
-# Parent 7098352fa72b117763060a1f85e0641686dd1bc6
+# Parent 399ac5c1edef91b77a79b0e1438fba85c43975b4
 lgp: large refactoring of pbuilder config scripts
 
 Changes:
 @@ -1,1 +0,0 @@
 -F90sources
 \ No newline at end of file
+diff --git a/etc/lgp/hooks/E01logilab b/etc/lgp/hooks/E01logilab
+--- a/etc/lgp/hooks/E01logilab
++++ b/etc/lgp/hooks/E01logilab
+@@ -5,4 +5,4 @@
+ set +e
+ 
+ apt-get install -y --force-yes wget >/dev/null 2>&1
+-wget -q http://download.logilab.org/logilab-dists-key.asc  -O - | apt-key add -
++wget -q http://download.logilab.org/logilab-dists-key.asc  -O - | apt-key add - > /dev/null
 diff --git a/etc/lgp/hooks/F00env b/etc/lgp/hooks/F00env
 --- a/etc/lgp/hooks/F00env
 +++ b/etc/lgp/hooks/F00env
 rename to etc/lgp/hooks/F90localrepo
 --- a/etc/lgp/hooks/F90sources
 +++ b/etc/lgp/hooks/F90localrepo
-@@ -5,11 +5,18 @@
+@@ -5,11 +5,23 @@
  echo >> /etc/apt/sources.list
  echo "# Uncomment the next line if you want to use your remote repository" >> /etc/apt/sources.list
  echo "#deb http://$SUDO_USER:$SUDO_USER@intranet.logilab.fr/~$SUDO_USER/dists $DIST/" >> /etc/apt/sources.list
 +if [ -n "$OTHERMIRROR" ]; then 
 +	REPO=$(echo $OTHERMIRROR | sed -n 's/deb file:\/\/\(\.*\)/\1/p' | cut -d " " -f 1)
 +	PACKAGE_GZ="$REPO/$DIST/Packages.gz"
++	
++	# check file system write permission or exit
++	touch $PACKAGE_GZ || exit
++	
 +	print_hook "Refreshing $PACKAGE_GZ ..."
 +	apt-get install -y --force-yes devscripts >/dev/null 2>&1
 +	cd $REPO
  
 -if [ -f "$RESULTDIR/Packages.gz" ]; then
 -	print_hook "Adding a new /etc/apt/sources.list entry for '$RESULTDIR' (used in priority)..."
-+	print_hook "Adding a new entry in /etc/apt/sources.list: '$OTHERMIRROR'"
- 	echo >> /etc/apt/sources.list.new
+-	echo >> /etc/apt/sources.list.new
 -	echo "deb file://$(dirname $RESULTDIR) $(basename $RESULTDIR)/" >> /etc/apt/sources.list.new
-+	echo "$OTHERMIRROR" >> /etc/apt/sources.list.new
- 	cat /etc/apt/sources.list >> /etc/apt/sources.list.new
- 	mv -f /etc/apt/sources.list.new /etc/apt/sources.list
+-	cat /etc/apt/sources.list >> /etc/apt/sources.list.new
+-	mv -f /etc/apt/sources.list.new /etc/apt/sources.list
++	print_hook "New entry in /etc/apt/sources.list added: '$OTHERMIRROR'"
++
++	#echo >> /etc/apt/sources.list.new
++	#echo "$OTHERMIRROR" >> /etc/apt/sources.list.new
++	#cat /etc/apt/sources.list >> /etc/apt/sources.list.new
++	#mv -f /etc/apt/sources.list.new /etc/apt/sources.list
  fi
 diff --git a/etc/lgp/hooks/F95experimental b/etc/lgp/hooks/F95experimental
 deleted file mode 100755
 lgp-checker-update.diff
 logger-improvements.diff
 lgp-sign-process.diff
+wip-lgp-check-repository.diff:
+redefine-guess-environment.diff
 wip-lgp-build-source-improve.diff
 TODOLIST
 wip-login-x11.diff
-wip-lgp-check-repository.diff:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.