[sunzi/development] README.maint: revisit the branching + release steps
by Jan Pokorný
commit 3666b73a8700b1553178d70a18bc171d831bcece
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Sat Mar 17 13:44:31 2012 +0100
README.maint: revisit the branching + release steps
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
README.maint | 72 +++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 47 insertions(+), 25 deletions(-)
---
diff --git a/README.maint b/README.maint
index 7045881..ec0b444 100644
--- a/README.maint
+++ b/README.maint
@@ -14,69 +14,91 @@ See also `README.contrib`.
Branches
--------
-* `master` -> current version maintenance
-* `development` -> upcoming version development
-* longer-term support versions (bases for distro releases) have own
- branches (can be created ex-post, return to specific tag and fork it)
-* ...
+* `master` -> current version maintenance
+* `development` -> upcoming version development
+* release branches -> on-demand forks from `master` (as per tag) treated
+ the same way as `master` itself
Work on an isolated bug/feature happens on a separate branch that can
be either public (same/another repo) or local only, then pushed as
reasonable-sized patches to the respective branch:
-new feature -> `development`
-bugfix -> `master` + `development` (depending on what is applicable)
-(or long-term support version, indeed)
+new feature -> (feature branch ->) `development`
+bugfix -> release branch(es) -> `development`
+refactorings, cleanups -> `development` (if atomic)
-IOW, `master` should never be broken.
+IOW, `master` should always be production-ready and its history should be
+a bit cleaner than `development`, which is still quite clean as checkpoint
+commits for features/bugfixes are matter of feature/bugfix branches
+(well, it will be after the early phase is over).
-When new upstream release to be done, merge `development` into `master`,
-release is made from `master` (incl. making a tag, see II.A.), then
+When new upstream release to be done, the preparation is made in
+`development`, changes forwarded into `master` (see II.A.), then
`development` branch is used primarily again.
+See also:
+`<http://nvie.com/posts/a-successful-git-branching-model/>`_
+`<http://sandofsky.com/blog/git-workflow.html>`_
+
II. Managing Python releases
============================
A. Making a new upstream release
--------------------------------
-1. Make sure everything intended is in upstream git repo and ready.
+1. Make sure everything intended is in `development` and ready
+ (meaning the feature branches has been forwarded to `development`).
See IV. if you want to update third-party bundles for release
- (note that this substep should be done much earlier and tested).
-2. Take a look at the changes since the last version/tag::
+ (note that this substep should be done much earlier and tested,
+ but always in `development` branch).
+
+2. Forward changes in `development` to `master` (being on `development`)::
+
+ $ git rebase --interactive master
+ # select which commits to preserve as such and which to dissolve
+ # to large changes (various little cleanups into a single one, etc.)
+ # NOTE: first forward to `master` will probably be different
+ # (git checkout master; git merge --squash development?)
+
+(2b. test if rebase went well, if not, return to 1.)
- $ git whatchanged PREVTAG.. --oneline # or silimar
+3. Tag the release::
- then pick the most important items and add them briefly
- to `CHANGES.txt` denoting the upcoming version
- (TODO: format to be established)
-3. Commit `CHANGES.txt` with `sunzi-X.Y.Z` commit message.
-4. Tag the release::
+ $ git tag release-X.Y.Z # TODO: options (should be annotated?)
- $ git tag sunzi-X.Y.Z # TODO: options (should be annotated?)
+4. Take a look at the changes since the last version/tag (based on 2.)::
-5. Finally, create a tarball(s)::
+ $ git whatchanged PREVTAG.. --oneline >> CHANGES.txt # or silimar
+ $ vim CHANGES.txt # if needed
+ # NOTE: CHANGES.txt is not intended as a part of the repo, but may be
+ # part of the package or distributed along it as separate file
+
+5. Create a tarball(s)::
$ python setup.py tarball
# or alternatively:
$ ./setup tarball
6. Postprocess the tarball(s) [TODO: script would be handy]
- - tar.gz -> tar.xz
+ - tar.gz -> tar.xz (TBD: is it worth?)
- create sha256 checksums (tar.* + CHANGES.txt)
- upload release files to fedorahosted.org hosting, e.g.::
- scp sunzi-0.1.0.* CHANGES.txt fedorahosted.org:sunzi
+ $ scp sunzi-0.1.0.* CHANGES.txt fedorahosted.org:sunzi
NOTE: generating `download_url` automatically -- follow this URL!
NOTE: gpg signing integrated with `upload` command of setuptools
TODO: include git log between versions? E.g., CHANGES-0.1.0.txt
TODO: upload to PyPI?
+
7. Send announcements, etc., whatever suitable.
+If in any stated step a defect was detected, start from 1., incrementing
+last version number.
+
B. Make a scratch release/developing in-place
---------------------------------------------
-1. As easy as this (version on non-tag commit should be set
+1. As easy as this (version on non-tagged commit should be set
according to the last tagged version + shortened commit hash)::
$ ./setup release # release
11 years, 8 months
[sunzi/development] re ce0fa28: also adjust dir_info.txt
by Jan Pokorný
commit 074f634495e048b7f87f576306e3c652b96ceebe
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Fri Mar 16 04:00:44 2012 +0100
re ce0fa28: also adjust dir_info.txt
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
third-party/target-jquery-ui/dir_info.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/third-party/target-jquery-ui/dir_info.txt b/third-party/target-jquery-ui/dir_info.txt
index f829053..94e9025 100644
--- a/third-party/target-jquery-ui/dir_info.txt
+++ b/third-party/target-jquery-ui/dir_info.txt
@@ -1,3 +1,3 @@
files here are generated from jquery-ui git repo clone in ../git-jquery-ui
(local git submodule) that does not provide such raw files on its own;
-for the whole recipe see ../init-jquery-ui
+for the whole recipe see ../init-jqueryui
11 years, 8 months
[sunzi/development] prepare-devel.py: remove debug debris
by Jan Pokorný
commit 38aaea21727021469a4151138a17fbe5d4fa5f2c
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Fri Mar 16 03:58:43 2012 +0100
prepare-devel.py: remove debug debris
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
prepare-devel.py | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
---
diff --git a/prepare-devel.py b/prepare-devel.py
index e71b325..ded5f9e 100644
--- a/prepare-devel.py
+++ b/prepare-devel.py
@@ -83,7 +83,6 @@ class ParamItems(object):
for filename in nonmatching:
to_copy.append((join(root, filename), this_destdir))
for src,dst in to_copy:
- print "jere", src
copy2(src, dst)
class StylesheetItems(ParamItems):
@@ -167,7 +166,6 @@ class FontItems(ParamItems):
for item in self._items:
# NOTE: no explicit collision checks (?)
base = basename(item)
- print "YAY", item, destdir
self.proceed(item, destdir, '[_]*', ignore=self._ignore)
return None
return FontGetter
11 years, 8 months
[sunzi/development] init-jquery-ui -> init-jqueryui: follow function name
by Jan Pokorný
commit ce0fa28dcc73f3e0f01e0074a9ec40ed1698c0e3
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Fri Mar 16 03:56:40 2012 +0100
init-jquery-ui -> init-jqueryui: follow function name
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
third-party/{init-jquery-ui => init-jqueryui} | 0
1 files changed, 0 insertions(+), 0 deletions(-)
---
diff --git a/third-party/init-jquery-ui b/third-party/init-jqueryui
similarity index 100%
rename from third-party/init-jquery-ui
rename to third-party/init-jqueryui
11 years, 8 months
[sunzi/development] setup: extra font handling
by Jan Pokorný
commit 6bfd32b99223e1e2e6b8de2088cf446b772cedcb
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Fri Mar 16 03:51:54 2012 +0100
setup: extra font handling
additionally, the situation is following (c.f. 81c85c9)
- sunzi/public/fonts/LiberationSans-Bold-webfont.eot
+ sunzi/public/liberation/LiberationSans-Bold.eot
not
+ sunzi/public/css/liberation/LiberationSans-Bold.eot
This is better when writing scss styles referring to the fonts as
both scss and generated css files will use "../liberation/some.ttf".
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
prepare-devel.py | 78 ++++++++++++++++++++++++++++++++++++++---------------
setup_prepare.py | 36 +++++++++++++++++++-----
2 files changed, 84 insertions(+), 30 deletions(-)
---
diff --git a/prepare-devel.py b/prepare-devel.py
index 9187b67..e71b325 100644
--- a/prepare-devel.py
+++ b/prepare-devel.py
@@ -7,7 +7,8 @@ if __name__ == '__main__': # __builtin__ expected (?)
raise RuntimeError, "Not used in an expected way"
from os import walk, makedirs
-from os.path import join, exists, isfile, basename, splitext, normpath, sep
+from os.path import join, exists, isfile, isdir, basename, splitext, \
+ normpath, sep
from shutil import copy2
from fnmatch import fnmatch
@@ -82,17 +83,18 @@ class ParamItems(object):
for filename in nonmatching:
to_copy.append((join(root, filename), this_destdir))
for src,dst in to_copy:
+ print "jere", src
copy2(src, dst)
class StylesheetItems(ParamItems):
- def init(self, ignore=(), **kwargs):
+ """Stylesheet items, either direct *.js files or directories"""
+ def init(self, ignore=()):
self._items = []
self._ignore = ignore
def add(self, *inputitems):
assert len([item for item in inputitems if item in self._items]) == 0
self._items.extend(inputitems)
def make_param(self, *stylesheet_dir):
- outer_self = self
destdir = join(*stylesheet_dir)
class StylesheetGetter(ContentGetter):
# NOTE: beware of using inner_self
@@ -116,39 +118,66 @@ class StylesheetItems(ParamItems):
# NOTE: no explicit collision checks
self.proceed(inputitem, destdir, '*css', lambda fn:
files.setdefault(fn, open(fn).read()),
- self._ignore)
+ ignore=self._ignore)
return Scss(scss_opts=opts, scss_files=files).compile()
return StylesheetGetter
class JavaScriptItems(ParamItems):
- def init(self, ignore=(), **kwargs):
+ """JavaScript items, either direct *.js files or directories"""
+ def init(self, ignore=()):
self._items = {}
self._ignore = ignore
- def _inputitem2dict(self, fn):
- # jquery-ui-1.8.17.js -> jquery_ui_1_8_17, etc.
- base = splitext(basename(fn))[0].replace('-', '_').replace('.', '_')
- assert not self._items.has_key(base)
- self._items[base] = fn
- def add(self, *inputitems):
+ def _file2dict(self, destpath):
+ def file2dict(fn):
+ base = splitext(basename(fn))[0]
+ assert not base in self._items
+ self._items[base] = (fn, destpath)
+ return file2dict
+ def add(self, destpath=(), *inputitems):
for inputitem in inputitems:
- self.proceed(inputitem, None, '*.js', self._inputitem2dict,
- self._ignore)
+ self.proceed(inputitem, None, '*.js', self._file2dict(destpath),
+ ignore=self._ignore)
def make_params(self, *javascript_dir):
destdir = join(*javascript_dir)
- for key, item in self._items.iteritems():
- base = basename(item)
- gen_file(key+'_path',
+ for base, (item, destpath) in self._items.iteritems(): # safe?
+ gen_file('javascript-' + base,
item,
- join(destdir, base),
+ join(destdir, *destpath)
)
- base = splitext(base)[0]
- nonoptions(**{key: base}) # easy access to script within JS dir
+ # for require.js
+ self._items[base] = (lambda *a: '/'.join(a))(destdir, *destpath)
+ nonoptions(**self._items)
+
+class FontItems(ParamItems):
+ """Font items, expected to be directories"""
+ def init(self, ignore=()):
+ self._items = []
+ self._ignore = ignore
+ def add(self, *inputitems):
+ for inputitem in inputitems:
+ assert not inputitem in self._items
+ if not isdir(inputitem):
+ raise RuntimeError("not a directory: %s" % inputitem)
+ self._items.append(inputitem)
+ def make_param(self, *root_dir):
+ destdir = join(*root_dir)
+ class FontGetter(ContentGetter):
+ # NOTE: beware of using inner_self
+ def get(inner_self):
+ for item in self._items:
+ # NOTE: no explicit collision checks (?)
+ base = basename(item)
+ print "YAY", item, destdir
+ self.proceed(item, destdir, '[_]*', ignore=self._ignore)
+ return None
+ return FontGetter
# initiate input items with anything appropriate from devel dirs
stylesheet_items = StylesheetItems(join(PACKAGE,PUBLIC,DEVEL_STYLESHEET_ROOT),
ignore=IGNORE)
javascript_items = JavaScriptItems(join(PACKAGE,PUBLIC,DEVEL_JAVASCRIPT_ROOT),
ignore=IGNORE)
+font_items = FontItems(ignore=IGNORE)
# RequireJS + requisities (hardcoded as this is referrenced via metadata.py)
gen_file('requirejs',
@@ -171,12 +200,13 @@ javascript_items.add(
join('third-party','target-jquery-ui','ui','i18n','jquery-ui-i18n.js'),
)
stylesheet_items.add(
- join('third-party','target-jquery-ui','themes','base') # jquery-ui.css + images
+ # jquery-ui.css + images
+ join('third-party','target-jquery-ui','themes','base')
)
# Liberation fonts
-stylesheet_items.add(
- join('third-party','target-liberation-fonts') # "liberation" dir
+font_items.add(
+ join('third-party','target-liberation-fonts')
)
# put all stylesheet files (CSS/SCSS) altogether
@@ -184,5 +214,9 @@ gen_file('stylesheet',
stylesheet_items.make_param(PACKAGE,PUBLIC,STYLESHEET_ROOT),
join(PACKAGE,PUBLIC,STYLESHEET_ROOT,*STYLESHEET_MAIN),
)
+# similarly, handle all fonts at once
+gen_file('fonts',
+ font_items.make_param(PACKAGE,PUBLIC),
+)
# similarly for JavaScript files (but 1:1 mapping kept)
javascript_items.make_params(PACKAGE,PUBLIC,JAVASCRIPT_ROOT)
diff --git a/setup_prepare.py b/setup_prepare.py
index 9a79790..35fe182 100644
--- a/setup_prepare.py
+++ b/setup_prepare.py
@@ -348,9 +348,15 @@ class Params(object):
self.data_files.append(
PrepareDataFile(src_key, dst_key, **kwargs)
)
- def set_gen_file(self, basekey, src, dst, **kwargs):
+ def set_gen_file(self, basekey, src, dst=None, **kwargs):
src_key, dst_key = '__'+basekey, basekey
- self.set_nonoptions(**{src_key: src, dst_key:dst})
+ if dst:
+ self.set_nonoptions(**{src_key: src, dst_key:dst})
+ else:
+ # special case of callable taking whole care (src only,
+ # but really meant as dst as src cannot be skipped)
+ src_key = None
+ self.set_nonoptions(**{dst_key: src})
self.gen_files.append(
PrepareFile(src_key, dst_key, **kwargs)
)
@@ -393,15 +399,22 @@ class Params(object):
class PrepareFile(object):
"""Planned file ``preparation'' using symbolic source/destination path"""
def __init__(self, src, dst, subst=False, incl=True, **kwargs):
- self.src = subst and Params.substitute(src) or src
- self.dst = dst
-
- self.src_getter = lambda src,getter: getter(src, 'r')
- self.dst_getter = lambda dst,getter: getter(dst, 'w')
+ if src:
+ self.dst = dst
+ self.src = subst and Params.substitute(src) or src
+ self.src_getter = lambda src,getter: getter(src, 'r')
+ self.dst_getter = lambda dst,getter: getter(dst, 'w')
+ else:
+ # special case of callable taking whole care (dst only)
+ self.src = src
+ self.dst = subst and Params.substitute(dst) or dst
+ self.dst_getter = lambda dst,getter: getter(dst, 'r')
self.incl = incl
self.private = kwargs # mainly to keep data between prepare and attach
self._prepared = False
+ def __repr__(self):
+ return "<PrepareFile src:%s,dst:%s>" % (repr(self.src), repr(self.dst))
def prepare(self, getter, distribution=None):
src, dst = self.do_prepare(getter, distribution)
self._prepared = True
@@ -411,7 +424,10 @@ class PrepareFile(object):
raise RuntimeError('Cannot attach before preparing self')
self.do_attach(distribution)
def do_prepare(self, getter, distribution):
- src = self.src_getter(self.src, getter)
+ src = self.src
+ if src:
+ # otherwise, special case of callable taking whole care
+ src = self.src_getter(src, getter)
dst = self.dst_getter(self.dst, getter)
return src, dst
def do_attach(self, distribution):
@@ -549,6 +565,10 @@ class PrepareBaseCommand(Command, object):
dst.close()
copymode(src.name, dst.name)
return
+ elif not src:
+ # special case of callable taking whole care (dst only)
+ dst.get()
+ return
log.debug("Getting content into %s", dst.name)
if self.dry_run:
return
11 years, 8 months
[sunzi/development] prepare-devel.py: add possibility to ignore files
by Jan Pokorný
commit 376fc43f72e6cc1beb4aaecd242a4afab6f29bd3
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Thu Mar 15 23:24:35 2012 +0100
prepare-devel.py: add possibility to ignore files
which is useful and needed (scss/_vimrc_local.vim -> css/ not desired)
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
prepare-devel.py | 40 +++++++++++++++++++++++++---------------
1 files changed, 25 insertions(+), 15 deletions(-)
---
diff --git a/prepare-devel.py b/prepare-devel.py
index f096770..9187b67 100644
--- a/prepare-devel.py
+++ b/prepare-devel.py
@@ -20,6 +20,8 @@ DEVEL_JAVASCRIPT_ROOT = 'devel-js'
PYSCSS_PATH = join('third-party','git-pyscss')
+IGNORE = ['_vimrc_local.vim', 'dir_info.txt']
+
class ParamItems(object):
"""Base abstract class for local parameters wrapper
@@ -27,8 +29,8 @@ class ParamItems(object):
for generating single input parameter (as return value) and generating
multiple parameters directly (via `gen_file` et. al.) respectively.
"""
- def __init__(self, *inputitems):
- self.init()
+ def __init__(self, *inputitems, **kwargs):
+ self.init(**kwargs)
self.add(*inputitems)
def init(self):
pass
@@ -46,12 +48,13 @@ class ParamItems(object):
return False
@staticmethod
- def proceed(inputitem, destdir=None, pattern='*', pattern_proceed=None):
+ def proceed(inputitem, destdir=None, pattern='*', pattern_proceed=None,
+ ignore=()):
"""Copy files in dir tree + another action with pattern matching ones
The same business in performed if `inputitem` is directly a file.
And the "copy" phase can be totally skipped by leaving `destdir`
- as `None`.
+ as `None`. There is also `ignore` as a filter of files to ignore.
"""
to_copy = []
inputitem = normpath(inputitem)
@@ -68,7 +71,7 @@ class ParamItems(object):
fpath = join(root, filename)
matches = ParamItems._proceed_matching(fpath, pattern,
pattern_proceed)
- if not matches:
+ if not matches and not filename in ignore:
nonmatching.append(filename)
# this arrangment guarantees creating dir only if needed
if nonmatching and destdir:
@@ -82,8 +85,9 @@ class ParamItems(object):
copy2(src, dst)
class StylesheetItems(ParamItems):
- def init(self):
+ def init(self, ignore=(), **kwargs):
self._items = []
+ self._ignore = ignore
def add(self, *inputitems):
assert len([item for item in inputitems if item in self._items]) == 0
self._items.extend(inputitems)
@@ -91,7 +95,8 @@ class StylesheetItems(ParamItems):
outer_self = self
destdir = join(*stylesheet_dir)
class StylesheetGetter(ContentGetter):
- def get(self):
+ # NOTE: beware of using inner_self
+ def get(inner_self):
from sys import path as sys_path
sys_path.insert(0, PYSCSS_PATH)
try:
@@ -104,19 +109,21 @@ class StylesheetItems(ParamItems):
logging.basicConfig(format='%(levelname)s: %(message)s')
del logging
del sys_path
- collected = self.getter.collected
+ collected = inner_self.getter.collected
opts = dict(compress = ifdevel(False, True)(collected))
files = {}
- for inputitem in outer_self._items:
+ for inputitem in self._items:
# NOTE: no explicit collision checks
- outer_self.proceed(inputitem, destdir, '*css', lambda fn:
- files.setdefault(fn, open(fn).read()))
+ self.proceed(inputitem, destdir, '*css', lambda fn:
+ files.setdefault(fn, open(fn).read()),
+ self._ignore)
return Scss(scss_opts=opts, scss_files=files).compile()
return StylesheetGetter
class JavaScriptItems(ParamItems):
- def init(self):
+ def init(self, ignore=(), **kwargs):
self._items = {}
+ self._ignore = ignore
def _inputitem2dict(self, fn):
# jquery-ui-1.8.17.js -> jquery_ui_1_8_17, etc.
base = splitext(basename(fn))[0].replace('-', '_').replace('.', '_')
@@ -124,7 +131,8 @@ class JavaScriptItems(ParamItems):
self._items[base] = fn
def add(self, *inputitems):
for inputitem in inputitems:
- self.proceed(inputitem, None, '*.js', self._inputitem2dict)
+ self.proceed(inputitem, None, '*.js', self._inputitem2dict,
+ self._ignore)
def make_params(self, *javascript_dir):
destdir = join(*javascript_dir)
for key, item in self._items.iteritems():
@@ -137,8 +145,10 @@ class JavaScriptItems(ParamItems):
nonoptions(**{key: base}) # easy access to script within JS dir
# initiate input items with anything appropriate from devel dirs
-stylesheet_items = StylesheetItems(join(PACKAGE,PUBLIC,DEVEL_STYLESHEET_ROOT))
-javascript_items = JavaScriptItems(join(PACKAGE,PUBLIC,DEVEL_JAVASCRIPT_ROOT))
+stylesheet_items = StylesheetItems(join(PACKAGE,PUBLIC,DEVEL_STYLESHEET_ROOT),
+ ignore=IGNORE)
+javascript_items = JavaScriptItems(join(PACKAGE,PUBLIC,DEVEL_JAVASCRIPT_ROOT),
+ ignore=IGNORE)
# RequireJS + requisities (hardcoded as this is referrenced via metadata.py)
gen_file('requirejs',
11 years, 8 months
[sunzi/development] sync contrib/vim
by Jan Pokorný
commit b0137c2cb4651608cbefb8b28acf748c079cd3ff
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Thu Mar 8 14:22:16 2012 +0100
sync contrib/vim
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
contrib/vim | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/contrib/vim b/contrib/vim
index 42ab423..e6c75e9 160000
--- a/contrib/vim
+++ b/contrib/vim
@@ -1 +1 @@
-Subproject commit 42ab423312ed068f5fefb384fcaeb1a54cdc6ead
+Subproject commit e6c75e9e6ad332b4f4c781f7d50eefa121630143
11 years, 9 months
[sunzi/development] third-party/init.sh: minor cleanup
by Jan Pokorný
commit 38bd4256a1350250b37c853dbf77ee0cce330b1b
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Thu Mar 8 14:20:37 2012 +0100
third-party/init.sh: minor cleanup
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
third-party/init.sh | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/third-party/init.sh b/third-party/init.sh
index ad2dc44..3780389 100755
--- a/third-party/init.sh
+++ b/third-party/init.sh
@@ -42,7 +42,7 @@ do_del () {
}
do_announce () {
- # usage: see announce ($1, $3) + [$2 = colour (defaults to 32/green)]
+ # usage: see announce ($1, $3) + $2=colour
# use colours if available
if [ "$3" = "delimit" ] && $PRINTED; then
echo
@@ -50,11 +50,7 @@ do_announce () {
PRINTED=true
fi
if test -t 1; then
- colour=$2
- if [ -z "$colour" ]; then
- colour=$CLR_USR
- fi
- echo -en "\\033[${colour}m"
+ echo -en "\\033[${2}m"
echo -n "$1"
echo -e "\\033[0m"
else
@@ -106,8 +102,8 @@ init_register () {
}
init_announce () {
- # usage: $1=message to output [, $2 = start with extra newline if "delimit")]
- do_announce "$1" $CLR_OK $2
+ # usage: $1=message to output [, $2=start with extra newline if "delimit")]
+ do_announce "$1" $CLR_USR $2
}
init_verbosely () {
@@ -124,7 +120,7 @@ init_require () {
$tester $1 >/dev/null
ret=$?
[ $ret -eq 0 ] \
- && do_announce "require $1: checked ok" $CLR_OK \
+ && do_announce "require $1: checked ok" $CLR_INF \
|| do_announce "require $1: not met" $CLR_BAD
return $ret
}
@@ -163,7 +159,6 @@ init_git_submodule () {
# usage: $1=action ($1 passed from main), $2..$N=submodule(s)
# + optionally, if last arg is a function, it is used
# for hooking-in
- #local -f get_refresh_hook
get_refresh_hook () {
pushd "$(git rev-parse --show-toplevel)" >/dev/null
# TODO: --recursive seems to be buggy?
@@ -208,7 +203,6 @@ init_url_wget () {
fi
other_params="${@:3}"
- local -f get_refresh_hook
get_refresh_hook () {
wget --no-verbose --no-clobber --execute robots=off \
--directory-prefix "$toplevel" "$other_params" 2>&1
@@ -234,7 +228,6 @@ init_svn () {
rev="--revision $4"
fi
- local -f get_refresh_hook
get_refresh_hook () {
svn checkout --force $rev "$svn" "$toplevel" | grep "revision"
}
11 years, 9 months
[sunzi/development] third-party/init.sh: no extra deletion exit code handling
by Jan Pokorný
commit 64db5f44c29802ba99cf4cacf76b10a157a5cc05
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Thu Mar 8 11:20:32 2012 +0100
third-party/init.sh: no extra deletion exit code handling
such craziness should never have been introduced
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
third-party/init.sh | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/third-party/init.sh b/third-party/init.sh
index eabddf2..ad2dc44 100755
--- a/third-party/init.sh
+++ b/third-party/init.sh
@@ -5,7 +5,6 @@
# NOTE: this is always to be run from within git repo so things like
# "git rev-parse" will work (see do_git_submodule)
# NOTE: really stupid, no timestamping logic and similar fancy stuff
-# TODO: remove RET_DEL etc., deletion should be isolated now?
# TODO: new action "ahead" to check new versions (tags in git, etc.)
#
@@ -19,8 +18,6 @@ CLR_WRN=33
CLR_INF=35
CLR_CMD=34
-RET_DEL=64
-
PRINTED=false
GIT_PREFIX=$(git rev-parse --show-prefix)
@@ -32,7 +29,7 @@ check_nargs () {
}
check_ret () {
- [ $1 -ne 0 -a $1 -ne $RET_DEL ] \
+ [ $1 -ne 0 ] \
&& do_announce "action failed with exit status $1" $CLR_BAD
return $1
}
@@ -42,7 +39,6 @@ do_del () {
do_announce "has to be confirmed (y)..." $CLR_INF
rm -rfI -- "$@" 2>/dev/null
[ $? -eq 0 ] || do_announce "something to be deleted not present" $CLR_WRN
- return $RET_DEL
}
do_announce () {
@@ -196,7 +192,7 @@ init_git_submodule () {
do_announce "$1 $submodule (git submodule)" $CLR_SCR delimit
do_action $1 "$submodule" get_refresh_hook $arg_last
ret=$?
- [ $ret -ne 0 ] && [ $ret -ne $RET_DEL ] && break
+ [ $ret -ne 0 ] && break
done
check_ret $ret
}
@@ -309,7 +305,7 @@ main () {
$CHOICES)
$1 $action
ret=\$?
- [ \$ret -ne 0 -a \$ret -ne $RET_DEL ] && return \$ret
+ [ \$ret -ne 0 ] && return \$ret
shift
continue;;
all)
11 years, 9 months