Merge lp:~jr.allen/unifield-toolbox/py27 into lp:unifield-toolbox

Proposed by Jeff Allen
Status: Needs review
Proposed branch: lp:~jr.allen/unifield-toolbox/py27
Merge into: lp:unifield-toolbox
Diff against target: 223 lines (+0/-209)
3 files modified
PatchTools/make_patch.bash (+0/-4)
PatchTools/make_patch.py (+0/-125)
PatchTools/set_win_tree.bash (+0/-80)
To merge this branch: bzr merge lp:~jr.allen/unifield-toolbox/py27
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+329810@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

238. By Jeff Allen

Remove tools that have been moved to https://code.launchpad.net/~unifield-team/unifield-wm/packaging_py27

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file 'PatchTools/make_patch.bash'
--- PatchTools/make_patch.bash 2017-05-16 13:35:42 +0000
+++ PatchTools/make_patch.bash 1970-01-01 00:00:00 +0000
@@ -1,4 +0,0 @@
1#! /bin/bash
2
3echo "This script has been replaced by make_patch.py."
4exit 1
50
=== removed file 'PatchTools/make_patch.py'
--- PatchTools/make_patch.py 2017-07-25 07:40:49 +0000
+++ PatchTools/make_patch.py 1970-01-01 00:00:00 +0000
@@ -1,125 +0,0 @@
1#!/usr/bin/env python
2
3import sys
4import os
5import zipfile
6import time
7import re
8import filecmp
9
10if len(sys.argv) != 4:
11 print 'Expected 3 arguments: <from_tree> <to_tree> <patch_zip_name>'
12 sys.exit()
13
14# Skip things that do not belong in patch files.
15def should_skip(name):
16 return (name.endswith('.pyc') or
17 name in [
18 # this will be added at the end of this script instead
19 'release.py',
20 # these are related to the AIO and should not go in the patch
21 'Uninstall.exe',
22 'web/Uninstall.exe',
23 'setup.py',
24 'setup_py2exe_custom.py',
25 # these config files on the end-user installs should never
26 # be overwritten
27 'openerp-server.conf',
28 'web/conf/openerp-web-oc.cfg',
29 ])
30
31# Change the directory from the filesystem into a destination directory in
32# the patchfile (this mapping was set by the implementation of
33# updater.py)
34
35def dirmap(directory):
36 directory = directory.replace(sys.argv[2], '')
37 if directory.startswith('/'):
38 directory = directory[1:]
39 # unpdater.py expects lower case
40 if directory.startswith('Web'):
41 directory = 'w' + directory[1:]
42 # change directory Server/foo to foo
43 if directory == 'Server':
44 directory = ''
45 elif directory.startswith('Server/'):
46 directory = directory[7:]
47 return directory
48
49# The plan:
50#
51# for each file in the original distribution:
52# remember it's name
53# if not in new distribution:
54# add to delete list
55# else
56# if new distribution version is different:
57# add to patch file
58# for each file in the new distribution:
59# if we did not already see it:
60# add to patch file
61
62deleted = []
63seen = {}
64
65old = sys.argv[1]
66new = sys.argv[2]
67zf = zipfile.ZipFile(sys.argv[3], mode='w', compression=zipfile.ZIP_DEFLATED)
68
69for (dirpath, dirnames, filenames) in os.walk(old):
70 relpath = dirpath.replace(old, '')
71 if len(relpath) > 0 and relpath[0] == '/':
72 relpath = relpath[1:]
73 if relpath == 'ServerLog':
74 continue
75 for f in filenames:
76 oldf = os.path.join(dirpath, f)
77 newf = os.path.join(new, relpath, f)
78 dest = os.path.join(dirmap(relpath), f)
79 if should_skip(dest):
80 continue
81 if not os.path.exists(newf):
82 print "del %s" % dest
83 deleted.append(dest)
84 elif not filecmp.cmp(oldf, newf, False):
85 print "write mod %s" % dest
86 zf.write(newf, dest)
87 seen[dest] = True
88
89for (dirpath, dirnames, filenames) in os.walk(new):
90 relpath = dirpath.replace(new, '')
91 if len(relpath) > 0 and relpath[0] == '/':
92 relpath = relpath[1:]
93 if relpath == 'ServerLog':
94 continue
95 for f in filenames:
96 newf = os.path.join(new, relpath, f)
97 dest = os.path.join(dirmap(relpath), f)
98 if should_skip(dest) or dest in seen:
99 continue
100 print "write add %s" % dest
101 zf.write(newf, dest)
102
103# special case for release.py: add the date onto the end of the
104# given version
105with open(os.path.join(new, 'Server', 'release.py')) as f:
106 lines = f.readlines()
107out = []
108for line in lines:
109 if line.startswith('version = '):
110 exec(line)
111 else:
112 out += line
113
114if not re.match('.*-[0-9]{8}-[0-9]{6}$', version):
115 version += time.strftime('-%Y%m%d-%H%M%S')
116 print "Version inserted into the patch is: %s" % version
117else:
118 print "Version in the source is already timestamped: %s" % version
119
120out += 'version = \'%s\'\n' % version
121zf.writestr('release.py', ''.join(out))
122
123zf.writestr('delete.txt', '\n'.join(deleted))
124zf.close()
125
1260
=== removed file 'PatchTools/set_win_tree.bash'
--- PatchTools/set_win_tree.bash 2016-09-14 17:28:45 +0000
+++ PatchTools/set_win_tree.bash 1970-01-01 00:00:00 +0000
@@ -1,80 +0,0 @@
1#! /bin/bash
2usage()
3{
4 cat << EOF
5usage: $0 options [name]
6
7This script set a UniField windows source tree
8
9OPTIONS:
10-h This help msg
11-s <serie> Launchpad serie to retrieve (default trunk)
12-t <tag> Tag name
13<directory> Directory
14EOF
15}
16
17TAG=""
18BZRBRANCH=""
19SYNCBZRBRANCH=""
20while getopts "hs:t:" OPTION
21do
22 case $OPTION in
23 h)
24 usage
25 exit 1
26 ;;
27 t)
28 TAG="-r $OPTARG"
29 ;;
30 s)
31 BZRBRANCH="/$OPTARG"
32 SYNCBZRBRANCH="-$OPTARG"
33 ;;
34 ?)
35 usage
36 exit 0
37 ;;
38 esac
39done
40
41shift $(($OPTIND - 1))
42if [ -z "$1" ]; then
43 usage
44 exit 1
45fi
46
47if [ -f "$1" -o -d "$1" ]; then
48 echo "Directory $1 exists"
49 exit 1
50fi
51
52mkdir $1
53cd $1
54
55echo "== web =="
56echo bzr branch $TAG lp:unifield-web/${BZRBRANCH} unifield-web
57bzr branch $TAG lp:unifield-web/${BZRBRANCH} unifield-web
58
59echo "== server =="
60echo bzr branch $TAG lp:unifield-server${BZRBRANCH} unifield-server
61bzr branch $TAG lp:unifield-server${BZRBRANCH} unifield-server
62cd unifield-server/bin/addons
63
64#echo "== addons =="
65#echo bzr branch $TAG lp:unifield-addons${BZRBRANCH} unifield-addons
66#bzr branch $TAG lp:unifield-addons${BZRBRANCH} unifield-addons
67#mv unifield-addons/* .
68#rm -fr unifield-addons
69
70#echo "== wm =="
71#echo bzr branch $TAG lp:unifield-wm${BZRBRANCH} unifield-wm
72#bzr branch $TAG lp:unifield-wm${BZRBRANCH} unifield-wm
73#mv unifield-wm/* .
74#rm -fr unifield-wm
75
76#echo "== sync_module =="
77#echo bzr branch $TAG lp:unifield-wm/sync${SYNCBZRBRANCH} sync_module_prod
78#bzr branch $TAG lp:unifield-wm/sync${SYNCBZRBRANCH} sync_module_prod
79#mv sync_module_prod/* .
80#rm -fr sync_module_prod

Subscribers

People subscribed via source and target branches

to all changes: