File: get-orig-source.sh

package info (click to toggle)
qemu 1%3A5.2%2Bdfsg-10
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 201,372 kB
  • sloc: ansic: 2,327,506; pascal: 107,506; asm: 49,545; python: 40,498; sh: 35,286; cpp: 33,587; makefile: 15,209; perl: 6,965; xml: 3,028; objc: 1,460; php: 1,299; tcl: 1,070; yacc: 604; lex: 363; sql: 71; awk: 35; sed: 11
file content (136 lines) | stat: -rwxr-xr-x 3,539 bytes parent folder | download | duplicates (4)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#! /bin/sh

set -e

base=https://download.qemu.org/
comp=.xz

dir() {
  if [ -d $1 ]; then
     echo removing $1/...
     rm -rf $1
  else
     echo $1/ already removed
  fi
}

file() {
  for f in "$@"; do
    if [ -f "$f" ]; then
      rm -vf -- "$f"
    else
      echo "$f already removed"
    fi
  done
}

clean_dfsg() {
# remove only those blobs which does not have packaged source
# remove all other blobs too

file pc-bios/bios.bin		# roms/seabios/
file pc-bios/bios-256k.bin	# roms/seabios/
file pc-bios/bios-microvm.bin	# roms/qboot/ (old)
file pc-bios/qboot.rom		# roms/qboot/
file pc-bios/hppa-firmware.img	# roms/seabios-hppa/
file pc-bios/sgabios.bin	# roms/sgabios/
file pc-bios/slof.bin		# roms/SLOF/
file pc-bios/vgabios*.bin	# roms/vgabios/
file pc-bios/pxe-*.rom		# roms/ipxe/
file pc-bios/efi-*.rom		# roms/ipxe/
file pc-bios/edk2-*.fd.bz2	# roms/edk2/
file pc-bios/bamboo.dtb		# pc-bios/bamboo.dts
file pc-bios/canyonlands.dtb
file pc-bios/openbios-*		# roms/openbios/
file pc-bios/opensbi-*.bin	# roms/opensbi/
file pc-bios/opensbi-*.elf	# roms/opensbi/
file pc-bios/palcode-clipper	# roms/qemu-palcode/ alpha palcode
file pc-bios/s390-ccw.img	# pc-bios/s390-ccw/
file pc-bios/s390-netboot.img	# pc-bios/s390-ccw/
file pc-bios/kvmvapic.bin	# pc-bios/optionrom/
file pc-bios/linuxboot*.bin	# ditto
file pc-bios/multiboot.bin	# ditto
file pc-bios/pvh.bin		# ditto
file pc-bios/skiboot.lid	# roms/skiboot/
file pc-bios/u-boot.e500	# roms/u-boot/
file pc-bios/u-boot-sam460-20100605.bin	# roms/u-boot-sam460ex/
file pc-bios/QEMU,*.bin	# roms/openbios/
file pc-bios/qemu_vga.ndrv	# roms/QemuMacDrivers/

# remove other software (git submodules)
dir roms/ipxe		# separate package
dir roms/seabios	# separate package
file roms/SLOF/board-js2x/rtas/i2c_bmc.oco
file roms/SLOF/board-js2x/rtas/ipmi_oem.oco
file roms/SLOF/clients/takeover/takeover.oco
file roms/SLOF/lib/libipmi/libipmi.oco
dir roms/edk2		# separate package
dir roms/u-boot		# separate package
file roms/u-boot.tar.*
#dir roms/u-boot-sam460ex # this one is not built by u-boot and requires older compiler
dir roms/QemuMacDrivers

dir dtc		# system dtc exists and used
dir capstone	# system capstone exists and used
dir slirp	# system libslirp exists and used
dir meson	# meson build system

}

case "$#$1" in
  1clean | 1dfsg | 1dfsg[-_]clean)
    if [ -f softmmu/vl.c -a -f hw/block/block.c -a -d pc-bios ]; then
      clean_dfsg
      exit 0
    fi
    echo "apparently not a qemu source dir" >&2; exit 1
    ;;

  1[2-6].*) ;;

  *)
    echo "unknown arguments.  Should be either 'dfsg' or a version number" >&2
    exit 1
    ;;
esac

deb="${1%-*}" # strip debian revision number
upstream="${deb%+dfsg}"
case "$upstream" in
   *~rc*) upstream=$(echo "$upstream" | sed 's/~rc/-rc/') ;;
esac
case "$upstream" in
   [2-6].[0-9] | [2-6].[0-9][!0-9.]* ) # add .0 to a version number
     upstream=$(echo "$upstream" | sed 's/^.\../&.0/') ;;
esac

tempdir=qemu-$upstream-tmp
basetar=qemu-$upstream.tar$comp
debtar=qemu_$deb.orig.tar.xz

if [ ! -f $basetar ]; then

  echo getting upstream version $upstream ...
  wget -Nc $base/$basetar

fi

if [ ! -f $debtar ]; then

  echo extracting source in $tempdir and cleaning up ...
  rm -rf $tempdir
  mkdir $tempdir
  cd $tempdir
  tar -x -f ../$basetar --strip-components=1
  clean_dfsg

  echo repacking to $debtar ...
  find . -type f -print | sort \
    | XZ_OPT="-v6" \
      tar -caf ../$debtar -T- --owner=root --group=root --mode=a+rX \
         --xform "s/^\\./qemu-$upstream/"

  cd ..
  rm -rf $tempdir

fi