Add option to append version number in fpkg()
authorHugo Villeneuve <hugo@hugovil.com>
Mon, 22 Dec 2014 04:27:23 +0000 (23:27 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Sat, 27 Dec 2014 05:01:52 +0000 (00:01 -0500)
config/packages-list
functions/fpkg
stage1/packages-update
stage2/packages-update
stage3/packages-update
stage4/packages-update
stage5/packages-update

index 3f9ec3e..02ef0fe 100644 (file)
@@ -98,7 +98,7 @@ FIRMWARE_B43_LPPHY="broadcom-wl-5.100.138"
 FLAC="flac-1.3.0"
 FLEX="flex-2.5.37"
 FONTCONFIG="fontconfig-2.11.1"
-FONTFORGE="FontForge-20141126"
+FONTFORGE="FontForge-2014.11.26"
 FOO2ZJS="foo2zjs"
 FOOMATIC_FILTERS="foomatic-filters-4.0.17"
 FREETYPE="freetype-2.5.4"
index 673299b..7be2960 100644 (file)
@@ -425,7 +425,14 @@ test_archive_integrity()
 #            pm (Perl module via CPAN)
 #            fd (freedesktop.org)
 #   -o     Option specific to mode
-#   -s     Subdirectory on server
+#   -s DIR Subdirectory on server
+#   -v NUM Subdirectory on server is equal to package version. If -s option is specified, then
+#          append version number to value of -s argument:
+#            NUM=  Full version number
+#            NUM=1 First number of package version
+#            NUM=2 First two numbers of package version
+#          Ex: fpkg -s "v" -v 2 mypkg-1.2.3 http://mypkg.com would fetch from url:
+#                  http://mypkg.com/v1.2/mypkg-1.2.3.tar.bz2
 #   -w     First erase destination file if it exists (except in test mode)
 fpkg()
 {
@@ -437,9 +444,11 @@ fpkg()
     local MODE_OPT=""
     local SRC_DIR=""
     local FD_SUBDIR_FINAL=""
+    local VARG=""
+    unset VOPTION
     unset ERASE_FIRST
 
-    while getopts "d:e:f:m:o:s:w" flag ;do
+    while getopts "d:e:f:m:o:s:v:w" flag ;do
         case ${flag} in
            d)
                 # Fetch directory (where to put file)
@@ -462,6 +471,10 @@ fpkg()
            s)
                SRC_DIR=${OPTARG}
                 ;;
+            v)
+                VOPTION="y"
+                VARG=${OPTARG}
+                ;;
             w)
                 ERASE_FIRST="y"
                ;;
@@ -489,6 +502,29 @@ fpkg()
         local URL=${2}
     fi
 
+    if [ -n "${VOPTION}" ]; then
+        # Append version number to SRC_DIR (if specified)
+        case ${VARG} in
+            0)
+                # Full version number
+                SRC_DIR+="$(get_pkg_ver ${PACK})"
+                ;;
+           1)
+                SRC_DIR+="$(get_pkg_ver1 ${PACK})"
+                ;;
+            2)
+                SRC_DIR+="$(get_pkg_ver2 ${PACK})"
+                ;;
+            3)
+                SRC_DIR+="$(get_pkg_ver3 ${PACK})"
+                ;;
+            *)
+                echo "${FUNCNAME}(), invalid -v argument: ${VARG}"
+               return 1
+                ;;
+        esac
+    fi
+
     if [ -n "${MODE}" ]; then
         case ${MODE} in
            gnu)
index 0d1a194..e897949 100755 (executable)
@@ -20,7 +20,7 @@ fpkg -m gnu ${NCURSES}
 fpkg ${ZLIB} "http://www.zlib.net"
 fpkg -m gnu ${BASH}
 fpkg -m gnu ${BISON}
-fpkg -e "tar.gz" ${BZIP2} "http://www.bzip.org/$(get_pkg_ver ${BZIP2})"
+fpkg -e "tar.gz" -v 0 ${BZIP2} "http://www.bzip.org"
 fpkg -m gnu -e "tar.xz" ${COREUTILS}
 fpkg -m gnu ${DIFFUTILS}
 fpkg -m gnu ${FINDUTILS}
@@ -39,8 +39,7 @@ fpkg -m gnu ${NANO}
 fpkg ${XZ_UTILS} "http://tukaani.org/xz"
 
 # Chapter 7
-fpkg -s "linux/utils/util-linux/v$(get_pkg_ver2 ${UTIL_LINUX})" \
-    ${UTIL_LINUX} ${KERNEL_URL}
+fpkg -s "linux/utils/util-linux/v" -v 2 ${UTIL_LINUX} ${KERNEL_URL}
 fpkg -m hv ${SHADOW}
 fpkg -m sf ${E2FSPROGS}
 fpkg ${SYSVINIT} "http://download.savannah.gnu.org/releases/sysvinit"
index be1ba23..d12ec7f 100755 (executable)
@@ -53,7 +53,7 @@ fpkg -e "tar.gz" ${PERL} "http://www.cpan.org/src/5.0"
 fpkg -s "manpages" ${MANPAGES} "http://tldp.org"
 fpkg -m gnu -e "tar.gz" ${GPERF}
 fpkg -e "tar.gz" ${LIBFFI} "ftp://sourceware.org/pub/libffi"
-fpkg ${PYTHON} "http://www.python.org/ftp/python/$(get_pkg_ver ${PYTHON})"
+fpkg -v 0 ${PYTHON} "http://www.python.org/ftp/python"
 fpkg -m gnome ${GLIB}
 fpkg -m fd ${PKG_CONFIG}
 fpkg ${IANA} "http://www.sethwklein.net"
@@ -90,7 +90,7 @@ fpkg -m sf ${PSMISC}
 fpkg -e "tar.gz" ${SYSKLOGD} \
     "http://www.infodrom.org/projects/sysklogd/download"
 fpkg -m gnu ${GRUB}
-fpkg -e "tar.gz" ${DHCP} "ftp://ftp.isc.org/isc/dhcp/$(get_pkg_ver ${DHCP})"
+fpkg -e "tar.gz" -v 0 ${DHCP} "ftp://ftp.isc.org/isc/dhcp"
 fpkg ${DHCPCD} "http://roy.marples.name/downloads/dhcpcd"
 
 fpkg -e "tar.gz" ${ACPID} "http://www.tedfelix.com/linux"
index 74168ad..0059278 100755 (executable)
@@ -8,7 +8,6 @@ update_packages_init ${*}
 lpkg 2 ${SHADOW}
 
 # These packages are only for stage3
-
 fpkg -m gnu ${WHICH}
 fpkg -e "tar.gz" ${BASHCOMPLETION} "http://www.caliban.org/files/bash"
 fpkg -s "software/utils/pciutils" ${PCIUTILS} ${KERNEL_URL}
@@ -46,15 +45,14 @@ fpkg -m sf ${DDCLIENT}
 fpkg -e "tar.gz" ${LIBPCAP} ${TCPDUMP_URL}
 fpkg -e "tar.gz" ${TCPDUMP} ${TCPDUMP_URL}
 fpkg ${NMAP} "http://download.insecure.org/nmap/dist"
-fpkg -e "tar.gz" -s "$(get_pkg_ver ${BIND})" ${BIND} \
-    "ftp://ftp.isc.org/isc/bind9"
+fpkg -e "tar.gz" -v 0 ${BIND} "ftp://ftp.isc.org/isc/bind9"
 fpkg ${IPTABLES} "http://www.netfilter.org/projects/iptables/files"
 fpkg ${CURL} "http://curl.haxx.se/download"
 fpkg -e "tar.gz" ${RSYNC} "http://samba.org/ftp/rsync/src"
 fpkg -m hv ${GETDATE}
 
 fpkg -e "tar.gz" ${LIBARCHIVE} "http://github.com/downloads/libarchive/libarchive"
-fpkg -e "tar.gz" ${CMAKE} "http://www.cmake.org/files/v$(get_pkg_ver2 ${CMAKE})"
+fpkg -e "tar.gz" -s "v" -v 2 ${CMAKE} "http://www.cmake.org/files"
 
 fpkg -e "tar.gz" ${MYSQL} \
     "http://anduin.linuxfromscratch.org/sources/BLFS/svn/m"
@@ -135,7 +133,7 @@ fpkg -m gnu ${GUILE2}
 fpkg -s "libgpg-error" ${LIBGPG_ERROR} ${GNUPG_URL}
 fpkg -s "libgcrypt"    ${LIBGCRYPT}    ${GNUPG_URL}
 fpkg -e "tar.gz" ${NETTLE} "http://www.lysator.liu.se/~nisse/archive"
-fpkg -e "tar.xz" -s "gnutls/v$(get_pkg_ver2 ${GNUTLS})" ${GNUTLS} ${GNUPG_URL}
+fpkg -e "tar.xz" -s "gnutls/v" -v 2 ${GNUTLS} ${GNUPG_URL}
 
 fpkg -e "tar.gz" ${SASL2} "ftp://ftp.andrew.cmu.edu/pub/cyrus-mail"
 fpkg -e "tgz" ${OPENLDAP} \
@@ -158,8 +156,7 @@ fpkg -e "tar.gz" ${YASM} "http://www.tortall.net/projects/yasm/releases"
 if [ "x${INST_TYPE}" = "xworkstation" -o "x${INST_TYPE}" = "xltsp-server" ]; then
     if [ "x${SOUND_CARD}" = "xyes" ]; then
 
-        fpkg ${NASM} "http://www.nasm.us/pub/nasm/releasebuilds/$(get_pkg_ver \
-          ${NASM})"
+        fpkg -v 0 ${NASM} "http://www.nasm.us/pub/nasm/releasebuilds"
         fpkg ${ALSA_LIB}   "ftp://ftp.alsa-project.org/pub/lib"
         fpkg ${ALSA_UTILS} "ftp://ftp.alsa-project.org/pub/utils"
 
index 2e286b9..733632f 100755 (executable)
@@ -44,9 +44,8 @@ fpkg -m fd -o "xcb" -s "dist" ${XCB_UTIL}
 
 fpkg ${LIBDRM} "http://dri.freedesktop.org/libdrm"
 fpkg -e "tar.gz" ${TALLOC} "http://samba.org/ftp/talloc"
-fpkg -e "tar.gz" -f "${LLVM}.src" ${LLVM} "http://llvm.org/releases/$(get_pkg_ver ${LLVM})"
-fpkg -s "$(get_pkg_ver ${MESALIB})" ${MESALIB} \
-    ftp://ftp.freedesktop.org/pub/mesa
+fpkg -e "tar.gz" -f "${LLVM}.src" -v 0 ${LLVM} "http://llvm.org/releases"
+fpkg -v 0 ${MESALIB} "ftp://ftp.freedesktop.org/pub/mesa"
 fpkg -m xorg -s data ${XCURSOR_THEMES}
 fpkg -s data/xkeyboard-config ${XKEYBOARD_CONFIG} ${XORG_URL}
 
index 21316f8..2e8a260 100755 (executable)
@@ -10,8 +10,7 @@ lpkg 3 ${FREETYPE}
 
 fpkg -m gnu ${HELP2MAN}
 fpkg -m gnu ${GSL}
-fpkg -s "$(get_pkg_ver3 ${CUPS})" -f "${CUPS}-source" ${CUPS} \
-    "http://www.cups.org/software"
+fpkg -v 3 -f "${CUPS}-source" ${CUPS} "http://www.cups.org/software"
 fpkg -e "tar.gz" -f "$(get_pkg_name ${CUPS_PDF})_$(get_pkg_ver ${CUPS_PDF})" \
     ${CUPS_PDF} "http://www.cups-pdf.de/src"
 fpkg -m sf -e "tar.bz2" ${SPLIX}
@@ -76,9 +75,9 @@ fpkg -e "tar.gz" ${VIEWNIOR} "https://github.com/xsisqox/Viewnior/archive"
 fpkg -e "tar.xz" -m fd -s "none" ${POPPLER}
 fpkg -m gnome ${LIBCROCO}
 fpkg -m gnome ${LIBRSVG}
-fpkg ${BABL} "ftp://ftp.gtk.org/pub/babl/$(get_pkg_ver2 ${BABL})"
-fpkg ${GEGL} "ftp://ftp.gimp.org/pub/gegl/$(get_pkg_ver2 ${GEGL})"
-fpkg -s "v$(get_pkg_ver2 ${GIMP})" ${GIMP} "http://download.gimp.org/pub/gimp"
+fpkg -v 2 ${BABL} "http://download.gimp.org/pub/babl"
+fpkg -v 2 ${GEGL} "http://download.gimp.org/pub/gegl"
+fpkg -s "v" -v 2 ${GIMP} "http://download.gimp.org/pub/gimp"
 
 fpkg -m sf -s "gimp-print" -e "tar.bz2" ${GUTENPRINT}
 fpkg -m sf -s "boost" ${BOOST}
@@ -87,9 +86,8 @@ fpkg -m sf ${INKSCAPE}
 fpkg ${CDRTOOLS} "ftp://ftp.berlios.de/pub/cdrecord"
 fpkg -e "tar.gz" ${DVDRWTOOLS} \
     "http://fy.chalmers.se/~appro/linux/DVD+RW/tools"
-fpkg -s "$(get_pkg_ver ${LIBDVDCSS})" ${LIBDVDCSS} \
-    "http://www.videolan.org/pub/libdvdcss"
-fpkg -e "tar.bz2" -s "$(get_pkg_ver ${LIBDVDREAD})" ${LIBDVDREAD} \
+fpkg -v 0 ${LIBDVDCSS} "http://www.videolan.org/pub/libdvdcss"
+fpkg -e "tar.bz2" -v 0 ${LIBDVDREAD} \
     "http://download.videolan.org/pub/videolan/libdvdread"
 
 fpkg -e "tar.gz" ${DVDFS} "http://jspenguin.org:81/dvdfs"
@@ -115,13 +113,13 @@ fpkg -m gnome ${VTE}
 fpkg -m sf ${GRIP}
 fpkg -m sf -e "tar.bz2" ${CDRDAO}
 fpkg -m sf ${ID3LIB}
-fpkg -e "tar.xz" ${EASYTAG} "https://download.gnome.org/sources/easytag/$(get_pkg_ver2 ${EASYTAG})"
-fpkg -e "tar.gz" -f "fontforge-2014-11-26-Unix-Source" -s "" ${FONTFORGE} \
-    "https://github.com/fontforge/fontforge/releases/download/$(get_pkg_ver ${FONTFORGE})"
+fpkg -m gnome ${EASYTAG}
+
+fpkg -e "tar.gz" -f "FontForge-$(get_pkg_ver ${FONTFORGE} | sed 's/\./-/g')-Unix-Source" -s "" ${FONTFORGE} \
+    "https://github.com/fontforge/fontforge/releases/download/$(get_pkg_ver ${FONTFORGE} | sed 's/\.//g')"
 
 fpkg -m gnu ${GUILE1}
-fpkg -e "tar.gz" ${LILYPOND} \
-    "http://lilypond.org/download/sources/v$(get_pkg_ver2 ${LILYPOND})"
+fpkg -e "tar.gz" -s "v" -v 2 ${LILYPOND} "http://lilypond.org/download/sources"
 fpkg -m hv ${CHORDPACK}
 fpkg -m hv ${GUITARTEX}
 
@@ -137,8 +135,7 @@ fpkg -m gnome ${GNOME_MEDIA}
 fpkg -m sf -s "wxwindows" ${WXGTK}
 fpkg ${AUDACITY} "http://audacity.googlecode.com/files"
 
-fpkg ${SYLPHEED} \
-    "http://sylpheed.sraoss.jp/sylpheed/v$(get_pkg_ver2 ${SYLPHEED})"
+fpkg -s "v" -v 2 ${SYLPHEED} "http://sylpheed.sraoss.jp/sylpheed"
 
 fpkg -m gnome ${LIBNOTIFY}
 
@@ -166,7 +163,7 @@ fpkg -e "tar.gz" ${LUA} "http://www.lua.org/ftp"
 fpkg -e "tar.xz" -m sf ${VLC}
 fpkg -e "tar.gz" ${SDL} "http://www.libsdl.org/release"
 fpkg -e "tar.gz" ${AGG} "http://www.antigrain.com"
-fpkg ${GNASH} "http://ftp.gnu.org/pub/gnu/gnash/$(get_pkg_ver ${GNASH})"
+fpkg -v 0 ${GNASH} "http://ftp.gnu.org/pub/gnu/gnash"
 
 fpkg -e "tar.gz" ${LIBSPF2} "http://libspf2.org/spf"
 fpkg -e "tgz" ${MILTER_GREYLIST} "ftp://ftp.espci.fr/pub/milter-greylist"
@@ -223,13 +220,14 @@ fpkg -m sf -e "tar.xz" ${PCMANFM}
 fpkg -m gnome ${LIBGSF}
 fpkg -m gnome ${GOFFICE}
 fpkg -m gnome ${GNUMERIC}
-fpkg -e "tar.gz" ${WV} "${ABIWORD_URL}/wv/$(get_pkg_ver ${WV})"
+fpkg -e "tar.gz" -v 0 ${WV} "${ABIWORD_URL}/wv"
 fpkg -e "tar.gz" ${ABIWORD} \
     "${ABIWORD_URL}/abiword/$(get_pkg_ver ${ABIWORD})/source"
 
 #fpkg_mis   ${SPLINT} "${SPLINT}.src" "http://splint.org/downloads"
 
-fpkg -e "tar.gz" ${GEDA_GAF} "http://ftp.geda-project.org/geda-gaf/stable/v$(get_pkg_ver2 ${GEDA_GAF})/$(get_pkg_ver ${GEDA_GAF})"
+fpkg -e "tar.gz" -s "v$(get_pkg_ver2 ${GEDA_GAF})/" -v 0 ${GEDA_GAF} \
+     "http://ftp.geda-project.org/geda-gaf/stable"
 
 fpkg -e "tar.gz" ${AVRDUDE} "http://download.savannah.gnu.org/releases/avrdude"