From bf46e04614b3740eea4a5e0d44767f57e1cffa4d Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 10 Jan 2011 13:40:31 -0600 Subject: Remove epoch as an independent field Instead, go the same route we have always taken with version-release in libalpm and treat it all as one piece of information. Makepkg is the only script that knows about epoch as a distinct value; from there on out we will parse out the components as necessary. This makes the code a lot simpler as far as epoch handling goes. The downside here is that we are tossing some compatibility to the wind; packages using force will have to be rebuilt with an incremented epoch to keep their special status. Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 7 +++++-- scripts/repo-add.sh.in | 8 +------- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index a2d9c837..c01ae0cb 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -935,9 +935,12 @@ write_pkginfo() { echo "# $(LC_ALL=C date -u)" echo "pkgname = $1" (( SPLITPKG )) && echo pkgbase = $pkgbase - echo "pkgver = $pkgver-$pkgrel" + if [[ $epoch ]]; then + echo "pkgver = $epoch:$pkgver-$pkgrel" + else + echo "pkgver = $pkgver-$pkgrel" + fi echo "pkgdesc = $pkgdesc" - [[ $epoch ]] && echo "epoch = $epoch" echo "url = $url" echo "builddate = $builddate" echo "packager = $packager" diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 87c7834f..2929c967 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -190,7 +190,7 @@ db_write_entry() { # blank out all variables local pkgfile="$1" - local pkgname pkgver pkgdesc epoch csize size md5sum url arch builddate packager force \ + local pkgname pkgver pkgdesc csize size md5sum url arch builddate packager \ _groups _licenses _replaces _depends _conflicts _provides _optdepends local OLDIFS="$IFS" @@ -274,12 +274,6 @@ db_write_entry() [[ -n $builddate ]] && echo -e "%BUILDDATE%\n$builddate\n" >>desc [[ -n $packager ]] && echo -e "%PACKAGER%\n$packager\n" >>desc write_list_entry "REPLACES" "$_replaces" "desc" - # remain backward-compatible for now; put a force entry in the database - if [[ -n $epoch ]]; then - echo -e "%EPOCH%\n#epoch\n" >>desc - echo -e "%FORCE%\n" >>desc - fi - [[ -n $force ]] && echo -e "%FORCE%\n" >>desc # create depends entry msg2 "$(gettext "Creating 'depends' db entry...")" -- cgit v1.2.3-70-g09d2 From b8ab96a270caa5d589c44c62d5664db156d94af7 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 20 Jan 2011 18:16:06 -0600 Subject: makepkg: encode epoch in version specifier if > 0 This makes things consistent with everywhere else we are incorporating the new optional epoch field. Add a helper function that forms the version string for you and use it in makepkg where I found 'pkgver.*-.*pkgrel'. This exposes a few shortcomings in a previous "Override pkgver" patch (2020e629) in the install package and check if built functions. Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 70 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 24 deletions(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index c01ae0cb..b1b1b75a 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -142,18 +142,20 @@ clean_up() { msg "$(gettext "Cleaning up...")" rm -rf "$pkgdir" "$srcdir" if [[ -n $pkgbase ]]; then + # TODO: this wasn't properly fixed in commit 2020e629 + local fullver=$(get_full_version $epoch $pkgver $pkgrel) # Can't do this unless the BUILDSCRIPT has been sourced. if (( BUILDFUNC )); then - rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-build.log"* + rm -f "${pkgbase}-${fullver}-${CARCH}-build.log"* fi if (( CHECKFUNC )); then - rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-check.log"* + rm -f "${pkgbase}-${fullver}-${CARCH}-check.log"* fi if (( PKGFUNC )); then - rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-package.log"* + rm -f "${pkgbase}-${fullver}-${CARCH}-package.log"* elif (( SPLITPKG )); then for pkg in ${pkgname[@]}; do - rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-package_${pkg}.log"* + rm -f "${pkgbase}-${fullver}-${CARCH}-package_${pkg}.log"* done fi @@ -224,6 +226,19 @@ get_url() { echo "${1#*::}" } +## +# usage : get_full_version( $epoch, $pkgver, $pkgrel ) +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +## +get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi +} + ## # Checks to see if options are present in makepkg.conf or PKGBUILD; # PKGBUILD options always take precedence. @@ -762,7 +777,8 @@ run_function() { local ret=0 local restoretrap if (( LOGGING )); then - local BUILDLOG="${startdir}/${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-$pkgfunc.log" + local fullver=$(get_full_version $epoch $pkgver $pkgrel) + local BUILDLOG="${startdir}/${pkgbase}-${fullver}-${CARCH}-$pkgfunc.log" if [[ -f $BUILDLOG ]]; then local i=1 while true; do @@ -935,11 +951,7 @@ write_pkginfo() { echo "# $(LC_ALL=C date -u)" echo "pkgname = $1" (( SPLITPKG )) && echo pkgbase = $pkgbase - if [[ $epoch ]]; then - echo "pkgver = $epoch:$pkgver-$pkgrel" - else - echo "pkgver = $pkgver-$pkgrel" - fi + echo "pkgver = $(get_full_version $epoch $pkgver $pkgrel)" echo "pkgdesc = $pkgdesc" echo "url = $url" echo "builddate = $builddate" @@ -1052,7 +1064,8 @@ create_package() { "$PKGEXT" ; EXT=$PKGEXT ;; esac - local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}" + local fullver=$(get_full_version $epoch $pkgver $pkgrel) + local pkg_file="$PKGDEST/${nameofpkg}-${fullver}-${PKGARCH}${PKGEXT}" local ret=0 # when fileglobbing, we want * in an empty directory to expand to @@ -1147,7 +1160,8 @@ create_srcpackage() { "$SRCEXT" ;; esac - local pkg_file="$SRCPKGDEST/${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" + local fullver=$(get_full_version $epoch $pkgver $pkgrel) + local pkg_file="$SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT}" # tar it up msg2 "$(gettext "Compressing source package...")" @@ -1179,12 +1193,14 @@ install_package() { msg "$(gettext "Installing %s package group with %s -U...")" "$pkgbase" "$PACMAN" fi - local pkg pkglist + local fullver pkg pkglist for pkg in ${pkgname[@]}; do - if [[ -f $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} ]]; then - pkglist+=" $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" + # TODO: this wasn't properly fixed in commit 2020e629 + fullver=$(get_full_version $epoch $pkgver $pkgrel) + if [[ -f $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT} ]]; then + pkglist+=" $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT}" else - pkglist+=" $PKGDEST/${pkg}-${pkgver}-${pkgrel}-any${PKGEXT}" + pkglist+=" $PKGDEST/${pkg}-${fullver}-any${PKGEXT}" fi done @@ -1806,7 +1822,7 @@ if (( ! ( ASROOT || INFAKEROOT ) && ( DEP_BIN || RMDEPS || INSTALL ) )); then fi fi -unset pkgname pkgbase pkgver pkgrel pkgdesc url license groups provides +unset pkgname pkgbase pkgver pkgrel epoch pkgdesc url license groups provides unset md5sums replaces depends conflicts backup source install changelog build unset makedepends optdepends options noextract @@ -1843,6 +1859,7 @@ if (( GENINTEG )); then fi pkgbase=${pkgbase:-${pkgname[0]}} +epoch=${epoch:-0} # check the PKGBUILD for some basic requirements check_sanity || exit 1 @@ -1880,8 +1897,9 @@ if [[ -n "${PKGLIST[@]}" ]]; then fi if (( ! SPLITPKG )); then - if [[ -f $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} \ - || -f $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-any${PKGEXT} ]] \ + fullver=$(get_full_version $epoch $pkgver $pkgrel) + if [[ -f $PKGDEST/${pkgname}-${fullver}-${CARCH}${PKGEXT} \ + || -f $PKGDEST/${pkgname}-${fullver}-any${PKGEXT} ]] \ && ! (( FORCE || SOURCEONLY || NOBUILD )); then if (( INSTALL )); then warning "$(gettext "A package has already been built, installing existing package...")" @@ -1896,8 +1914,10 @@ else allpkgbuilt=1 somepkgbuilt=0 for pkg in ${pkgname[@]}; do - if [[ -f $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} \ - || -f $PKGDEST/${pkg}-${pkgver}-${pkgrel}-any${PKGEXT} ]]; then + # TODO: this wasn't properly fixed in commit 2020e629 + fullver=$(get_full_version $epoch $pkgver $pkgrel) + if [[ -f $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT} \ + || -f $PKGDEST/${pkg}-${fullver}-any${PKGEXT} ]]; then somepkgbuilt=1 else allpkgbuilt=0 @@ -1949,11 +1969,12 @@ if (( INFAKEROOT )); then exit 0 # $E_OK fi -msg "$(gettext "Making package: %s")" "$pkgbase $pkgver-$pkgrel ($(date))" +fullver=$(get_full_version $epoch $pkgver $pkgrel) +msg "$(gettext "Making package: %s")" "$pkgbase $fullver ($(date))" # if we are creating a source-only package, go no further if (( SOURCEONLY )); then - if [[ -f $SRCPKGDEST/${pkgbase}-${pkgver}-${pkgrel}${SRCEXT} ]] \ + if [[ -f $SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT} ]] \ && (( ! FORCE )); then error "$(gettext "A source package has already been built. (use -f to overwrite)")" exit 1 @@ -2085,7 +2106,8 @@ else fi fi -msg "$(gettext "Finished making: %s")" "$pkgbase $pkgver-$pkgrel ($(date))" +fullver=$(get_full_version $epoch $pkgver $pkgrel) +msg "$(gettext "Finished making: %s")" "$pkgbase $fullver ($(date))" install_package -- cgit v1.2.3-70-g09d2