X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=functions%2Ffpkg;h=6c0c26eb86f5708514165aa18d2dd28fe537e4a6;hb=a1b78b59f18bd6bbb649dc0eabecc47c43086a84;hp=dbbc838dbbe678c8ca6bf97a27cb379ee4c3fc69;hpb=c6c53a064eed101cd0dfb7ed63de122bdea5fc77;p=hvlinux.git diff --git a/functions/fpkg b/functions/fpkg index dbbc838..6c0c26e 100644 --- a/functions/fpkg +++ b/functions/fpkg @@ -5,18 +5,16 @@ source ../functions/gztobz2 LFS_PKG_BASE="$(dirname $(pwd))/packages" LFS_PKG_DIR="${LFS_PKG_BASE}/${LFS_STAGE}" +LFS_PATCHES_DIR="${LFS_PKG_BASE}/${LFS_STAGE}/patches" LFS_LOG_DIR="${LFS}/var/log/hvlinux-install/${LFS_STAGE}" LFS_LOG_FILE="${LFS_LOG_DIR}/pkg-update.log" WGET_LOG_FILE="${LFS_LOG_DIR}/pkg-wget.log" WGETCMD="wget --directory-prefix=${LFS_PKG_DIR} --timeout=15 --tries=3 -nc --continue --no-check-certificate --no-verbose --output-file=${WGET_LOG_FILE}" -LFS_PATCHES_LIST=${LFS_PKG_DIR}/patches-list-lfs.html -BLFS_PATCHES_LIST=${LFS_PKG_DIR}/patches-list-blfs.html -CLFS_PATCHES_LIST=${LFS_PKG_DIR}/patches-list-clfs.html -HV_PATCHES_LIST=${LFS_PKG_DIR}/patches-list-hv.html - -PATCHES_BLACKLIST=../config/patches.blacklist +LFS_PATCHES_LIST=${LFS_PKG_DIR}/patches/list-lfs.html +BLFS_PATCHES_LIST=${LFS_PKG_DIR}/patches/list-blfs.html +CLFS_PATCHES_LIST=${LFS_PKG_DIR}/patches/list-clfs.html # Test if the given file extension correspond to a compressed archive # Arg. #1: File extension @@ -86,6 +84,7 @@ remove_partial_file() # Download a file, and making sure it is valid (at least it's header!) # Arg. #1: Source URL. # Arg. #2: Source filename (on server) +# Arg. #3: Output directory (optional). Default = LFS_PKG_DIR # # Return: 0 : success # 1 : wget error @@ -99,8 +98,13 @@ wget_wrapper() local URL=${1} local SOURCE=${2} + local DESTDIR=${LFS_PKG_DIR} + + if [ ${#} -eq 3 ]; then + DESTDIR=${3} + fi - remove_partial_file ${LFS_PKG_DIR}/${SOURCE} + remove_partial_file ${DESTDIR}/${SOURCE} local STRING="Fetching ${SOURCE}" if [ "x${FTYPE}" = "x${FTYPE_PATCH}" ]; then @@ -108,7 +112,7 @@ wget_wrapper() fi rcmd "${STRING}" ${WGETCMD} ${URL}/${SOURCE} \ - --output-document=${LFS_PKG_DIR}/${SOURCE}.part + --output-document=${DESTDIR}/${SOURCE}.part wget_status=$? # Append log to global log file @@ -122,30 +126,30 @@ wget_wrapper() # Partial failure if file was not found. if detect_file_not_found; then - remove_partial_file ${LFS_PKG_DIR}/${SOURCE} + remove_partial_file ${DESTDIR}/${SOURCE} return 2 fi if [ ${wget_status} -ne 0 ]; then echo "Error: wget returned error status ${wget_status}" >> \ ${LFS_LOG_FILE} - remove_partial_file ${LFS_PKG_DIR}/${SOURCE} + remove_partial_file ${DESTDIR}/${SOURCE} return 1 fi local FEXT=${SOURCE##*.} if is_extension_archive "${FEXT}"; then # Just to be sure, test if downloaded file is really an archive: - if ! is_archive ${LFS_PKG_DIR}/${SOURCE}.part; then + if ! is_archive ${DESTDIR}/${SOURCE}.part; then # Partial failure if file is invalid. echo "Error: failed archive test" >> ${LFS_LOG_FILE} - remove_partial_file ${LFS_PKG_DIR}/${SOURCE} + remove_partial_file ${DESTDIR}/${SOURCE} return 2 fi fi # Rename temporary file to final name - mv ${LFS_PKG_DIR}/${SOURCE}{.part,} + mv ${DESTDIR}/${SOURCE}{.part,} return 0 } @@ -189,6 +193,11 @@ update_packages_init() install -v -m755 -d ${LFS_PKG_DIR} 1> ${LFS_LOG_FILE} 2>&1 || exit 1 fi + # Create patches destination directory if it does not exists. + if [ ! -d ${LFS_PATCHES_DIR} ]; then + install -v -m755 -d ${LFS_PATCHES_DIR} 1> ${LFS_LOG_FILE} 2>&1 || exit 1 + fi + if [ -n "${TEST_INTEGRITY}" ]; then # En mode test intégrité, on ne veut pas télécharger quoi que ce soit return 0 @@ -213,14 +222,9 @@ update_packages_init() # Getting list of all patches from CLFS server. rcmd "Fetching CLFS patches list" static_fetch_patches_list ${CLFS_PATCHES_URL} ${CLFS_PATCHES_LIST} fi - - if [ -n "${USE_HV_PATCHES}" ]; then - # Getting list of all patches from hugovil.com server. - rcmd "Fetching hugovil.com patches list" static_fetch_patches_list ${HV_PATCHES_URL} ${HV_PATCHES_LIST} - fi } -# Get patch package if it is not in the repository +# Get patch for package if it is not in the repository # Arg. #1: Package name and version # Arg. #2: Patches list file (HTML) # Arg. #3: Patches URL @@ -250,16 +254,8 @@ static_checkpatch() # Remplace les "%2B" par "+" PATCH_NAME=$(echo ${p} | sed s!%2B!\+!g) - if [ ! -f ${LFS_PKG_DIR}/${PATCH_NAME} ]; then - # Fetch patch only if it is not blacklisted! - local BL=$(cat ${PATCHES_BLACKLIST} | \ - egrep "${PATCH_NAME}") - - if [ "x${BL}" == "x" ]; then - wget_wrapper ${PATCHES_URL} ${PATCH_NAME} - else - MSGSTRING="Patch ${PATCH_NAME} blacklisted" print_status warning - fi + if [ ! -f ${LFS_PATCHES_DIR}/${PATCH_NAME} ]; then + wget_wrapper ${PATCHES_URL} ${PATCH_NAME} ${LFS_PATCHES_DIR} fi done fi @@ -291,11 +287,6 @@ static_getpatch() # Checking if patch is available from CLFS. static_checkpatch ${PACK} ${CLFS_PATCHES_LIST} ${CLFS_PATCHES_URL} fi - - if [ -n "${USE_HV_PATCHES}" ]; then - # Checking if patch is available from hugovil.com. - static_checkpatch ${PACK} ${HV_PATCHES_LIST} ${HV_PATCHES_URL} - fi } detect_file_not_found() @@ -677,7 +668,7 @@ fpkg() # Rename any patch fetched (in fpkg call) and replace SOURCE by TARGET # in patch name. - local PATCHES_LIST="${LFS_PKG_DIR}/${SRC_FILENAME}-*.patch" + local PATCHES_LIST="${LFS_PATCHES_DIR}/${SRC_FILENAME}-*.patch" if ls ${PATCHES_LIST} 1> /dev/null 2>&1; then echo "CMD=${SRC_FILENAME} ${PACK} ${PATCHES_LIST}" rename ${SRC_FILENAME} ${PACK} ${PATCHES_LIST}