`git ubuntu upstream-update` wrapper around uupdate/uscan

Bug #1706219 reported by Nish Aravamudan on 2017-07-24
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

And take a tarball directly otherwise.

Nish Aravamudan (nacc) on 2017-08-02
Changed in usd-importer:
importance: Undecided → Wishlist
status: New → Confirmed
milestone: none → future
tags: added: workflow
Robie Basak (racb) wrote :

A possible workaround is something along the lines of:

Unpack tarball somewhere
GIT_WORK_TREE=$somewhere git add -A
git reset debian
git commit -m'New upstream'

(needs testing wrt. the debian/ reset and exactly what works there)

Michael Hudson-Doyle (mwhudson) wrote :

This is somewhat (extremely!) hairy but seems to work:

set -eux

#tmpdir=$(mktemp -d)
#cleanup () { rm -rf $tmpdir; }
#trap cleanup EXIT
mkdir $tmpdir

mkdir $tmpdir/unpacked
tar -C $tmpdir/unpacked -xf $tarball --strip-components=1

index_file=$(realpath .git/my-uupdate-index)
rm -f $index_file
GIT_INDEX_FILE=$index_file GIT_WORK_TREE=$tmpdir/unpacked git add -A
tmp_tree=$(GIT_INDEX_FILE=$index_file git write-tree)
git ls-tree ${tmp_tree} > $tmpdir/tree
deb_sha=$(git ls-tree HEAD^{tree} | awk '{ if ($4 == "debian") { print $3; } }')
echo -e "040000 tree $deb_sha\tdebian" >> $tmpdir/tree
new_tree=$(cat $tmpdir/tree | git mktree)
echo "Update upstream source from '$(basename $tarball)'" > $tmpdir/commit-msg
commit=$(git commit-tree -p HEAD -F $tmpdir/commit-msg ${new_tree})
git merge $commit

(cobbled together from reading bits of what gdb import-orig does)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers