Re: [gentoo-dev] git-r3: initial draft for review [v2]

2013-09-03 Thread Walter Dnes
On Mon, Sep 02, 2013 at 01:33:19PM +0200, Micha?? Górny wrote
 Dnia 2013-09-01, o godz. 16:49:34
 William Hubbs willi...@gentoo.org napisa??(a):
 
  Please don't. I also do not want escape sequences in log files.
 
 Ok, '--color' removed. However, I think we should work something out to
 get both parties satisfied. Maybe portage feature or a tool to 'uncruft'
 logs from escape sequences since many people actually benefit from them.

  As per my bug https://bugs.gentoo.org/show_bug.cgi?id=463954 it is a
pain.  Try figuring out the following as viewed in mc (Midnight
Commander)...

 WARN: prepare
 It seems that you need to set USE_PYTHON to make sure that legacy
 packages will be built with respect to PYTHON_TARGETS correctly:

 USE_PYTHON='.[35;1m2.7.[0m'

  Note that...

grep foo bar.txt

...returns colour-highlighted text, while...

grep foo bar.txt  output.txt

...returns plain text.  So it can be done properly for everybody.

-- 
Walter Dnes waltd...@waltdnes.org
I don't run desktop environments; I run useful applications



Re: [gentoo-dev] git-r3: initial draft for review [v2]

2013-09-02 Thread Michał Górny
Dnia 2013-09-01, o godz. 16:49:34
William Hubbs willi...@gentoo.org napisał(a):

 On Sat, Aug 31, 2013 at 10:48:32PM +0200, Michał Górny wrote:
  Dnia 2013-08-31, o godz. 11:26:30
  Ulrich Mueller u...@gentoo.org napisał(a):
  
On Sat, 31 Aug 2013, Michał Górny wrote:
   
And time for a small update. 
   
   In git-r3_checkout:
   
   git --no-pager diff --color --stat \
   ${old_commit_id}..${new_commit_id}
   
   I'd rather omit the --color option, otherwise log files will contain
   escape sequences.
  
  I'd rather leave it. The diff is more for pretty-printing anyway, it
  shouldn't really matter in the logs.
 
 Please don't. I also do not want escape sequences in log files.

Ok, '--color' removed. However, I think we should work something out to
get both parties satisfied. Maybe portage feature or a tool to 'uncruft'
logs from escape sequences since many people actually benefit from them.

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


Re: [gentoo-dev] git-r3: initial draft for review [v2]

2013-09-01 Thread William Hubbs
On Sat, Aug 31, 2013 at 10:48:32PM +0200, Michał Górny wrote:
 Dnia 2013-08-31, o godz. 11:26:30
 Ulrich Mueller u...@gentoo.org napisał(a):
 
   On Sat, 31 Aug 2013, Michał Górny wrote:
  
   And time for a small update. 
  
  In git-r3_checkout:
  
  git --no-pager diff --color --stat \
  ${old_commit_id}..${new_commit_id}
  
  I'd rather omit the --color option, otherwise log files will contain
  escape sequences.
 
 I'd rather leave it. The diff is more for pretty-printing anyway, it
 shouldn't really matter in the logs.

Please don't. I also do not want escape sequences in log files.

William


signature.asc
Description: Digital signature


Re: [gentoo-dev] git-r3: initial draft for review [v2]

2013-08-31 Thread Michał Górny
And time for a small update. 

Dnia 2013-08-31, o godz. 01:37:44
Michał Górny mgo...@gentoo.org napisał(a):

 3. sys-fs/bedup's btrfs-progs submodule says the given commit id is
 'not a valid branch point'. Need to investigate what this means.
 
 4. 'git fetch --depth 1' seems to be refetching stuff even when nothing
 changed. Need to investigate it. It may be enough to do an additional
 'did anything change?' check.

Those are fixed now. The eclass has been adjusted to work properly with
branches, tags and commit ids. It also avoids shallowing repo that was
unshallowed already (since we expect that one of the packages needs it
non-shallow), and properly unshallows shallow repos ;).

Attaching the new version and a diff.

-- 
Best regards,
Michał Górny
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: git-r3.eclass
# @MAINTAINER:
# Michał Górny mgo...@gentoo.org
# @BLURB: Eclass for fetching and unpacking git repositories.
# @DESCRIPTION:
# Third generation eclass for easing maitenance of live ebuilds using
# git as remote repository. Eclass supports lightweight (shallow)
# clones, local object deduplication and submodules.

case ${EAPI:-0} in
0|1|2|3|4|5)
;;
*)
die Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}
;;
esac

if [[ ! ${_GIT_R3} ]]; then

inherit eutils

fi

EXPORT_FUNCTIONS src_unpack

if [[ ! ${_GIT_R3} ]]; then

# @ECLASS-VARIABLE: EGIT_STORE_DIR
# @DESCRIPTION:
# Storage directory for git sources.
#
# EGIT_STORE_DIR=${DISTDIR}/git3-src

# @ECLASS-VARIABLE: EGIT_REPO_URI
# @REQUIRED
# @DESCRIPTION:
# URIs to the repository, e.g. git://foo, https://foo. If multiple URIs
# are provided, the eclass will consider them as fallback URIs to try
# if the first URI does not work.
#
# It can be overriden via env using ${PN}_LIVE_REPO variable.
#
# Example:
# @CODE
# EGIT_REPO_URI=git://a/b.git https://c/d.git;
# @CODE

# @ECLASS-VARIABLE: EVCS_OFFLINE
# @DEFAULT_UNSET
# @DESCRIPTION:
# If non-empty, this variable prevents any online operations.

# @ECLASS-VARIABLE: EGIT_BRANCH
# @DEFAULT_UNSET
# @DESCRIPTION:
# The branch name to check out. If unset, the upstream default (HEAD)
# will be used.
#
# It can be overriden via env using ${PN}_LIVE_BRANCH variable.

# @ECLASS-VARIABLE: EGIT_COMMIT
# @DEFAULT_UNSET
# @DESCRIPTION:
# The tag name or commit identifier to check out. If unset, newest
# commit from the branch will be used. If set, EGIT_BRANCH will
# be ignored.
#
# It can be overriden via env using ${PN}_LIVE_COMMIT variable.

# @ECLASS-VARIABLE: EGIT_NONSHALLOW
# @DEFAULT_UNSET
# @DESCRIPTION:
# Disable performing shallow fetches/clones. Shallow clones have
# a fair number of limitations. Therefore, if you'd like the eclass to
# perform complete clones instead, set this to a non-null value.
#
# This variable is to be set in make.conf. Ebuilds are not allowed
# to set it.

# @FUNCTION: _git-r3_env_setup
# @INTERNAL
# @DESCRIPTION:
# Set the eclass variables as necessary for operation. This can involve
# setting EGIT_* to defaults or ${PN}_LIVE_* variables.
_git-r3_env_setup() {
debug-print-function ${FUNCNAME} $@

local esc_pn livevar
esc_pn=${PN//[-+]/_}

livevar=${esc_pn}_LIVE_REPO
EGIT_REPO_URI=${!livevar:-${EGIT_REPO_URI}}
[[ ${EGIT_REPO_URI} ]] \
|| die EGIT_REPO_URI must be set to a non-empty value
[[ ${!livevar} ]] \
 ewarn Using ${livevar}, no support will be provided

livevar=${esc_pn}_LIVE_BRANCH
EGIT_BRANCH=${!livevar:-${EGIT_BRANCH}}
[[ ${!livevar} ]] \
 ewarn Using ${livevar}, no support will be provided

livevar=${esc_pn}_LIVE_COMMIT
EGIT_COMMIT=${!livevar:-${EGIT_COMMIT}}
[[ ${!livevar} ]] \
 ewarn Using ${livevar}, no support will be provided

# git-2 unsupported cruft
local v
for v in EGIT_{SOURCEDIR,MASTER,HAS_SUBMODULES,PROJECT} \
EGIT_{NOUNPACK,BOOTSTRAP}
do
[[ ${!v} ]]  die ${v} is not supported.
done
}

# @FUNCTION: _git-r3_set_gitdir
# @USAGE: repo-uri
# @INTERNAL
# @DESCRIPTION:
# Obtain the local repository path and set it as GIT_DIR. Creates
# a new repository if necessary.
#
# repo-uri may be used to compose the path. It should therefore be
# a canonical URI to the repository.
_git-r3_set_gitdir() {
debug-print-function ${FUNCNAME} $@

local repo_name=${1#*://*/}

# strip common prefixes to make paths more likely to match
# e.g. git://X/Y.git vs https://X/git/Y.git
# (but just one of the prefixes)
case ${repo_name} in
# cgit can proxy requests to git
cgit/*) repo_name=${repo_name#cgit/};;
# pretty common
git/*) repo_name=${repo_name#git/};;
# gentoo.org
  

Re: [gentoo-dev] git-r3: initial draft for review [v2]

2013-08-31 Thread Ulrich Mueller
 On Sat, 31 Aug 2013, Michał Górny wrote:

 And time for a small update. 

In git-r3_checkout:

git --no-pager diff --color --stat \
${old_commit_id}..${new_commit_id}

I'd rather omit the --color option, otherwise log files will contain
escape sequences.

Also it won't harm to make the unpack location configurable, so can we
please have a variable like EGIT_SOURCEDIR or EGIT_UNPACK_DIR (as it
was called in git.eclass)?

Ulrich



Re: [gentoo-dev] git-r3: initial draft for review [v2]

2013-08-31 Thread Michał Górny
Dnia 2013-08-31, o godz. 11:26:30
Ulrich Mueller u...@gentoo.org napisał(a):

  On Sat, 31 Aug 2013, Michał Górny wrote:
 
  And time for a small update. 
 
 In git-r3_checkout:
 
 git --no-pager diff --color --stat \
 ${old_commit_id}..${new_commit_id}
 
 I'd rather omit the --color option, otherwise log files will contain
 escape sequences.

I'd rather leave it. The diff is more for pretty-printing anyway, it
shouldn't really matter in the logs.

 Also it won't harm to make the unpack location configurable, so can we
 please have a variable like EGIT_SOURCEDIR or EGIT_UNPACK_DIR (as it
 was called in git.eclass)?

I've added EGIT_CHECKOUT_DIR :).

Will submit the new version and a diff against v2 in a minute.

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature