mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2024-12-31 11:22:07 +00:00
buildrepo: copy files from aports if already built.
and dont build index if its not needed
This commit is contained in:
parent
bcb440d4fe
commit
6112557963
43
buildrepo
43
buildrepo
@ -40,18 +40,48 @@ purge() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
local repo="$1" i
|
local repo="$1" i indexupdate needbuild
|
||||||
|
|
||||||
cd "$aportsdir/$repo" || return 1
|
cd "$aportsdir/$repo" || return 1
|
||||||
mkdir -p "$repodir/$repo"
|
mkdir -p "$repodir/$repo"
|
||||||
|
|
||||||
|
# first we try copy everything possible and find out which we need
|
||||||
|
# to rebuild. By doing this we might save us for rebuilding
|
||||||
|
# needed when running 'abuild -R'
|
||||||
for i in */APKBUILD; do
|
for i in */APKBUILD; do
|
||||||
( cd ${i%/*} || return 1
|
export REPODEST="$repodir"
|
||||||
REPODEST="$repodir" abuild -k -r || return 1
|
cd "$aportsdir/$repo"/${i%/*} || return 1
|
||||||
) || return 1
|
if abuild -k -q up2date 2>/dev/null; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# try link or copy the files if they are in the ports dir
|
||||||
|
pkgs=$(abuild listpkg)
|
||||||
|
if cp -p -l $pkgs "$repodir/$repo"/ 2>/dev/null \
|
||||||
|
|| cp -p $pkgs "$repodir/$repo"/ 2>/dev/null; then
|
||||||
|
echo ">>> Copying " $pkgs
|
||||||
|
else
|
||||||
|
needbuild="$needbuild $i"
|
||||||
|
fi
|
||||||
|
indexupdate="$indexupdate $i"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -z "$indexupdate" ] && [ -z "$needbuild" ]; then
|
||||||
|
echo ">>> Repository $repo is up-to-date."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# build the postponed packages if any
|
||||||
|
if [ -n "$needbuild" ]; then
|
||||||
|
for i in $needbuild; do
|
||||||
|
cd "$aportsdir/$repo"/${i%/*} || return 1
|
||||||
|
abuild -k -R || return 1
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# generate the repository index
|
||||||
cd "$repodir/$repo"
|
cd "$repodir/$repo"
|
||||||
echo ">>> Generating Index..."
|
echo ">>> Generating Index for $repo..."
|
||||||
md5sum *.apk | gzip -9 > INDEX.md5.gz
|
md5sum *.apk | gzip -9 > INDEX.md5.gz
|
||||||
if which apk >/dev/null; then
|
if which apk >/dev/null; then
|
||||||
local deps
|
local deps
|
||||||
@ -60,6 +90,8 @@ build() {
|
|||||||
done
|
done
|
||||||
apk $deps index *.apk | gzip -9 > APK_INDEX.gz
|
apk $deps index *.apk | gzip -9 > APK_INDEX.gz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# kill old packages in repo
|
||||||
purge "$repo"
|
purge "$repo"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +115,7 @@ while [ $# -gt 0 ]; do
|
|||||||
else
|
else
|
||||||
build $1 || exit 1
|
build $1 || exit 1
|
||||||
fi
|
fi
|
||||||
|
deprepo="$deprepo $1"
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user