public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nate DeSimone" <nathaniel.l.desimone@intel.com>
To: "Desimone, Ashley E" <ashley.e.desimone@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Pandya, Puja" <puja.pandya@intel.com>,
	"Bjorge, Erik C" <erik.c.bjorge@intel.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>,
	"Agyeman, Prince" <prince.agyeman@intel.com>
Subject: Re: [edk2-staging/EdkRepo] [PATCH V3 1/3] EdkRepo: Initial commit of workspace_maitenance.py
Date: Thu, 23 Apr 2020 18:29:31 +0000	[thread overview]
Message-ID: <93C92A63-F4BC-4ED9-874E-E64E93ADBE19@intel.com> (raw)
In-Reply-To: <20200422232915.18640-2-ashley.e.desimone@intel.com>

Hi Ashley,

There is a misspelling, "maitenance" should be "maintenance". Other than that, looks good.

Thanks,
Nate

On 4/22/20, 4:29 PM, "Desimone, Ashley E" <ashley.e.desimone@intel.com> wrote:

    Add workspace_maitenance.py including the implementation
    of generate_name_for_obsolete_backup()

    Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
    Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
    Cc: Puja Pandya <puja.pandya@intel.com>
    Cc: Erik Bjorge <erik.c.bjorge@intel.com>
    Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
    Cc: Prince Agyeman <prince.agyeman@intel.com>
    ---
     .../workspace_maitenance/workspace_maitenance.py   | 30 ++++++++++++++++++++++
     1 file changed, 30 insertions(+)
     create mode 100644 edkrepo/common/workspace_maitenance/workspace_maitenance.py

    diff --git a/edkrepo/common/workspace_maitenance/workspace_maitenance.py b/edkrepo/common/workspace_maitenance/workspace_maitenance.py
    new file mode 100644
    index 0000000..83204f8
    --- /dev/null
    +++ b/edkrepo/common/workspace_maitenance/workspace_maitenance.py
    @@ -0,0 +1,30 @@
    +#!/usr/bin/env python3
    +#
    +## @file
    +# workspace_maitenance.py
    +#
    +# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.<BR>
    +# SPDX-License-Identifier: BSD-2-Clause-Patent
    +#
    +
    +''' Contains shared workspace maitenance functions. '''
    +
    +import os
    +
    +def generate_name_for_obsolete_backup(absolute_path):
    +    if not os.path.exists(absolute_path):
    +        raise ValueError("{} does not exist".format(absolute_path))
    +    original_name = os.path.basename(absolute_path)
    +    dir_name = os.path.dirname(absolute_path)
    +    unique_name = ""
    +    unique_name_found = False
    +    index = 1
    +    while not unique_name_found:
    +        if index == 1:
    +            unique_name = "{}_old".format(original_name)
    +        else:
    +            unique_name = "{}_old{}".format(original_name, index)
    +        if not os.path.exists(os.path.join(dir_name, unique_name)):
    +            unique_name_found = True
    +        index += 1
    +    return unique_name
    \ No newline at end of file
    -- 
    2.16.2.windows.1



  reply	other threads:[~2020-04-23 18:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 23:29 [edk2-staging/EdkRepo] [PATCH V3 0/3] Add initial manifest repository support Ashley E Desimone
2020-04-22 23:29 ` [edk2-staging/EdkRepo] [PATCH V3 1/3] EdkRepo: Initial commit of workspace_maitenance.py Ashley E Desimone
2020-04-23 18:29   ` Nate DeSimone [this message]
2020-04-22 23:29 ` [edk2-staging/EdkRepo] [PATCH V3 2/3] EdkRepo: Add edkrepo/common/workspace_maitenance/manifest_repos_maitenance Ashley E Desimone
2020-04-23 18:29   ` Nate DeSimone
2020-04-22 23:29 ` [edk2-staging/EdkRepo] [PATCH V3 3/3] EdkRepo: Update pull_latest_manifest_repo to use pull_single_manifest_repo Ashley E Desimone
2020-04-23 18:29   ` Nate DeSimone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=93C92A63-F4BC-4ED9-874E-E64E93ADBE19@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox