From: Fabian Groffen Date: Tue, 5 Jan 2010 19:23:45 +0000 (-0000) Subject: Merged from trunk -r15154:15166 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=b4c8f02bf38a2c112b374539b54c9dc0188edb35;p=portage.git Merged from trunk -r15154:15166 | 15155 | Add some tests related to bug #287848. | | zmedico | | | 15156 | Use get_term_size() to adjust to current terminal width. | | zmedico | Thanks to Dror Levin for the initial patch. | | 15157 | Document doins -r option. | | zmedico | | | 15158 | Bug #299248 - Fix doins return code handling to make sure it | | zmedico | always fails when appropriate. Thanks to Jonathan Callen | | | for the initial patch. | | 15159 | Bug #298310 - Make sure the _selinux attribute is correctly | | zmedico | reinitialized after reload(portage) is called. | | 15160 | Add test cases for implicit .0 at end of version. | | zmedico | | | 15161 | Revert vercmp() behavior so 12.2b > 12.2.5 which was | | zmedico | accidentally changed in r2309 (between portage-2.0.x and | | | portage-2.1). Thanks to Brian Harring for reporting in bug | | | #287848, comment #3. | | 15162 | Fix vercmp so 1b > 1 and add corresponding tests. | | zmedico | | | 15163 | Add test cases for cvs versions. | | zmedico | | | 15164 | Add some more cases for versions with letter suffixes. | | zmedico | | | 15165 | More cases. | | zmedico | | | 15166 | Revert r15161 so 12.2.5 is greater than 12.2b once again. | | zmedico | Depending on how you look at, it may seem counter-intuitive. | | | However, if you really think about it, it seems like it's | | | probably safe to assume that 12.2.5 > 12.2b is the behavior | | | that is intended by anyone who would use versions such as | | | these. | svn path=/main/branches/prefix/; revision=15170 --- diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins index d4a277aa6..3eb598a74 100755 --- a/bin/ebuild-helpers/doins +++ b/bin/ebuild-helpers/doins @@ -71,12 +71,20 @@ _doins() { } _xdoins() { + local -i success=0 failed=0 while read -d $'\0' x ; do _doins "$x" "${x%/*}" + if [[ $? -eq 0 ]] ; then + ((success|=1)) + else + ((failed|=1)) + fi done + [[ $failed -ne 0 || $success -eq 0 ]] && return 1 || return 0 } success=0 +failed=0 for x in "$@" ; do if [[ $PRESERVE_SYMLINKS = n && -d $x ]] || \ @@ -108,15 +116,24 @@ for x in "$@" ; do fi find "$x_orig" -type d -exec dodir "${INSDESTTREE}/{}" \; find "$x_orig" \( -type f -or -type l \) -print0 | _xdoins + if [[ ${PIPESTATUS[1]} -eq 0 ]] ; then + ((success|=1)) + else + ((failed|=1)) + fi if [[ $x != $x_orig ]] ; then popd >/dev/null mv "$TMP/1/$x_orig" "$x" fi while popd >/dev/null 2>&1 ; do true ; done - ((success|=1)) else - _doins "${x}" && ((success|=1)) + _doins "${x}" + if [[ $? -eq 0 ]] ; then + ((success|=1)) + else + ((failed|=1)) + fi fi done rm -rf "$TMP" -[ $success -gt 0 ] && exit 0 || exit 1 +[[ $failed -ne 0 || $success -eq 0 ]] && exit 1 || exit 0 diff --git a/man/ebuild.5 b/man/ebuild.5 index b3521e222..fcf8e3e4a 100644 --- a/man/ebuild.5 +++ b/man/ebuild.5 @@ -1017,9 +1017,10 @@ The default path is /. Can be used to define options for the install function used in \fBdoins\fR. The default is \fI\-m0644\fR. .TP -\fBdoins\fR \fI [list of more files]\fR +\fBdoins\fR \fI[-r] [list of more files]\fR Installs files into the path controlled by \fBinsinto\fR. This function uses \fBinstall\fR(1). Creates all necessary dirs. +Setting -r sets recursive. .TP \fBexeinto\fR \fI[path]\fR Sets the destination path for the \fBdoexe\fR function. diff --git a/pym/_emerge/JobStatusDisplay.py b/pym/_emerge/JobStatusDisplay.py index cfc0bfa91..dfc766d26 100644 --- a/pym/_emerge/JobStatusDisplay.py +++ b/pym/_emerge/JobStatusDisplay.py @@ -22,7 +22,6 @@ if sys.hexversion >= 0x3000000: class JobStatusDisplay(object): _bound_properties = ("curval", "failed", "running") - _jobs_column_width = 48 # Don't update the display unless at least this much # time has passed, in units of seconds. @@ -48,7 +47,12 @@ class JobStatusDisplay(object): object.__setattr__(self, "_changed", False) object.__setattr__(self, "_displayed", False) object.__setattr__(self, "_last_display_time", 0) - object.__setattr__(self, "width", 80) + + width = portage.output.get_term_size()[1] + if width <= 0 or width > 80: + width = 80 + object.__setattr__(self, "width", width) + object.__setattr__(self, "_jobs_column_width", width - 32) self.reset() isatty = hasattr(self.out, "isatty") and self.out.isatty() diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index b4a9c31ff..aa499cba3 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -294,6 +294,9 @@ selinux = None _selinux_merge = None try: import portage._selinux + # Make sure the _selinux attribute is correctly reinitialized after + # reload(portage) is called. See bug #298310. + _selinux = sys.modules['portage._selinux'] selinux = _unicode_module_wrapper(_selinux, encoding=_encodings['fs']) _selinux_merge = _unicode_module_wrapper(_selinux, diff --git a/pym/portage/tests/versions/test_vercmp.py b/pym/portage/tests/versions/test_vercmp.py index 2d57236e1..eb2ba3eb0 100644 --- a/pym/portage/tests/versions/test_vercmp.py +++ b/pym/portage/tests/versions/test_vercmp.py @@ -15,7 +15,15 @@ class VerCmpTestCase(TestCase): tests = [ ( "6.0", "5.0"), ("5.0","5"), ("1.0-r1", "1.0-r0"), ("1.0-r1", "1.0"), - ("999999999999999999999999999999", "999999999999999999999999999998"),] + ("cvs.9999", "9999"), + ("999999999999999999999999999999", "999999999999999999999999999998"), + ("1.0.0", "1.0"), + ("1.0.0", "1.0b"), + ("1b", "1"), + ("1b_p1", "1_p1"), + ("1.1b", "1.1"), + ("12.2.5", "12.2b"), + ] for test in tests: self.failIf( vercmp( test[0], test[1] ) <= 0, msg="%s < %s? Wrong!" % (test[0],test[1]) ) @@ -27,10 +35,18 @@ class VerCmpTestCase(TestCase): ("1.0_alpha2", "1.0_p2"),("1.0_alpha1", "1.0_beta1"),("1.0_beta3","1.0_rc3"), ("1.001000000000000000001", "1.001000000000000000002"), ("1.00100000000", "1.0010000000000000001"), + ("9999", "cvs.9999"), ("999999999999999999999999999998", "999999999999999999999999999999"), ("1.01", "1.1"), ("1.0-r0", "1.0-r1"), - ("1.0", "1.0-r1")] + ("1.0", "1.0-r1"), + ("1.0", "1.0.0"), + ("1.0b", "1.0.0"), + ("1_p1", "1b_p1"), + ("1", "1b"), + ("1.1", "1.1b"), + ("12.2b", "12.2.5"), + ] for test in tests: self.failIf( vercmp( test[0], test[1]) >= 0, msg="%s > %s? Wrong!" % (test[0],test[1])) @@ -50,9 +66,16 @@ class VerCmpTestCase(TestCase): tests = [ ("1","2"),("1.0_alpha","1.0_pre"),("1.0_beta","1.0_alpha"), ("0", "0.0"), + ("cvs.9999", "9999"), ("1.0-r0", "1.0-r1"), ("1.0-r1", "1.0-r0"), ("1.0", "1.0-r1"), - ("1.0-r1", "1.0")] + ("1.0-r1", "1.0"), + ("1.0", "1.0.0"), + ("1_p1", "1b_p1"), + ("1b", "1"), + ("1.1b", "1.1"), + ("12.2b", "12.2"), + ] for test in tests: self.failIf( vercmp( test[0], test[1]) == 0, msg="%s == %s? Wrong!" % (test[0],test[1])) diff --git a/pym/portage/versions.py b/pym/portage/versions.py index a01c2ee2d..95f6fe899 100644 --- a/pym/portage/versions.py +++ b/pym/portage/versions.py @@ -101,9 +101,10 @@ def vercmp(ver1, ver2, silent=1): list2 = [int(match2.group(2))] # this part would greatly benefit from a fixed-length version pattern - if len(match1.group(3)) or len(match2.group(3)): + if match1.group(3) or match2.group(3): vlist1 = match1.group(3)[1:].split(".") vlist2 = match2.group(3)[1:].split(".") + for i in range(0, max(len(vlist1), len(vlist2))): # Implcit .0 is given a value of -1, so that 1.0.0 > 1.0, since it # would be ambiguous if two versions that aren't literally equal @@ -133,6 +134,11 @@ def vercmp(ver1, ver2, silent=1): list2.append(int(vlist2[i].ljust(max_len, "0"))) # and now the final letter + # NOTE: Behavior changed in r2309 (between portage-2.0.x and portage-2.1). + # The new behavior is 12.2.5 > 12.2b which, depending on how you look at, + # may seem counter-intuitive. However, if you really think about it, it + # seems like it's probably safe to assume that this is the behavior that + # is intended by anyone who would use versions such as these. if len(match1.group(5)): list1.append(ord(match1.group(5))) if len(match2.group(5)):