Opened 10 years ago

Closed 4 years ago

#12108 closed Patch - Feature (Unverified)

Gentoo live ebuilds checkout to branch-master

Reported by: jflatt@… Owned by:
Priority: minor Milestone: unknown
Component: MythTV - General Version: Master Head
Severity: low Keywords:
Cc: Ticket locked: no

Description

I noticed with my own homemade gentoo live ebuilds, I wasn't getting theme info. When gentoo builds mythtv via git, it creates a new local branch:

Branch branch-master set up to track remote branch master from origin.
Switched to a new branch 'branch-master'

MythTV's version.sh script runs git branch --no-color during the build process, which writes version.h to include:

#define MYTHTV_SOURCE_PATH "branch-master"

When the themechooser.cpp loads it builds the download url by executing the code:

// Treat devel branches as master
if (MythVersion.startsWith("devel/"))
    MythVersion = "master";

// FIXME: For now, treat git master the same as svn trunk
if (MythVersion == "master")
    MythVersion = "trunk";

if (MythVersion != "trunk")
{
    MythVersion = MYTH_BINARY_VERSION; // Example: 0.25.20101017-1
    MythVersion.replace(QRegExp("\\.[0-9]{8,}.*"), "");
}

It falls through to the last 'if' statement. I believe it ends up trying to grab with a '0.28' in the url where it fails since 0.28 isn't released yet. I added a simple patch which adds branch-master, and tested it successfully:

diff --git a/mythtv/programs/mythfrontend/themechooser.cpp b/mythtv/programs/mythfrontend/themechooser.cpp
index 49bcafb..964f28e 100644
--- a/mythtv/programs/mythfrontend/themechooser.cpp
+++ b/mythtv/programs/mythfrontend/themechooser.cpp
@@ -159,7 +159,7 @@ void ThemeChooser::Load(void)
         MythVersion = "master";
 
     // FIXME: For now, treat git master the same as svn trunk
-    if (MythVersion == "master")
+    if (MythVersion == "master" || MythVersion == "branch-master")
         MythVersion = "trunk";
 
     if (MythVersion != "trunk")

This code is actually in two places in themechooser.cpp I couldn't find a way to specify in gentoo to not checkout a new branch. Hopefully this might help others with the same issue, I wouldn't expect this exact patch to be used

Change History (5)

comment:1 Changed 10 years ago by Raymond Wagner

Resolution: Won't Fix
Status: newclosed

If you're using a custom branch, your build scripts must provide the proper data to a VERSION file to get read by version.sh. See the official Gentoo ebuilds...

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-tv/mythtv/mythtv-0.27_p20140321.ebuild?view=markup#l151 https://code.mythtv.org/cgit/mythtv/tree/mythtv/version.sh#n33

comment:2 Changed 10 years ago by jflatt@…

A couple of things in version.sh:

# small shell script to generate version.cpp

This should be version.h, changed in 70a157f

GITTREEDIR=$1
GITREPOPATH="exported"

cd ${GITTREEDIR}

git status > /dev/null 2>&1
SOURCE_VERSION=$(git describe --dirty || git describe || echo Unknown)

case "${SOURCE_VERSION}" in
    exported|Unknown)
        if ! grep -q Format $GITTREEDIR/EXPORTED_VERSION; then
            . $GITTREEDIR/EXPORTED_VERSION
            BRANCH=$(echo "${BRANCH}" | sed 's/ (\(.*, \)\{0,1\}\(.*\))/\2/')
        elif test -e $GITTREEDIR/VERSION ; then
            . $GITTREEDIR/VERSION
        fi
    ;;
    *)
        if [ -z "${BRANCH}" ]; then
BRANCH=$(git branch --no-color | sed -e '/^[^\*]/d' -e 's/^\* //' -e 's/(no branch)/exported/')
        fi
    ;;
esac

GITREPOPATH doesn't look like it gets used anywhere, it can be deleted.

SOURCE_VERSION gets set to the output of git describe --dirty, in the case statement, it's checked for equality to 'exported'. I don't believe git ever outputs 'exported', that's a holdover from the subversion days, where 'exported' was a non-working svn directory.

Gentoo does return output from the first git describe --dirty, and will under most circumstances never fall through to set SOURCE_VERSION to 'Unknown'. Therefore, the first set of case statements never hits, and the contents of VERSION is never applied. The default case hits, and executes git branch --no-color.

I found the Gentoo git-2.eclass, around line 200 it sets its default checkout hard-coded to prefix 'branch-', so there's probably no easy way around that.

Can someone running the official 0.27 Gentoo ebuilds post the results of mythfrontend --version? I'd be very interested to see the output.

Maybe a more appropriate fix would be inside version.sh, toward the end, something like:

if [ "${BRANCH}" = "branch-master" ]; then
    BRANCH = "master"
fi

Thanks for checking this out

comment:3 Changed 10 years ago by jflatt@…

Resolution: Won't Fix
Status: closednew

Forgot to reopen

comment:4 Changed 7 years ago by Karl Dietz <dekarl@…>

comment:5 Changed 4 years ago by Stuart Auchterlonie

Resolution: Unverified
Status: newclosed

Closing all old tickets in trac.

If your issue still persists, please open an issue in Github https://github.com/MythTV/mythtv/issues

and reference the existing trac ticket.

Note: See TracTickets for help on using tickets.