From patchwork Thu Aug 18 22:20:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 3521 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C0C0623E54 for ; Thu, 18 Aug 2011 22:20:18 +0000 (UTC) Received: from mail-ew0-f52.google.com (mail-ew0-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id A7FF7A18248 for ; Thu, 18 Aug 2011 22:20:18 +0000 (UTC) Received: by ewy28 with SMTP id 28so1316287ewy.11 for ; Thu, 18 Aug 2011 15:20:18 -0700 (PDT) Received: by 10.213.32.131 with SMTP id c3mr2024179ebd.94.1313706018358; Thu, 18 Aug 2011 15:20:18 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.213.102.5 with SMTP id e5cs101851ebo; Thu, 18 Aug 2011 15:20:18 -0700 (PDT) Received: by 10.216.186.66 with SMTP id v44mr5855813wem.0.1313706015214; Thu, 18 Aug 2011 15:20:15 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com [91.189.90.7]) by mx.google.com with ESMTPS id y59si6841724wec.76.2011.08.18.15.20.14 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Aug 2011 15:20:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QuAwg-0003wz-H9 for ; Thu, 18 Aug 2011 22:20:14 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 7517CE0149 for ; Thu, 18 Aug 2011 22:20:14 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glmark2 X-Launchpad-Branch: ~glmark2-dev/glmark2/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 127 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 127: Add custom dist command to the build system that preserves symbolic links. Message-Id: <20110818222014.7391.65596.launchpad@ackee.canonical.com> Date: Thu, 18 Aug 2011 22:20:14 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13697"; Instance="initZopeless config overlay" X-Launchpad-Hash: 4af6803cfd02702ec322c83d6dcc88ab0e3d0ee7 ------------------------------------------------------------ revno: 127 tags: 2011.08 committer: Alexandros Frantzis branch nick: trunk timestamp: Fri 2011-08-19 00:31:25 +0300 message: Add custom dist command to the build system that preserves symbolic links. modified: wscript --- lp:glmark2 https://code.launchpad.net/~glmark2-dev/glmark2/trunk You are subscribed to branch lp:glmark2. To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription === modified file 'wscript' --- wscript 2011-08-18 15:36:14 +0000 +++ wscript 2011-08-18 21:31:25 +0000 @@ -3,6 +3,7 @@ import os import Options import Scripting +from waflib import Context out = 'build' top = '.' @@ -94,5 +95,42 @@ ctx.recurse('data') ctx.recurse('doc') -def dist(ctx): - ctx.algo = 'tar.gz' +class Glmark2Dist(Context.Context): + """ Custom dist command that preserves symbolic links""" + + cmd = "dist" + + def execute(self): + self.recurse([os.path.dirname(Context.g_module.root_path)]) + self.archive() + + def get_files(self): + import fnmatch + files = [] + excludes = ['*.bzr', '*~', './.*waf*', './build*', '*.swp', '*glmark2-*.tar.gz'] + for (dirpath, dirnames, filenames) in os.walk(top): + names_to_remove = [] + names = dirnames + filenames + for n in names: + for exclude in excludes: + if fnmatch.fnmatch(os.path.join(dirpath, n), exclude): + names_to_remove.append(n) + break + + for d in names_to_remove: + if d in dirnames: + dirnames.remove(d) + if d in filenames: + filenames.remove(d) + + files.extend([os.path.join(dirpath, d) for d in dirnames]) + files.extend([os.path.join(dirpath, f) for f in filenames]) + + return files + + def archive(self): + import tarfile + tar = tarfile.open(APPNAME + '-' + VERSION + '.tar.gz', 'w:gz') + for f in self.get_files(): + tar.add(f, arcname = APPNAME + '-' + VERSION + '/' + f, recursive = False) + tar.close()