Zac Medico [Sun, 8 May 2011 21:40:08 +0000 (14:40 -0700)]
Update timestamps in headers of modified files.
Zac Medico [Sun, 8 May 2011 21:31:11 +0000 (14:31 -0700)]
PreservedLibsRegistry: normalize counter as str
Zac Medico [Sun, 8 May 2011 20:46:40 +0000 (13:46 -0700)]
Add back cpv_exists check from previous commit.
Zac Medico [Sun, 8 May 2011 20:19:47 +0000 (13:19 -0700)]
Remove obsolete others_in_slot plibs code.
This code dates back to commit
79a2ade5a6cb5a6c2d7ace838a39a634265c5522
and the preserve-libs logic was different back then. At that time, the
dblink._preserve_libs() method would earlier register preserved libs
for the new package currently being merged, while the vardb entry was
still a -MERGING- node. Current code does not register preserve_paths
until later, so this others_in_slot code is obsolete.
Zac Medico [Sun, 8 May 2011 19:31:07 +0000 (12:31 -0700)]
treewalk: always initialize "needed"
Zac Medico [Sun, 8 May 2011 19:05:49 +0000 (12:05 -0700)]
merge_wait_queue: use deque.clear()
Zac Medico [Sun, 8 May 2011 18:24:40 +0000 (11:24 -0700)]
resume_depgraph: don't call break_refs in loop
The break_refs call was unnecessary and it broke the state of the
frozen_config instance, causing the following error:
File "pym/_emerge/depgraph.py", line 1290, in
_wrapped_add_pkg_dep_string
inst_pkgs = vardb.match_pkgs(atom)
AttributeError: 'vardbapi' object has no attribute 'match_pkgs'
Zac Medico [Sun, 8 May 2011 07:09:37 +0000 (00:09 -0700)]
linkmap: use exclude_pkgs for the registry too
David James [Sun, 8 May 2011 06:08:01 +0000 (23:08 -0700)]
Use new vardbapi lock function in FakeVartree.
BUG=none
TEST=Merged some packages with new code. Ran test suite.
Change-Id: Ibb9380122631bf6c79e39691233cfd641931b75a
Zac Medico [Sun, 8 May 2011 05:58:33 +0000 (22:58 -0700)]
Be careful with system pkgs + parallel-install.
This should prevent FEATURES=parallel-install from interfering with
the fixes from bug #256616 and bug #259954.
Zac Medico [Sun, 8 May 2011 02:57:29 +0000 (19:57 -0700)]
Add vardbapi reentrant lock/unlock methods.
Zac Medico [Sat, 7 May 2011 21:59:54 +0000 (14:59 -0700)]
doebuild: use EbuildBuildDir for locking
EbuildBuildDir also performs safe removal of the category when it is
empty, so ebuild.sh/dyn_clean doesn't need to do it anymore. This
fixes a race condition if one process is trying to remove the category
directory while another one is trying to create it for
PORTAGE_BUILDDIR.
Zac Medico [Sat, 7 May 2011 17:25:20 +0000 (10:25 -0700)]
PreserveLibsRegistry: add lock/unlock assertions
Also, add comments to store() about unobvious interaction with
locking due to atomic replacement of the inode.
Zac Medico [Sat, 7 May 2011 03:28:21 +0000 (20:28 -0700)]
Remove redundant pruneNonExisting() call.
Since commit
f36b9fa38b5268c2a5579db62acec026625f84a9, the
PreservedLibsRegistry automatically prunes itself each time
that it is loaded.
Zac Medico [Sat, 7 May 2011 03:02:50 +0000 (20:02 -0700)]
preserve-libs: fix linkmap logic for new plibs
Together with commit
f36b9fa38b5268c2a5579db62acec026625f84a9,
hopefully this solves bug #366061.
David James [Thu, 5 May 2011 21:08:27 +0000 (14:08 -0700)]
Cleanup preserved lib locking in portage.
This change makes preserved lib modification atomic, and
prepares us for narrowing the scope of the merge lock.
BUG=chromium-os:14983
TEST=Ran test suite and some example emerges.
Change-Id: I39abb6a5ec72be3274e508ef807ac1d9e69db1a8
Review URL: http://gerrit.chromium.org/gerrit/417
Zac Medico [Thu, 5 May 2011 17:21:43 +0000 (10:21 -0700)]
depgraph: simplify break_refs
Zac Medico [Thu, 5 May 2011 15:58:22 +0000 (08:58 -0700)]
emerge: fix misspell suggestion with category
A name collision in the "cp" variable caused it to malfunction.
Zac Medico [Thu, 5 May 2011 06:44:48 +0000 (23:44 -0700)]
repoman: make virtual.oldstyle a warning for now
This will give third-party repoman users some time to migrate their
repos away old-style virtuals.
Zac Medico [Wed, 4 May 2011 20:10:10 +0000 (13:10 -0700)]
Update timestamps in headers of modified files.
Zac Medico [Wed, 4 May 2011 16:36:29 +0000 (09:36 -0700)]
doins: add reference to bug #239529
The reasoning for the code from commit
55b3150af635a418ba3f1424132359c894db7ec4 is not really obvious, so
it's helpful to reference the corresponding bug report.
Mike Gilbert [Wed, 4 May 2011 03:28:21 +0000 (23:28 -0400)]
Fix Manifest.updateAllHashes()
Zac Medico [Tue, 3 May 2011 03:00:54 +0000 (20:00 -0700)]
cpv_expand: avoid old-style virtual code
This allows portageq calls to avoid loading vdb_metadata.pickle in
most cases, which greatly improves performance.
Arfrever Frehtes Taifersar Arahesis [Mon, 2 May 2011 20:17:15 +0000 (22:17 +0200)]
Avoid evaluation of values of variables in set_unless_changed().
Zac Medico [Mon, 2 May 2011 19:54:54 +0000 (12:54 -0700)]
emerge: skip misspell suggestion if cp exists
Zac Medico [Mon, 2 May 2011 19:34:21 +0000 (12:34 -0700)]
depgraph: autounmask account for optional deps
Zac Medico [Mon, 2 May 2011 17:56:51 +0000 (10:56 -0700)]
ebuild.sh: make INHERITED independent of phase
When EBUILD_PHASE != depend, INHERITED comes pre-initialized
from cache. In order to make INHERITED content independent of
EBUILD_PHASE during inherit() calls, we unset INHERITED after
we make a backup copy for QA checks.
Zac Medico [Mon, 2 May 2011 01:42:32 +0000 (18:42 -0700)]
depgraph: account for new-style virtual/libc
This will fix bug #364681.
Zac Medico [Sun, 1 May 2011 16:30:36 +0000 (09:30 -0700)]
repoman: remove most old-style virtual checks
PROVIDE virtuals have been banned from Gentoo's tree (see bug #365505),
so these checks aren't needed anymore. The PROVIDE.syntax check is kept
in the Package class since PROVIDE is still supported for backward
compatibility, and therefore invalid syntax can still have negative
effects. This check can be removed if/when backward compatibilty is
completely dropped.
Ulrich Mueller [Sun, 1 May 2011 15:57:33 +0000 (08:57 -0700)]
repoman: Check for PROVIDE.
This will fix bug #365505.
Arfrever Frehtes Taifersar Arahesis [Sun, 1 May 2011 14:50:30 +0000 (16:50 +0200)]
Support multiple arguments in set_unless_changed() and unset_unless_changed().
Use VARIABLE=VALUE syntax for arguments of set_unless_changed().
Zac Medico [Sun, 1 May 2011 14:18:42 +0000 (07:18 -0700)]
runtests.sh: propagate arguments to runTests
Arfrever Frehtes Taifersar Arahesis [Sun, 1 May 2011 01:21:57 +0000 (03:21 +0200)]
Bug #365439: Add set_unless_changed() and unset_unless_changed().
Zac Medico [Sat, 30 Apr 2011 20:38:00 +0000 (13:38 -0700)]
depgraph: migrate implicit libc deps from Sched
Now all the virtual/libc handling is done by the depgraph, which
will be helpful when fixing bug #364681.
Arfrever Frehtes Taifersar Arahesis [Sat, 30 Apr 2011 16:30:29 +0000 (18:30 +0200)]
install_qa_check(): Simplify code and make 'l' a local variable.
David James [Sat, 30 Apr 2011 00:21:58 +0000 (17:21 -0700)]
Check for references to ${ROOT} in install_qa_checks.
When ROOT != /, binaries that reference ROOT will load their
dependencies from ROOT first rather than from the system-configured
path. This is a problem because the ROOT will be / on the target
system.
Besides the above, this patch also fixes incorrect parsing of scanelf
output, where we would treat the RPATHs returned by scanelf as the
names of binaries.
TEST=When "stricter" FEATURE is enabled, verify that emerge
fails when an ebuild references broken rpaths referencing
ROOT. When "stricter" FEATURE is not enabled, verify that such
references are automatically fixed. Also verify that ebuilds
with non-broken RPATHs (e.g. RPATHs referencing $ORIGIN/../lib)
are not touched by the change.
BUG=chromium-os:14271
Change-Id: I4f29cc4ea9195a1255f080284da1f676e4a2c26b
Review URL: http://codereview.chromium.org/
6903153
Zac Medico [Fri, 29 Apr 2011 16:07:25 +0000 (09:07 -0700)]
emergelog: only set permission on creation
This will fix bug #365319.
Zac Medico [Fri, 29 Apr 2011 15:04:13 +0000 (08:04 -0700)]
action_info: eliminate duplicate info_pkgs match
Currently, sys-kernel/linux-headers is matched by both a plain
sys-kernel/linux-headers atom and by the virtual/os-headers new-style
virtual. For backward compatibility, we're going to have duplicates
like this for at least a few months (see bug #364673, comment #5).
Therefore, automatically eliminate duplicates in the display. Entries
that include virtual provider info are preferred over those that do
not.
Zac Medico [Thu, 28 Apr 2011 21:31:03 +0000 (14:31 -0700)]
_postinst_bsdflags: apply to $ROOT, not $D
David James [Thu, 28 Apr 2011 21:22:15 +0000 (14:22 -0700)]
Move preinst/postinst_bsdflags from bash to py
Moving these commands from shell to Python helps avoid an unnecessary
call to misc-functions.sh for the postinst_bsdflags. This improves
performance.
BUG=none
TEST=Run emerge-x86-generic -eg --jobs=16 libchrome
Change-Id: I0c2af50b4d2f7644cabac84fde7fe4d682010c69
Review URL: http://codereview.chromium.org/
6676107
Zac Medico [Thu, 28 Apr 2011 21:07:08 +0000 (14:07 -0700)]
display_preserved_libs: load plib_registry
Since commit
7535cabdf2fab76fc55df83643157613dfd66be9, the
plib_registry is modified in a subprocess, and the parent
process' copy can become stale because of this. Therefore,
explicitly load it.
Zac Medico [Thu, 28 Apr 2011 16:10:02 +0000 (09:10 -0700)]
emerge: add --misspell-suggestions=n option
This will fix bug #363137.
Zac Medico [Thu, 28 Apr 2011 12:58:35 +0000 (05:58 -0700)]
emerge: fix indent for --binpkg-respect-use help
Sebastian Luther [Wed, 27 Apr 2011 20:36:15 +0000 (13:36 -0700)]
--autounmask: Don't change masked/forced flags
This will fix bug #364701.
Zac Medico [Wed, 27 Apr 2011 16:13:51 +0000 (09:13 -0700)]
expand_new_virt: don't traverse blockers
Zac Medico [Wed, 27 Apr 2011 14:35:57 +0000 (07:35 -0700)]
expand_new_virt: validate EAPI, IUSE and USE
Zac Medico [Wed, 27 Apr 2011 14:05:24 +0000 (07:05 -0700)]
expand_new_virt: eliminate cpv_getkey
Zac Medico [Tue, 26 Apr 2011 23:57:20 +0000 (16:57 -0700)]
expand_new_virt: use stack for recursion
Ryan Hill [Tue, 26 Apr 2011 21:16:20 +0000 (14:16 -0700)]
Bug #364467 - handle gcc-4.6-style QA warnings
Arfrever Frehtes Taifersar Arahesis [Tue, 26 Apr 2011 20:50:03 +0000 (22:50 +0200)]
Fix a typo.
Zac Medico [Tue, 26 Apr 2011 20:19:34 +0000 (13:19 -0700)]
emerge --info: support new-style virtuals
This will fix bug #364673.
Zac Medico [Sat, 23 Apr 2011 15:41:07 +0000 (08:41 -0700)]
ebuild(1): fix env FEATURES overrides bug #364035
Tomas Chvatal [Wed, 20 Apr 2011 23:56:06 +0000 (16:56 -0700)]
repoman: deprecate more eclasses
Zac Medico [Thu, 14 Apr 2011 01:54:30 +0000 (18:54 -0700)]
repoman: cleanup gpgsign
Zac Medico [Wed, 13 Apr 2011 07:59:38 +0000 (00:59 -0700)]
Update timestamps in headers of modified files.
Zac Medico [Tue, 12 Apr 2011 01:09:20 +0000 (18:09 -0700)]
doins: tweak $DISTDIR symlink handling
Only match stuff inside $PORTAGE_ACTUAL_DISTDIR/ so that we don't
stray from PMS.
Zac Medico [Mon, 11 Apr 2011 23:23:54 +0000 (16:23 -0700)]
doins: dereference abs symlinks to files
Our fake $DISTDIR contains symlinks that should not be reproduced
inside $D. In order to ensure that things like dodoc
"$DISTDIR"/foo.pdf work as expected, we dereference symlinked files
that are referenced by absolute paths. Thanks to James Cloos
<cloos@jhcloos.com> for reporting this issue which he observed with
the sci-mathematics/minisat ebuild.
Zac Medico [Mon, 11 Apr 2011 23:00:02 +0000 (16:00 -0700)]
extract_affecting_use: test bug #363073
Zac Medico [Mon, 11 Apr 2011 22:30:13 +0000 (15:30 -0700)]
extract_affecting_use: allow parens in atoms
This fixes bug #363073 in which an InvalidDependString exception is
erroneously triggered by atoms containing EAPI 4 USE dependency
defaults. This case is very similar to bug #354003 which was fixed in
commit
8735222b77e66850213e2aa6a7ea48e744ba0d4f.
David James [Mon, 11 Apr 2011 19:00:39 +0000 (12:00 -0700)]
Remove unnecessary sync in Scheduler.py.
If we are passed a fakevartree object, it should already be sync'd, so
there is no need to sync it again here. This sync is only needed when
we create a new FakeVartree, so I moved the sync to the right place to
fix this.
BUG=chromium-os:14035
TEST=Build a bunch of packages with this patch.
Change-Id: I89d79cf946f4c0c27ad585ad7c88a41985260342
Review URL: http://codereview.chromium.org/
6813084
Zac Medico [Sun, 10 Apr 2011 20:05:45 +0000 (13:05 -0700)]
Fix a typo in a comment.
Zac Medico [Sun, 10 Apr 2011 20:03:11 +0000 (13:03 -0700)]
Scheduler: add more info in docstring comments
This clarifies the purposes of _system_merge_started and _choose_pkg.
David James [Thu, 7 Apr 2011 23:49:58 +0000 (16:49 -0700)]
Add force-mirror FEATURE.
force-mirror: Only fetch files from configured mirrors, ignoring
SRC_URI, except when mirror is in the ebuild(5) RESTRICT variable.
BUG=chromium-os:13221
TEST=Test that ebuilds now fail with FEATURES=force-mirror if files are
not in the configured mirror.
Change-Id: I8484d5af8dff97b431398030b33c024ff1295ba0
Review URL: http://codereview.chromium.org/
6677171
Zac Medico [Mon, 4 Apr 2011 22:03:01 +0000 (15:03 -0700)]
filter PORTAGE_GPG_SIGNING_COMMAND for ebuild env
Arfrever Frehtes Taifersar Arahesis [Sun, 3 Apr 2011 17:28:58 +0000 (19:28 +0200)]
Support PORTAGE_GPG_SIGNING_COMMAND variable.
Zac Medico [Sun, 3 Apr 2011 15:54:10 +0000 (08:54 -0700)]
repoman: fix profiles.desc overlay path
Thanks to Alexey Shvetsov <alexxy@gentoo.org> for reporting this issue
and testing the fix.
Zac Medico [Thu, 31 Mar 2011 15:41:52 +0000 (08:41 -0700)]
Display: fix fetch restrict msg for RO_DISTDIRS
This will fix bug #361463.
Arfrever Frehtes Taifersar Arahesis [Wed, 30 Mar 2011 22:19:54 +0000 (00:19 +0200)]
Minor improvements in gpgsign().
repoman_settings["PORTAGE_GPG_DIR"] is always set.
Arfrever Frehtes Taifersar Arahesis [Wed, 30 Mar 2011 20:32:45 +0000 (22:32 +0200)]
Simplify calculation of repoman_settings["PORTAGE_GPG_DIR"] in gpgsign().
os.path.expanduser() works even when HOME environment variable is not set.
Zac Medico [Wed, 30 Mar 2011 18:36:35 +0000 (11:36 -0700)]
chk_updated_info_files: handle --quiet
This will fix bug #361257.
Arfrever Frehtes Taifersar Arahesis [Wed, 30 Mar 2011 15:03:22 +0000 (17:03 +0200)]
Use os.path.expanduser() to simplify code.
Zac Medico [Sun, 27 Mar 2011 20:57:35 +0000 (13:57 -0700)]
unmerge: fix lock/UnsupportedAPIException logic
Zac Medico [Sun, 27 Mar 2011 20:55:11 +0000 (13:55 -0700)]
UnsupportedAPIException: handle unicode in EAPI
Normally EAPI doesn't contain unicode, but as in bug #359675, it can
contain practically anything if files in /var/db/pkg are corrupt.
Zac Medico [Sun, 27 Mar 2011 20:01:10 +0000 (13:01 -0700)]
emerge-webrsync: drop lzma support
The lzma snapshots have been replaced by xz snapshots, as discussed in
the "RFC: Remove .lzma in favor of .xz portage snapshots" thread on the
gentoo-dev ml:
http://archives.gentoo.org/gentoo-dev/msg_7de1b57ce531fdf33d33b5b070006436.xml
Zac Medico [Sat, 26 Mar 2011 19:36:37 +0000 (12:36 -0700)]
Update header timestamps for modified files.
Zac Medico [Sat, 26 Mar 2011 17:10:24 +0000 (10:10 -0700)]
Scheduler: pkg_to_replace beware old-style virt
Zac Medico [Sat, 26 Mar 2011 16:12:38 +0000 (09:12 -0700)]
BlockerDB: add SLOT match in discardBlocker
Zac Medico [Sat, 26 Mar 2011 08:52:49 +0000 (01:52 -0700)]
MergeListItem: inherit _poll and _wait
Zac Medico [Sat, 26 Mar 2011 07:38:23 +0000 (00:38 -0700)]
unmerge: fix PORTAGE_BACKGROUND logic
Zac Medico [Sat, 26 Mar 2011 01:44:46 +0000 (18:44 -0700)]
config: blacklist PORTAGE_BACKGROUND* vars
David James [Fri, 25 Mar 2011 17:10:54 +0000 (10:10 -0700)]
env_update: remove sleep_for_mtime_granularity
Instead of sleeping, use os.utime to avoid mtime ambiguity.
Change-Id: I359ececca19b6be9f5997ac5c8fe6fea6ea49dd5
Review URL: http://codereview.chromium.org/
6676150
Zac Medico [Fri, 25 Mar 2011 16:52:40 +0000 (09:52 -0700)]
PollScheduler: tweak _unregister event cleanup
Zac Medico [Fri, 25 Mar 2011 15:57:10 +0000 (08:57 -0700)]
PollScheduler: handle missing log directory
This can be triggered by AbstractPollTask._log_poll_exception(), as
reported by Michael Haubenwallner <haubi@gentoo.org> for AIX.
David James [Fri, 25 Mar 2011 01:14:45 +0000 (18:14 -0700)]
Update Portage to sync BlockerDB at init.
Currently, Portage syncs the BlockerDB before every merge. This slows
down merges considerably because it requires reading the entire vardb
from disk. Since Portage doesn't merge conflicting packages anyway, we
can optimize this by just reading the vardb at initialization and
caching that.
Change-Id: I6701926f022ef3aa2da10482fc8b09573ae24610
Review URL: http://codereview.chromium.org/
6688037
Zac Medico [Thu, 24 Mar 2011 18:15:47 +0000 (11:15 -0700)]
emerge: support [ y | n ] for --ask
This allows --ask to be enabled via EMERGE_DEFAULT_OPTS, and then
temporarily disabled via the command-line. This may be useful for
programs that call emerge non-interactively, as in bug #360233.
David James [Thu, 24 Mar 2011 05:05:15 +0000 (22:05 -0700)]
Optimize ebuild.sh to cache preprocessing output.
Right now ebuild.sh runs preprocessing steps multiple times during the
same build. It processes the same environment and produces the same
output every time. This slows down the build unnecessarily.
This optimization cuts build time for 50 binary packages with 16 jobs
from 3m22 to 2m33 (33%).
Change-Id: I72ac84cce2eb60d17736cc5f5343d4a858ec86f4
Review URL: http://codereview.chromium.org/
6733008
Zac Medico [Thu, 24 Mar 2011 04:08:35 +0000 (21:08 -0700)]
get_dep_chain: handle InvalidDependString
Zac Medico [Mon, 21 Mar 2011 00:11:14 +0000 (17:11 -0700)]
chk_updated_cfg_files: fix whitespace in message
Thanks to Dennis Schridde in bug #359681.
Zac Medico [Sun, 20 Mar 2011 17:41:24 +0000 (10:41 -0700)]
portageq owners: list orphans via stderr
Zac Medico [Sun, 20 Mar 2011 15:57:42 +0000 (08:57 -0700)]
emerge_main: add "args" parameter (sys.argv[1:])
Also, fix local portage.debug import so that "global portage" is
not necessary.
Zac Medico [Fri, 18 Mar 2011 23:45:47 +0000 (16:45 -0700)]
TaskSequence: also call CompositeTask._cancel()
This is a regression from commit
363a7478a100495d2e8597bc6c6d2fdac94339e0 but it's usually not
noticeable with Ctrl-C since SIGINT is propagated to nested processes.
Zac Medico [Fri, 18 Mar 2011 21:44:05 +0000 (14:44 -0700)]
Update timestamps in headers of modified files.
Zac Medico [Fri, 18 Mar 2011 21:05:07 +0000 (14:05 -0700)]
CompositeTask: fix _wait for TASK_QUEUED
Though this case might never have been triggered, the logic was broken
for cases in which self.cancelled was false and a task was queued. In
this case we need to call back into the scheduler until the queued task
is started or we are cancelled, whichever comes first.
Zac Medico [Thu, 17 Mar 2011 21:52:41 +0000 (14:52 -0700)]
ebuild-ipc: import errno
Zac Medico [Thu, 17 Mar 2011 21:39:53 +0000 (14:39 -0700)]
EbuildIpcDaemon: use non-blocking write
This prevents the Scheduler from hanging if the client is killed before
we can send the reply, as reported by David James:
http://codereview.chromium.org/
6713003
This commit depends on ebuild-ipc (the client) opening the other side
of this fifo before it sends its request, which has already been added
in commit
eff879ff0ce7dcc1ce68d5f16de1ec73051f8c18.
Zac Medico [Thu, 17 Mar 2011 21:12:13 +0000 (14:12 -0700)]
ebuild-ipc: use non-blocking read
This makes it possible for the daemon to send a reply without blocking,
thereby improving performance and also making it possible for the
daemon to do a non-blocking write without a race condition.
This reverts part of commit
81fc303212b8379219cf5d463c8717359b972dba,
which probably didn't help portability anyway. Now, ebuild-ipc is using
non-blocking read with os.read and EAGAIN handling, just like
EbuildIpcDaemon since commit
7e5b81da12dd7bd59f6620840dc0d824e3f4d69a
(known compatible with FreeBSD).
Zac Medico [Thu, 17 Mar 2011 20:08:35 +0000 (13:08 -0700)]
AsynchronousLock: implement _cancel
Zac Medico [Thu, 17 Mar 2011 19:01:57 +0000 (12:01 -0700)]
make.conf.5: fix "direcory" spelling
Thanks to Francesco Turco in bug #359273.
Zac Medico [Thu, 17 Mar 2011 18:39:28 +0000 (11:39 -0700)]
dep_check: return errors as unicode
This should prevent the following error due to returning raw bytes,
reported in forum thread #869281:
File "pym/_emerge/BlockerDB.py", line 72, in findInstalledBlockers
portage.writemsg("!!! %s/*DEPEND: %s\n" % \
(pkg_location, atoms), noiselevel=-1)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in
position 23: ordinal not in range(128)
Zac Medico [Thu, 17 Mar 2011 05:36:33 +0000 (22:36 -0700)]
AsynchronousTask: add _cancel template method