On Monday, January 24, 2022 at 2:35:54 AM UTC+9 Matthias Koeppe wrote:

> Patchbot experts:
> 1) Currently the patchbot does not run on certain tickets that make 
> changes to build/pkgs, so we do not have automatic testing for these 
> tickets. Is this something that can be changed? 
>

I think this is related with "safe_only" concept of sage patchbot. Patchbot 
only runs on "safe" tickets by default. If I remember correctly, a ticket 
that makes changes out of sage library is considered "unsafe".

If a ticket is unsafe, then patchbot uses "ccache" by default. If I again 
remember correctly, this "ccache" also caused some problem. I remember I 
tried to turn off "ccache" to fix that.

The following is the relevant part of "sage_patchbot/trac.py". 
-----------------------------------------------
def pull_from_trac(sage_root, ticket_id, branch=None, force=None,
                   use_ccache=False,
                   safe_only=False):
    """
    Create four branches from base and ticket.

    If ticket deemed unsafe then clone git repo to temp directory. ?!

    Additionally, if ``use_ccache`` then install ccache. Set some global
    and environment variables.

    There are four branches at play here:

    - patchbot/base -- the latest release that all tickets are merged into
      for testing
    - patchbot/base_upstream -- temporary staging area for patchbot/base
    - patchbot/ticket_upstream -- pristine clone of the ticket on trac
    - patchbot/ticket_merged -- merge of patchbot/ticket_upstream into
      patchbot/base
    """
    merge_failure = False
    is_safe = False
    temp_dir = None
    try:
        os.chdir(sage_root)
        info = scrape(ticket_id)
        ensure_free_space(sage_root)
        do_or_die("git checkout patchbot/base")
        if ticket_id == 0:
            do_or_die("git branch -f patchbot/ticket_upstream 
patchbot/base")
            do_or_die("git branch -f patchbot/ticket_merged patchbot/base")
            return
        branch = info['git_branch']
        repo = info['git_repo']
        do_or_die("git fetch %s +%s:patchbot/ticket_upstream" % (repo, 
branch))
        base = describe_branch('patchbot/ticket_upstream', tag_only=True)
        do_or_die("git rev-list --left-right --count 
%s..patchbot/ticket_upstream" % base)
        do_or_die("git branch -f patchbot/ticket_merged patchbot/base")
        do_or_die("git checkout patchbot/ticket_merged")
        try:
            do_or_die("git merge -X patience patchbot/ticket_upstream")
        except Exception:
            do_or_die("git merge --abort")
            merge_failure = True
            raise

        is_safe = inplace_safe()
        if not is_safe:
            if safe_only:
                raise SkipTicket("unsafe")
            # create temporary dir
            temp_dir = tempfile.mkdtemp(temp_build_suffix + str(ticket_id))
            ensure_free_space(temp_dir)
            do_or_die("git clone . '{}'".format(temp_dir))
            os.chdir(temp_dir)
            os.symlink(os.path.join(sage_root, "upstream"), "upstream")
            os.environ['SAGE_ROOT'] = temp_dir
            do_or_die("git branch -f patchbot/base 
remotes/origin/patchbot/base")
            do_or_die("git branch -f patchbot/ticket_upstream 
remotes/origin/patchbot/ticket_upstream")
            do_or_die("make configure")
            do_or_die("./configure")
            if use_ccache:
                if not os.path.exists('logs'):
                    os.mkdir('logs')
                do_or_die("./sage -i ccache")
    except Exception as exn:
        if not is_safe and not safe_only:
            if temp_dir and os.path.exists(temp_dir):
                # Reset to the original sage_root
                os.chdir(sage_root)
                os.environ['SAGE_ROOT'] = sage_root
                shutil.rmtree(temp_dir)  # delete temporary dir

        if merge_failure or (not is_safe):
            raise
        else:
            raise ConfigException(str(exn)) 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/b0446484-b0bc-4cc5-866f-41e9846cdd52n%40googlegroups.com.

Reply via email to