File: repack-doc-base.sh

package info (click to toggle)
php-doc 20241205~git.dfcbb86%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 70,956 kB
  • sloc: xml: 968,269; php: 23,883; javascript: 671; sh: 177; makefile: 37
file content (44 lines) | stat: -rwxr-xr-x 956 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash

# This script repacks the php/doc-base tarball to provide the
# expected build directory structure for the documetation build.
# It was based on sergiodj's Ubuntu telegraf d/watch scripts.
#
# It works with uscan v4 and assumes that it will be called like:
#
#   SCRIPT --upstream-version VERSION
#
# Authors: Sergio Durigan Junior <sergio.durigan@canonical.com>
#          Athos Coimbra Ribeiro <athos.ribeiro@canonical.com>

set -e
set -x
set -o pipefail

upstream_version="$2"
orig_tar=$(realpath "../php-doc_${upstream_version}.orig.tar.xz")
orig_dir="$PWD"
work_dir=$(mktemp -d)

cleanup ()
{
    cd "$orig_dir"
    rm -rf "$work_dir"
}

trap cleanup INT QUIT 0

printf "Unpacking tarball '$orig_tar' to '$work_dir'"

tar xf "$orig_tar" -C "$work_dir"
source_dir_name=$(ls -1 "$work_dir")
cd "$work_dir/$source_dir_name"
contents=$(ls -A)
mkdir doc-base
mv $contents doc-base
cd ..
tar cJf "$orig_tar" "$source_dir_name"

cleanup

exit 0