Hi list

I'm revisiting one of my first Debian packages, "cjk".
In debian/rules I have created a "get-orig-source" target that clones
the upstream GIT repository and rolls it back up to the ISO date that
is found in the Debian package version in debian/changelog (then
converted to UNIX timestamp).

But a particular line in my old debian/rules doesn't seem to work
anymore, and I can't find why not.  I have an ugly hack around it, but
I'm trying to understand why my original code fails.
At the end of the mail you will find the complete code in
debian/rules.  Here's a minimal example:

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.

I don't see anything wrong with the line above, but now I just get an
empty string after "--hard".  My /bin/sh is linked to `dash'.

The weird thing is that I can make it work with an ugly hack using `xargs':

        cd cjk-$(upstream_version) && echo `git rev-list --all -n 1
--before=$(unixdate)` | xargs git reset --hard


Do you have any idea why the first command doesn't work as I expect?
Your input is most welcome.


Here is a more elaborate piece of the code:

SHELL = /bin/sh

# Stuff for get-orig-source.
upstream_version := $(shell dpkg-parsechangelog | sed -ne 's/^Version:
\(.*\)-.*/\1/p')
isodate := $(shell dpkg-parsechangelog | sed -ne
's/^Version.*git\(.*\)-.*/\1/p')
unixdate := $(shell date -d $(isodate) +%s)
# Add 24 hours to the Unix time.
unixdate := $(shell expr $(unixdate) + 86400 )


get-orig-source:
        # Cleaning
        rm -rf cjk-$(upstream_version)
        rm -f ../cjk_$(upstream_version).orig.tar.gz

        # Download the latest GIT version and downgrade it to $(isodate).
        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))
#unixdate = 1231196400
#hash of GIT commit = 1d3f869e61dc5139d16596075a9e2c4e9a2f503f
# Ugly hack with "xargs" that works.
        cd cjk-$(upstream_version) && echo `git rev-list --all -n 1
--before=$(unixdate)` | xargs git reset --hard

        # Make a pristine package.
# --no-name/-n is important because it won't save the timestamp in the
# 5th to 8th byte of the gzip.
        cd cjk-$(upstream_version) && git archive --format=tar
--prefix=cjk-$(upstream_version)/ master | gzip -9 --no-name >
../../tarballs/cjk_$(upstream_version).orig.tar.gz

        # Clean again, because we use svn-buildpackage afterwards.
        rm -rf cjk-$(upstream_version)



BR


-- 
Danai


-- 
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/aanlktikwqnr5vebrfgnnlipsbpd6pco1ugjeq0s-q...@mail.gmail.com

Reply via email to