On Wed, Jun 29, 2016 at 04:23:50PM -0700, Eric Pruitt wrote:
> On Wed, Jun 29, 2016 at 01:54:13PM -0800, Britton Kerin wrote:
> > I'm not going to try to fix patches I don't use myself, it's possible
> > to screw up and testing is a hassle since it involves the wm.
> 
> I wonder what the odds are of a patch applying cleanly, compilation of
> of dwm succeeding but actually breaking dwm in the process. I'm thinking
> this could be automated by attempting to apply the patches to HEAD,
> renaming the ones that succeed and still allow dwm to build then doing
> "git reset --hard HEAD^" and repeating the process. Maybe stop at the
> dwm commit that comes before the oldest patch's commit date. Maybe
> something like this:
> 
>     while ...; do
>         git_version="$(git log -1 --format=%h)"
> 
>         for patch in *.diff; do
>             # Getting the name part might be a little tricky, but maybe
>             # it could be done by grepping for the patch path in the
>             # markdown files e.g.:
>             name="$(fgrep -m1 -l -w "$patch" *.md)"
>             name="${name%.md}"
> 
>             if patch < "$patch" && make dwm; then
>                 git mv "$patch" "dwm-$name-$git_version.diff"
>             fi
> 
>             make clean
>             git reset --hard
>         done
> 
>         git reset --hard HEAD^
>     done

Very cool, I made a similar script. Once all the patches follow the naming
convention it should be simple to automate this. The only thing I noticed on
the wiki is there are patches that depend on other patches. In my opinion a
patch should include all the neccesary things (no dependencies).

I'll fix the dmenu patches soon(tm) and maybe also take a stab at dwm.

My ugly script, I'm sure it can be written nicer:

        #!/bin/sh
        find "/home/hiltjo/tmp/sites/dwm.suckless.org/patches" -type f -iname 
"*.diff" | while read -r f; do
                make -j17 clean >/dev/null 2>/dev/null
                git checkout -f master >/dev/null 2>/dev/null
                cp ../config.mk .
                rm -f config.h *.rej *.orig
        
                n=$(basename $f)
        
                if patch -f -C -u -p1 < "$f" >/dev/null 2>/dev/null; then
                        # apply actual patch and run.
                        if patch -u -p1 < "$f" >/dev/null 2>/dev/null; then
                                echo "SUCCESS:       $n" >&2
                                if make -j17 >/dev/null 2>/dev/null; then
                                        echo "BUILD SUCCESS: $n"
                                else
                                        echo "BUILD FAIL:    $n"
                                fi
                        else
                                # NOTE: should never happen...
                                echo "PATCH APPLY FAILED: $n"
                                exit 1
                        fi
                else
                        echo "FAIL:          $n"
                fi
        done

-- 
Kind regards,
Hiltjo

Reply via email to