public inbox for cygwin-apps-cvs@sourceware.org help / color / mirror / Atom feed
From: jturney@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20160705-59-gae33541 Date: Mon, 10 Apr 2017 09:57:00 -0000 [thread overview] Message-ID: <20170410095728.41830.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=ae33541488c402a3461e75d89241eb7f7ddf8deb commit ae33541488c402a3461e75d89241eb7f7ddf8deb Author: Jon Turney <jon.turney@dronecode.org.uk> Date: Sat Apr 8 21:11:18 2017 +0100 Remove directories which are empty after updating package listing Diff: --- calm/pkg2html.py | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/calm/pkg2html.py b/calm/pkg2html.py index f6b260c..70af62d 100755 --- a/calm/pkg2html.py +++ b/calm/pkg2html.py @@ -31,8 +31,8 @@ # --- if a package listing HTML file doesn't already exist # ---- write a HTML package listing file listing the tar file contents # - write packages.inc, the list of packages -# - remove any listing files for which there was no package -# - remove any empty directories (TBD) +# - remove any .htaccess or listing files for which there was no package +# - remove any directories which are now empty # # note that the directory hierarchy of (noarch|arch)/package/subpackages is # flattened in the package listing to just the package name @@ -84,7 +84,7 @@ def update_package_listings(args, packages, arch): print('Redirect temp /packages/%s/index.html https://cygwin.com/packages/package_list.html' % (arch), file=f) - toremove = glob.glob(os.path.join(base, '*', '*')) + toremove = glob.glob(os.path.join(base, '*', '*')) + glob.glob(os.path.join(base, '*', '.*')) for p in packages: @@ -119,6 +119,10 @@ def update_package_listings(args, packages, arch): # doesn't help for src packages, so is it actually having # any effect? + # this file should exist, so remove from the toremove list + if htaccess in toremove: + toremove.remove(htaccess) + # # for each tarfile, write tarfile listing # @@ -220,7 +224,7 @@ def update_package_listings(args, packages, arch): </div>'''), file=index) # - # remove any remaining listing files for which there was no corresponding package + # remove any remaining files for which there was no corresponding package # for r in toremove: @@ -228,6 +232,16 @@ def update_package_listings(args, packages, arch): if not args.dryrun: os.unlink(r) + # + # remove any directories which are now empty + # + + dirpath = os.path.dirname(r) + if len(os.listdir(dirpath)) == 0: + logging.debug('rmdir %s' % dirpath) + os.rmdir(os.path.join(dirpath)) + + if __name__ == "__main__": htdocs_default = os.path.join(common_constants.HTDOCS, 'packages') relarea_default = common_constants.FTP
reply other threads:[~2017-04-10 9:57 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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-all 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=20170410095728.41830.qmail@sourceware.org \ --to=jturney@sourceware.org \ --cc=cygwin-apps-cvs@sourceware.org \ /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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).