File: mergeall-products/unzipped/test/ziptools/docetc/1.1-upgrades/verify-1.1-permissions.txt

##########################################################################################
# Demo 1.1's permissions propagation for files, folders, and links, plus its 
# new run stats and interactive prompts.  Results here are generally the same
# under Python 3.X and 2.X and across platforms, sans known diffs (e.g., per 
# py-2.X-3.X-zipoff.txt, Python 2.X does not support modtime updates fo symlinks). 
# The sreenshot original-perms-noperms.png captures the results created here; 
# TL;DR - permissions propagate for all, just like content and modtimes.
##########################################################################################


# Prerun
~/Desktop$ export Z=/MY-STUFF/Code/ziptools
~/Desktop$ export M=/MY-STUFF/Code/mergeall
~/Desktop$ date
Tue Mar 24 12:35:50 PDT 2020


##########################################################################################
# Zip (create), and unzip (extract) with and without permissions propagation
##########################################################################################


~/Desktop$ py3 $Z/zip-create.py testziptools/UNION.zip UNION -skipcruft | tail -n 3
Adding  file  UNION/xtra-gmail-newconfigs.png
Adding  file  UNION/ziptools.html
Create finished: files=4122, folders=268, links=4, unknowns=0, crufts=51.

 
~/Desktop$ py3 $Z/zip-extract.py testziptools/UNION.zip testziptools/NOPERMS | tail -n 3
Extracted UNION/ziptools.html
		=> testziptools/NOPERMS/UNION/ziptools.html
Extract finished: files=4122, folders=268, links=4, unknowns=0.

 
~/Desktop$ py3 $Z/zip-extract.py testziptools/UNION.zip testziptools/PERMS -permissions | tail -n 3
Extracted UNION/ziptools.html
		=> testziptools/PERMS/UNION/ziptools.html
Extract finished: files=4122, folders=268, links=4, unknowns=0.


##########################################################################################
# Verify that permissions are the same as the original with -permissions,  differ without
##########################################################################################


~/Desktop$ ls -l UNION/cgi
total 328
-rw-r--r--   1 blue  staff   1219 Jun 13  2017 DIFFS-with-offline-june2017.txt
lrwxr-xr-x   1 blue  staff     12 Mar 21 13:37 DIRLINK1 -> LIVE-Aug2017
lrwxr-xr-x   1 blue  staff     13 Mar 21 13:38 DIRLINK2 -> LIVE-Aug2017/
lrw-------   1 blue  staff     11 Mar 21 13:36 FILELINK1 -> showcode.py
lrwxr-xr-x   1 blue  staff     25 Mar 21 13:37 FILELINK2 -> sitesearch-savedterms.txt
-rw-r--r--   1 blue  staff   1768 Jun 29  2019 HOW-INSTALL-CGI-SCRIPTS.txt
-rwxrwxrwx   1 blue  staff   1042 Apr 14  2018 HOW.txt
drwx------   3 blue  staff    102 Aug  6  2017 LIVE-Aug2017
drwxr-xr-x  12 blue  staff    408 Jun 13  2017 LIVE-June2017
-rw-r--r--   1 blue  staff   6315 Feb 17  2018 __prior-sitesearch-savedterms.txt
-rw-r--r--   1 blue  staff   5205 Jul 30  2017 _prior-sitesearch-savedterms.txt
drwxrwxrwx   9 blue  staff    306 Jun 13  2017 dev
-rw-r--r--   1 blue  staff   2584 Feb 23 14:55 index.html
-rwxr-xr-x   1 blue  staff  20729 Feb 18  2014 pylotto-full.py
-rwxr-xr-x   1 blue  staff    151 Jun 13  2017 pylotto.py
-rwxrwxrwx   1 blue  staff   3035 Jul 19  2019 showcode-template.txt
-rw-r--r--   1 blue  staff     72 Feb 23  2018 showcode-unicode-demo.txt
-rw-------   1 blue  staff  26250 Aug 19  2019 showcode.py
-rw-------   1 blue  staff  13948 Jun 30  2019 sitesearch-savedterms.txt
-rwxr-xr-x   1 blue  staff  14054 Jun 29  2019 sitesearch.py
-rw-r--r--   1 blue  staff  15372 Feb 23 14:55 temp.html
-rwxr-xr-x   1 blue  staff     78 Apr 14  2018 test.py


~/Desktop$ ls -l testziptools/PERMS/UNION/cgi
total 328
-rw-r--r--   1 blue  staff   1219 Jun 13  2017 DIFFS-with-offline-june2017.txt
lrwxr-xr-x   1 blue  staff     12 Mar 21 13:37 DIRLINK1 -> LIVE-Aug2017
lrwxr-xr-x   1 blue  staff     13 Mar 21 13:38 DIRLINK2 -> LIVE-Aug2017/
lrw-------   1 blue  staff     11 Mar 21 13:36 FILELINK1 -> showcode.py
lrwxr-xr-x   1 blue  staff     25 Mar 21 13:37 FILELINK2 -> sitesearch-savedterms.txt
-rw-r--r--   1 blue  staff   1768 Jun 29  2019 HOW-INSTALL-CGI-SCRIPTS.txt
-rwxrwxrwx   1 blue  staff   1042 Apr 14  2018 HOW.txt
drwx------   3 blue  staff    102 Aug  6  2017 LIVE-Aug2017
drwxr-xr-x  11 blue  staff    374 Jun 13  2017 LIVE-June2017
-rw-r--r--   1 blue  staff   6315 Feb 17  2018 __prior-sitesearch-savedterms.txt
-rw-r--r--   1 blue  staff   5205 Jul 30  2017 _prior-sitesearch-savedterms.txt
drwxrwxrwx   8 blue  staff    272 Jun 13  2017 dev
-rw-r--r--   1 blue  staff   2584 Feb 23 14:55 index.html
-rwxr-xr-x   1 blue  staff  20729 Feb 18  2014 pylotto-full.py
-rwxr-xr-x   1 blue  staff    151 Jun 13  2017 pylotto.py
-rwxrwxrwx   1 blue  staff   3035 Jul 19  2019 showcode-template.txt
-rw-r--r--   1 blue  staff     72 Feb 23  2018 showcode-unicode-demo.txt
-rw-------   1 blue  staff  26250 Aug 19  2019 showcode.py
-rw-------   1 blue  staff  13948 Jun 30  2019 sitesearch-savedterms.txt
-rwxr-xr-x   1 blue  staff  14054 Jun 29  2019 sitesearch.py
-rw-r--r--   1 blue  staff  15372 Feb 23 14:55 temp.html
-rwxr-xr-x   1 blue  staff     78 Apr 14  2018 test.py


~/Desktop$ ls -l testziptools/NOPERMS/UNION/cgi
total 328
-rw-r--r--   1 blue  staff   1219 Jun 13  2017 DIFFS-with-offline-june2017.txt
lrwxr-xr-x   1 blue  staff     12 Mar 21 13:37 DIRLINK1 -> LIVE-Aug2017
lrwxr-xr-x   1 blue  staff     13 Mar 21 13:38 DIRLINK2 -> LIVE-Aug2017/
lrwxr-xr-x   1 blue  staff     11 Mar 21 13:36 FILELINK1 -> showcode.py
lrwxr-xr-x   1 blue  staff     25 Mar 21 13:37 FILELINK2 -> sitesearch-savedterms.txt
-rw-r--r--   1 blue  staff   1768 Jun 29  2019 HOW-INSTALL-CGI-SCRIPTS.txt
-rw-r--r--   1 blue  staff   1042 Apr 14  2018 HOW.txt
drwxr-xr-x   3 blue  staff    102 Aug  6  2017 LIVE-Aug2017
drwxr-xr-x  11 blue  staff    374 Jun 13  2017 LIVE-June2017
-rw-r--r--   1 blue  staff   6315 Feb 17  2018 __prior-sitesearch-savedterms.txt
-rw-r--r--   1 blue  staff   5205 Jul 30  2017 _prior-sitesearch-savedterms.txt
drwxr-xr-x   8 blue  staff    272 Jun 13  2017 dev
-rw-r--r--   1 blue  staff   2584 Feb 23 14:55 index.html
-rw-r--r--   1 blue  staff  20729 Feb 18  2014 pylotto-full.py
-rw-r--r--   1 blue  staff    151 Jun 13  2017 pylotto.py
-rw-r--r--   1 blue  staff   3035 Jul 19  2019 showcode-template.txt
-rw-r--r--   1 blue  staff     72 Feb 23  2018 showcode-unicode-demo.txt
-rw-r--r--   1 blue  staff  26250 Aug 19  2019 showcode.py
-rw-r--r--   1 blue  staff  13948 Jun 30  2019 sitesearch-savedterms.txt
-rw-r--r--   1 blue  staff  14054 Jun 29  2019 sitesearch.py
-rw-r--r--   1 blue  staff  15372 Feb 23 14:55 temp.html
-rw-r--r--   1 blue  staff     78 Apr 14  2018 test.py


##########################################################################################
# Verify that content and modtimes propagated to/from the zip correctly too, as before
##########################################################################################


~/Desktop$ py3 $M/diffall.py UNION testziptools/NOPERMS/UNION/ -skipcruft | tail -n 6
================================================================================
Runtime hrs:mins:secs = 0:0:5.24
Dirs checked 268, Files checked: 4126, Files skipped: 0
System metadata (cruft) files were skipped
No diffs found.
End of report.


~/Desktop$ py3 $M/diffall.py UNION testziptools/PERMS/UNION/ -skipcruft | tail -n 6
================================================================================
Runtime hrs:mins:secs = 0:0:5.33
Dirs checked 268, Files checked: 4126, Files skipped: 0
System metadata (cruft) files were skipped
No diffs found.
End of report.


~/Desktop$ py3 $M/mergeall.py UNION testziptools/NOPERMS/UNION/ -report -skipcruft | tail -n 9
------------------------------------------------------------------------------- 
*Summary
Compared    => files: 4122, folders: 268
Differences => samefile: 0, uniqueto: 0, uniquefrom: 0, mixedmode: 0
Changed:
files   => created: 0, deleted: 0, replaced: 0
folders => created: 0, deleted: 0, replaced: 0
-------------------------------------------------------------------------------
Finished.


~/Desktop$ py3 $M/mergeall.py UNION testziptools/PERMS/UNION/ -report -skipcruft | tail -n 9
------------------------------------------------------------------------------- 
*Summary
Compared    => files: 4122, folders: 268
Differences => samefile: 0, uniqueto: 0, uniquefrom: 0, mixedmode: 0
Changed:
files   => created: 0, deleted: 0, replaced: 0
folders => created: 0, deleted: 0, replaced: 0
-------------------------------------------------------------------------------
Finished.


##########################################################################################
# Interactive interface's new prompt and strips (vs command-lines: e.g., in some IDEs)
##########################################################################################


~/Desktop$ py3 $Z/zip-create.py
Zip file to create? testziptools/UNION
Items to zip (comma separated)? UNION
Skip cruft items (y=yes)? y
Follow links to targets (y=yes)? 
About to ZIP
	['UNION'],
	to testziptools/UNION.zip,
	skipping cruft,
	not following links
Confirm with 'y'? y
Zipping ['UNION'] to testziptools/UNION.zip
Cruft patterns: {'skip': ['.*', '[dD]esktop.ini', 'Thumbs.db', '~*', '$*', '*.py[co]'], 'keep': ['.htaccess']}
Adding folder UNION
--Skipped cruft file UNION/.DS_Store
...etc...
Adding  file  UNION/ziptools.html
Create finished: files=4122, folders=268, links=4, unknowns=0, crufts=51.


~/Desktop$ py3 $Z/zip-extract.py
Zip file to extract? testziptools/UNION  
Folder to extract in (use . for here) ? testziptools/NOPERMS
Do not localize symlinks (y=yes)? 
Retain access permissions (y=yes)? 
About to UNZIP
	testziptools/UNION.zip,
	to testziptools/NOPERMS,
	localizing any links,
	not retaining permissions
Confirm with 'y'? y
Unzipping from testziptools/UNION.zip to testziptools/NOPERMS
Extracted UNION/
		=> testziptools/NOPERMS/UNION
...etc...
Extracted UNION/ziptools.html
		=> testziptools/NOPERMS/UNION/ziptools.html
Extract finished: files=4122, folders=268, links=4, unknowns=0.


~/Desktop$ rm -rf testziptools/PERMS
~/Desktop$ py3 $Z/zip-extract.py
Zip file to extract?    testziptools/UNION
Folder to extract in (use . for here) ? testziptools/PERMS
Do not localize symlinks (y=yes)? y
Retain access permissions (y=yes)? y
About to UNZIP
	testziptools/UNION.zip,
	to testziptools/PERMS,
	not localizing any links,
	retaining permissions
Confirm with 'y'? y
Unzipping from testziptools/UNION.zip to testziptools/PERMS
Extracted UNION/
		=> testziptools/PERMS/UNION
...etc...
Extracted UNION/ziptools.html
		=> testziptools/PERMS/UNION/ziptools.html
Extract finished: files=4122, folders=268, links=4, unknowns=0.


# Verify original/without permissions/with permissions
~/Desktop$ ls -l UNION/cgi/sitesearch-savedterms.txt \
>                testziptools/PERMS/UNION/cgi/sitesearch-savedterms.txt \
>                testziptools/NOPERMS/UNION/cgi/sitesearch-savedterms.txt
-rw-------  1 blue  staff  13948 Jun 30  2019 UNION/cgi/sitesearch-savedterms.txt
-rw-r--r--  1 blue  staff  13948 Jun 30  2019 testziptools/NOPERMS/UNION/cgi/sitesearch-savedterms.txt
-rw-------  1 blue  staff  13948 Jun 30  2019 testziptools/PERMS/UNION/cgi/sitesearch-savedterms.txt



[Home page] Books Code Blog Python Author Train Find ©M.Lutz