summaryrefslogtreecommitdiff
path: root/clean_source_export
blob: 911fa3e71cf478c7e89dfce95dc068b2951049f6 (plain)
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
#!/bin/bash
#
# Script to export cleaned sources from PKGBUILDs with build instructions
# usage clean_source_export <dir of PKGBUILD> 
# without <dir of PKGBUILD> acts on curent dir
if [[ $1 ]]; then
    cd  "$1"
fi

#check there is a PKGBUILD to work on
if [[ ! -f PKGBUILD ]]; then
	echo "No PKGBUILD found. Exiting."
	exit 1
fi

#Make the clean source
makepkg -Crso --noconfirm 

# Get access to the functions
. PKGBUILD
cd src

# Export the build information
echo -e "Depends:\n\n    ${depends[*]}\n\nMake Depends:\n\n    ${makedepends[*]}\n\nCommand to build:\n" > Parabola_Build.txt
type build | sed '1,3d;$d' \
	| sed "s|\$pkgver|$pkgver|g" | sed "s|\$srcdir|$srcdir|g" \
	| sed "s|\$pkgrel|$pkgrel|g" | sed "s|\$pkgname|$pkgname|g" \
	| sed "s|\$pkgdir|$pkgdir|g" >> Parabola_Build.txt

# roll it up
tar zcvf ../$pkgname-$pkgver-$pkgrel.tar.gz ./

# Clean up - Disabled while testing
#cd ..
#rm -rf src