def fetch_impl(self):
        cached_dir = os.path.join(self.config.cached_sources,
                                  self.package_name)
        if os.path.isdir(os.path.join(cached_dir, ".svn")):
            if os.path.exists(self.repo_dir):
                shutil.rmtree(self.repo_dir)
            m.action(
                _('Copying cached repo from %s to %s instead of %s') %
                (cached_dir, self.repo_dir, self.url))
            shell.copy_dir(cached_dir, self.repo_dir)
            return

        checkout = True
        if os.path.exists(self.repo_dir):
            if os.path.isdir(os.path.join(self.repo_dir, '.svn')):
                if self.offline:
                    return
                checkout = False
            else:
                shutil.rmtree(self.repo_dir)

        if checkout:
            os.makedirs(self.repo_dir, exist_ok=True)
            svn.checkout(self.url, self.repo_dir)
        svn.update(self.repo_dir, self.revision)
Esempio n. 2
0
 def _copy_files(self, files, root):
     for f in files:
         out_path = f.replace(self.config.prefix, root)
         out_dir = os.path.split(out_path)[0]
         if not os.path.exists(out_dir):
             os.makedirs(out_dir)
         if os.path.isdir(f):
             shell.copy_dir(f, out_path)
         else:
             shutil.copy(f, out_path)
Esempio n. 3
0
    def fetch(self):
        if os.path.exists(self.repo_dir):
            shutil.rmtree(self.repo_dir)

        cached_dir = os.path.join(self.config.cached_sources, self.package_name)
        if os.path.isdir(os.path.join(cached_dir, ".svn")):
            m.action(_('Copying cached repo from %s to %s instead of %s') %
                     (cached_dir, self.repo_dir, self.url))
            shell.copy_dir(cached_dir, self.repo_dir)
            return

        os.makedirs(self.repo_dir)
        svn.checkout(self.url, self.repo_dir)
        svn.update(self.repo_dir, self.revision)
Esempio n. 4
0
    def _create_dmg(self, pkg_path, dmg_file):
        # Create a new folder with the pkg and the user resources
        dmg_dir = os.path.join(self.tmp, "dmg")
        os.makedirs(dmg_dir)
        for r in self.package.user_resources:
            r = os.path.join(self.config.prefix, r)
            r_dir = os.path.split(r)[1]
            shell.copy_dir(r, os.path.join(dmg_dir, r_dir))
        shutil.move(pkg_path, dmg_dir)

        # Create Disk Image
        cmd = "hdiutil create %s -volname %s -ov -srcfolder %s" % (dmg_file, self.package.name, dmg_dir)
        shell.call(cmd)
        return dmg_file
Esempio n. 5
0
    def fetch(self):
        if os.path.exists(self.repo_dir):
            shutil.rmtree(self.repo_dir)

        cached_dir = os.path.join(self.config.cached_sources, self.package_name)
        if os.path.isdir(os.path.join(cached_dir, ".svn")):
            m.action(_('Copying cached repo from %s to %s instead of %s') %
                     (cached_dir, self.repo_dir, self.url))
            shell.copy_dir(cached_dir, self.repo_dir)
            return

        os.makedirs(self.repo_dir)
        svn.checkout(self.url, self.repo_dir)
        svn.update(self.repo_dir, self.revision)
Esempio n. 6
0
    def _create_dmg(self, pkg_path, dmg_file):
        # Create a new folder with the pkg and the user resources
        dmg_dir = os.path.join(self.tmp, 'dmg')
        os.makedirs(dmg_dir)
        for r in self.package.user_resources:
            r = os.path.join(self.config.prefix, r)
            r_dir = os.path.split(r)[1]
            shell.copy_dir(r, os.path.join(dmg_dir, r_dir))
        shutil.move(pkg_path, dmg_dir)

        # Create Disk Image
        cmd = 'hdiutil create %s -volname %s -ov -srcfolder %s' % \
            (dmg_file, self.package.name, dmg_dir)
        shell.call(cmd)
        return dmg_file
Esempio n. 7
0
 def _copy_versioned_headers(self, headers, include_dirs):
     # Path is listed as an includes dir by pkgconfig
     # Copy files and directories to Headers
     for inc_dir in include_dirs:
         if not os.path.exists(inc_dir):
             continue
         for p in os.listdir(inc_dir):
             src = os.path.join(inc_dir, p)
             dest = os.path.join(headers, p)
             if not os.path.exists(os.path.dirname(dest)):
                 os.makedirs(os.path.dirname(dest))
             # include/cairo/cairo.h -> Headers/cairo.h
             if os.path.isfile(src):
                 shutil.copy(src, dest)
             # include/gstreamer-0.10/gst -> Headers/gst
             elif os.path.isdir(src):
                 shell.copy_dir(src, dest)
Esempio n. 8
0
 def _copy_versioned_headers(self, headers, include_dirs):
     # Path is listed as an includes dir by pkgconfig
     # Copy files and directories to Headers
     for inc_dir in include_dirs:
         if not os.path.exists(inc_dir):
             continue
         for p in os.listdir(inc_dir):
             src = os.path.join(inc_dir, p)
             dest = os.path.join(headers, p)
             if not os.path.exists(os.path.dirname(dest)):
                 os.makedirs(os.path.dirname(dest))
             # include/cairo/cairo.h -> Headers/cairo.h
             if os.path.isfile(src):
                 shutil.copy(src, dest)
             # include/gstreamer-0.10/gst -> Headers/gst
             elif os.path.isdir(src):
                 shell.copy_dir(src, dest)
Esempio n. 9
0
    def fetch(self):
        if os.path.exists(self.repo_dir):
            shutil.rmtree(self.repo_dir)

        cached_dir = os.path.join(self.config.cached_sources, self.package_name)
        if os.path.isdir(os.path.join(cached_dir, ".svn")):
            m.action(_('Copying cached repo from %s to %s instead of %s') %
                     (cached_dir, self.repo_dir, self.url))
            shell.copy_dir(cached_dir, self.repo_dir)
            return

        os.makedirs(self.repo_dir)
        if self.offline:
            raise FatalError('Offline mode: no cached svn repos found for {} at {!r}'
                             ''.format(self.package_name, self.config.cached_sources))
        svn.checkout(self.url, self.repo_dir)
        svn.update(self.repo_dir, self.revision)