Exports builds
parent
fd8ac8fa00
commit
0dc5bea634
15
build.sh
15
build.sh
|
@ -13,14 +13,15 @@ done < <(printenv | cut -d '=' -f 1 | grep -vE '^(PWD|PATH|HOME|BUILD_DIR)$')
|
||||||
printenv &&
|
printenv &&
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
if [ -n "$NO_CLEAN_UP" ]; then
|
|
||||||
find '.flatpak-builder/build' '.flatpak-builder/cache' -delete ||
|
|
||||||
rm -rf ".flatpak-builder/build/*" ".flatpak-builder/build/.*" '.flatpak-builder/cache'
|
|
||||||
fi&&
|
|
||||||
flatpak-builder $3 --arch "$2" --install-deps-from=winebarrels --install-deps-only "$BUILD_DIR" "$1" &&
|
|
||||||
if [ -z "$4" ]; then
|
if [ -z "$4" ]; then
|
||||||
BUILD_DIR= exec flatpak-builder $3 --arch "$2" --sandbox --rebuild-on-sdk-change --bundle-sources "$BUILD_DIR" "$1"
|
BUILD_DIR= exec flatpak-builder $3 --arch "$2" --sandbox --rebuild-on-sdk-change --bundle-sources "$BUILD_DIR" "$1"
|
||||||
else
|
else
|
||||||
HASH="$("$(dirname "$0")/hash_modules.py" --installed "$1" "$2" | sed -n '1p')" || exit 0 &&
|
HASH="$("$(dirname "$0")/hash_modules.py" --installed "$1" "$2" | sed -n '1p')" &&
|
||||||
BUILD_DIR= exec flatpak-builder $3 --arch "$2" --sandbox --rebuild-on-sdk-change --bundle-sources --repo "$4" -s "WB_HASH='${HASH}'" "$BUILD_DIR" "$1"
|
ID="$("$(dirname "$0")/hash_modules.py" --get-id "$1" "$2").Builds" &&
|
||||||
|
(
|
||||||
|
find '.flatpak-builder/build' '.flatpak-builder/cache' -delete ||
|
||||||
|
rm -rf ".flatpak-builder/build" '.flatpak-builder/cache'
|
||||||
|
) &&
|
||||||
|
BUILD_DIR= flatpak-builder $3 --arch "$2" --keep-build-dirs --sandbox --rebuild-on-sdk-change --bundle-sources --repo "$4" -s "WB_HASH='${HASH}'" "$BUILD_DIR" "$1" &&
|
||||||
|
ostree commit --repo "$4" --owner-uid=0 --owner-gid=0 --no-xattrs --generate-sizes --skip-if-unchanged --tree=dir=.flatpak-builder/build --branch "$ID"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -214,6 +214,17 @@ class ModuleLoader():
|
||||||
old_hashes = set(self.old_wb_hashes(arch, verbose=verbose))
|
old_hashes = set(self.old_wb_hashes(arch, verbose=verbose))
|
||||||
return len(own_hash.intersection(old_hashes)) == 0
|
return len(own_hash.intersection(old_hashes)) == 0
|
||||||
|
|
||||||
|
def get_id(self, arch):
|
||||||
|
id = self.content["id"]
|
||||||
|
branch = str(self.content["branch"])
|
||||||
|
assert "/" not in id
|
||||||
|
assert "/" not in arch
|
||||||
|
assert "/" not in branch
|
||||||
|
if bool(self.content.get("build-runtime", False)) or bool():
|
||||||
|
return "runtime/%s/%s/%s" % (id, arch, branch)
|
||||||
|
else:
|
||||||
|
return "app/%s/%s/%s" % (id, arch, branch)
|
||||||
|
|
||||||
def relative(self, file):
|
def relative(self, file):
|
||||||
return os.path.abspath(os.path.join(os.path.split(self.path)[0], file))
|
return os.path.abspath(os.path.join(os.path.split(self.path)[0], file))
|
||||||
|
|
||||||
|
@ -231,6 +242,10 @@ def get_own_hash(source, arch, use_local=False, verbose=False):
|
||||||
raise ValueError("Result have to be an string.")
|
raise ValueError("Result have to be an string.")
|
||||||
return tmp[0]
|
return tmp[0]
|
||||||
|
|
||||||
|
def get_id(source, arch):
|
||||||
|
mod = ModuleLoader(source)
|
||||||
|
return mod.get_id(arch)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -247,9 +262,13 @@ if __name__ == '__main__':
|
||||||
const=True, default=False, help="Use installed then remote.")
|
const=True, default=False, help="Use installed then remote.")
|
||||||
parser.add_argument("-v", "--verbose", dest="verbose", action="store_const",
|
parser.add_argument("-v", "--verbose", dest="verbose", action="store_const",
|
||||||
const=True, default=False, help="Verbose information to stderr.")
|
const=True, default=False, help="Verbose information to stderr.")
|
||||||
|
parser.add_argument("--get-id", dest="get_id", action="store_const",
|
||||||
|
const=True, default=False, help="Get the id.")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.rebuild:
|
if args.get_id:
|
||||||
|
print(get_id(args.file[0], args.arch[0]))
|
||||||
|
elif args.rebuild:
|
||||||
if get_need_update(args.file[0], args.arch[0], use_local=args.installed, verbose=args.verbose):
|
if get_need_update(args.file[0], args.arch[0], use_local=args.installed, verbose=args.verbose):
|
||||||
exit(0)
|
exit(0)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue