Dne 6.11.2010 14:09, Danai SAE-HAN (韓達耐) napsal(a):
upstream_version := cjk-4.8.2+git20090105
unixdate := 1231196400
get-orig-source:
git clone git://git.sv.gnu.org/cjk.git cjk-$(upstream_version)
cd cjk-$(upstream_version)&& git reset --hard $(shell cd
cjk-$(upstream_version)&& git rev-list --all -n 1
--before=$(unixdate))
In other words, I clone the GIT repository, and then want to revert it
to a somewhat older version, based on the UNIX timestamp. I open a
subshell to get the hash of the latest GIT commit before the UNIX
timestamp.
You may find some inspiration in Tito where we do something similar.
There is no need to do "reset --hard", you can pass commit/tag directly
to git "archive"
def get_commit_timestamp(sha1_or_tag):
"""
Get the timestamp of the git commit or tag we're building. Used to
keep the hash the same on all .tar.gz's we generate for a particular
version regardless of when they are generated.
"""
output = run_command(
"git rev-list --timestamp --max-count=1 %s | awk '{print $1}'"
% sha1_or_tag)
return output
def create_tgz(git_root, prefix, commit, relative_dir, rel_eng_dir,
dest_tgz):
"""
Create a .tar.gz from a projects source in git.
"""
os.chdir(os.path.abspath(git_root))
timestamp = get_commit_timestamp(commit)
timestamp_script = get_script_path("tar-fixup-stamp-comment.pl")
# Accomodate standalone projects with specfile in root of git repo:
relative_git_dir = "%s" % relative_dir
if relative_git_dir == '/':
relative_git_dir = ""
archive_cmd = ('git archive --format=tar --prefix=%s/ %s:%s '
'| grep -a -v "^%s/rel-eng/" | %s %s %s | gzip -n -c - | tee
%s' % (
prefix, commit, relative_git_dir, prefix, timestamp_script,
timestamp, commit, dest_tgz))
debug(archive_cmd)
run_command(archive_cmd)
That tar-fixup-stamp-comment.pl can be find here:
https://github.com/dgoodwin/tito/blob/master/bin/tar-fixup-stamp-comment.pl
You can study rest of Tito here:
https://github.com/dgoodwin/tito
Tito is made to produce rpm files, but that part from git to tar.gz will
be the same for Debian.
Miroslav Suchy
--
To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4cd5ac70.3090...@suchy.cz