From patchwork Fri Oct 14 05:33:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Deepti B. Kalakeri" X-Patchwork-Id: 4672 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 4E84F23E51 for ; Fri, 14 Oct 2011 05:33:16 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 28958A18740 for ; Fri, 14 Oct 2011 05:33:16 +0000 (UTC) Received: by bkbzs2 with SMTP id zs2so1825651bkb.11 for ; Thu, 13 Oct 2011 22:33:15 -0700 (PDT) Received: by 10.223.17.3 with SMTP id q3mr1787973faa.28.1318570395734; Thu, 13 Oct 2011 22:33:15 -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.152.24.41 with SMTP id r9cs1915laf; Thu, 13 Oct 2011 22:33:15 -0700 (PDT) Received: by 10.227.137.210 with SMTP id x18mr2277965wbt.57.1318570394761; Thu, 13 Oct 2011 22:33:14 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id em9si5099831wbb.114.2011.10.13.22.33.14 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Oct 2011 22:33:14 -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 1REaOQ-0006Cx-5m for ; Fri, 14 Oct 2011 05:33:14 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 21E74E004C for ; Fri, 14 Oct 2011 05:33:14 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: linaro-image-tools X-Launchpad-Branch: ~linaro-image-tools/linaro-image-tools/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 448 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 448: Addressing the review comments for the hwpack name changes Message-Id: <20111014053314.12404.96502.launchpad@ackee.canonical.com> Date: Fri, 14 Oct 2011 05:33: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="14124"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: f282910a30876b54304648ebc5f5eaf2f2d49a9b Merge authors: Deepti B. Kalakeri (deeptik) Related merge proposals: https://code.launchpad.net/~deeptik/linaro-image-tools/linaro-hwpack-name-changes/+merge/79228 proposed by: Deepti B. Kalakeri (deeptik) review: Approve - James Westby (james-w) ------------------------------------------------------------ revno: 448 [merge] committer: Deepti B. Kalakeri branch nick: linaro-image-tools timestamp: Fri 2011-10-14 05:28:15 +0000 message: Addressing the review comments for the hwpack name changes modified: linaro-hwpack-replace --- lp:linaro-image-tools https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk You are subscribed to branch lp:linaro-image-tools. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription === modified file 'linaro-hwpack-replace' --- linaro-hwpack-replace 2011-10-12 17:49:06 +0000 +++ linaro-hwpack-replace 2011-10-13 12:11:28 +0000 @@ -45,6 +45,9 @@ parser.add_argument("-r", "--prefix-pkg-remove", dest="prefix_pkg_remove", help="Specify the prefix of the old debian package to "\ "replace (default: None).") +parser.add_argument("-n", "--append-build-number", dest="build_number", + help="Specify the build number if any to be used in new "\ + "hwpack name (default: None).") parser.add_argument("-i", "--in-place", action="store_true", dest="inplace", help="Modify the hwpack rather than creating a new one") parser.add_argument("-d", "--debug-output", action="store_true", dest="debug", @@ -77,10 +80,19 @@ logger.setLevel(logging.DEBUG) -def get_hwpack_name(old_hwpack): +def get_hwpack_name(old_hwpack, build_number): + # The build_number would be the job build number. + # Valid value for the build_number would be available for ex + # when l-h-r is used in the jenkins. timestamp = [datetime.datetime.utcnow().strftime("%Y%m%d-%H%M")] hwpack_name_parts = (old_hwpack.split('_', 3)) - return('_'.join(hwpack_name_parts[:2] + timestamp + hwpack_name_parts[3:])) + new_hwpack_name = [('_'.join(hwpack_name_parts[:2] + timestamp))] + + if build_number is not None: + job_build_number = [''.join('b' + build_number)] + new_hwpack_name = [('_'.join(new_hwpack_name + job_build_number))] + + return('_'.join(new_hwpack_name + hwpack_name_parts[3:])) def should_remove(package_name, prefix_pkg_remove): @@ -171,12 +183,13 @@ old_hwpack = args.hwpack_name new_deb_file_to_copy = args.deb_pack prefix_pkg_remove = args.prefix_pkg_remove + build_number = args.build_number status = 0 tempdir = "" try: # Get the new hardware pack name - hwpack_name = get_hwpack_name(old_hwpack) + hwpack_name = get_hwpack_name(old_hwpack, build_number) if hwpack_name == None: logger.error("Did not get a valid hwpack name, exiting") return status