Skip to content

Commit

Permalink
make generate-packaging-dir look for a companion 14.04 branch for the
Browse files Browse the repository at this point in the history
14.04 debian bits first, before looking up the main one.
  • Loading branch information
chipaca committed Jan 17, 2017
1 parent d1c0dac commit 3c7a4a7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
45 changes: 32 additions & 13 deletions generate-packaging-dir
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
#!/bin/sh
set -eu

set -e
tree1404() {
if [ -z "${TRAVIS_PULL_REQUEST_SLUG:-}" ]; then
return 0
fi

local user="${TRAVIS_PULL_REQUEST_SLUG%/*}"

if ! git remote | grep -q "^$user$"; then
git remote add "$user" "https://github.com/$TRAVIS_PULL_REQUEST_SLUG" || return 0
fi
git fetch --quiet "$user" || return 0
local tree="$user/${TRAVIS_PULL_REQUEST_BRANCH}-14.04"
git branch --remote | grep -q " $tree$" || return 0

echo "$tree"
}

if [ ! -d .git ]; then
echo "not running in a git checkout, skipping"
Expand All @@ -11,20 +27,23 @@ ID="$1"
VERSION_ID="$2"

DST="debian-$ID-$VERSION_ID"
rm -rf $DST
rm -rf "$DST"
mkdir -p "$DST"

if ! git remote | grep upstream; then
git remote add upstream https://github.com/snapcore/snapd
tree="$(tree1404)"
if [ -z "$tree" ]; then
if ! git remote | grep upstream; then
git remote add upstream https://github.com/snapcore/snapd
fi
git fetch --quiet upstream
tree="upstream/$ID/$VERSION_ID"
fi
git fetch upstream

git ls-tree upstream/"$ID"/"$VERSION_ID" debian/ | while read line ; do
file=$(basename $(echo $line | cut -d " " -f4))
hash=$(echo $line | cut -d " " -f3)
type=$(echo $line | cut -d " " -f2)
# FIXME: deal with subdirs
if [ "$type" = "blob" ]; then
git cat-file -p $hash > "$DST/$file"

git ls-tree -r "$tree" debian/ | while read _ type hash file; do
if [ "$type" != "blob" ]; then
continue
fi
file="$DST/${file#debian/}"
mkdir -p "$(dirname "$file")"
git cat-file -p "$hash" > "$file"
done
6 changes: 6 additions & 0 deletions run-checks
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/sh
if [ "$TRAVIS_BUILD_NUMBER" ]; then
echo travis_fold:start:env
printenv | sort
echo travis_fold:end:env
fi

export LANG=C.UTF-8
export LANGUAGE=en
set -eu
Expand Down

0 comments on commit 3c7a4a7

Please sign in to comment.