~fginther/ppa-dev-tools/ppa_sync-fix-source-package-search

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash

CHERRY=${1}
RELEASE=${2}
if [ -z "${RELEASE}" ]; then
    RELEASE=$(current-ubuntu-development-codename)
fi

# TODO: xgit-checkout <package>
# TODO: Checkout all origin/* branches
# TODO: Create an upstream-ubuntu branch
#  - git branch upstream-ubuntu
#  - git checkout upstream-ubuntu
#  - git pull ../<upstream-git>
#  - git push origin upstream-ubuntu
git pull
git checkout ubuntu
# TODO: Re-add patch system if necessary
#  - mkdir debian/patches
#  - touch debian/patches/series
#  - echo '!*.patch' > debian/patches/.gitignore
#  - git add debian/patches debian/patches/series
#  - git commit debian/patches debian/patches/series -m "Enable patch system"

git cherry-pick ${CHERRY}
if [ $? != 0 ]; then
  git show ${CHERRY} > ${CHERRY}.patch
  # Fix any conflicts, then:
  #  - git add <paths> or git rm <paths>
  #  - git commit -c ${CHERRY}
  echo "Need to fix up manually"
  exit 1
seqnum=100 # TODO
patch=$(git show ${CHERRY})
desc=$(echo "${patch}" | head -n5 | tail -n1)
title=$(echo "${desc}" | sed -e "s/^ *//" | tr '[:upper:]' '[:lower:]' | sed -e "s/.$//")
patchname="${seqnum}_${title// /_}.patch"
echo ${patch} > ./debian/patches/${patchname}
echo ${patchname} > ./debian/patches/series
git reset --hard HEAD^
if [ ! -e debian/patches/.gitignore ] ; then
    echo '!*.patch' > debian/patches/.gitignore
fi
git add debian/patches/${patchname}
commit_message="Cherrypick ${CHERRY} from upstream as ${patchname}"
dch -i -m ${commit_message}
dch -r --force-distribution -D ${RELEASE}
update-maintainer
git commit -a -m "${commit_message}"