File: generate-packaging-dir

package info (click to toggle)
snapd 2.21-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 7,912 kB
  • ctags: 8,412
  • sloc: ansic: 3,930; sh: 1,505; python: 414; makefile: 398; exp: 177
file content (30 lines) | stat: -rwxr-xr-x 640 bytes parent folder | download
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
#!/bin/sh

set -e

if [ ! -d .git ]; then
    echo "not running in a git checkout, skipping"
    exit 0
fi

ID="$1"
VERSION_ID="$2"

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

if ! git remote | grep upstream; then
    git remote add upstream https://github.com/snapcore/snapd
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"
    fi
done