upgrade-wary-pkgs-from-t2 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #!/bin/sh
  2. #sept 2011. creating wary 5.2pre, with new pkgs compiled in t2, need to upgrade all the existing ones.
  3. #note, i previously setup woof for building a t2 system and ran 0pre, 0setup and 2createpackages,
  4. #which created 'packages-t2test' (the same thing as 'packages-wary'), then i changed back to a wary build.
  5. #the t2 setup also created 'Packages-t2-9-official'.
  6. #120812 db category now allows optional subcategory (for which an icons exists in /usr/local/lib/X11/mini-icons).
  7. echo "Need to manually check contents again originals..." > WARNING_NEW_VERSIONS
  8. echo "deleting prior ../pet-construction/pet_packages-wary5-WARY52 ..."
  9. rm -rf ../pet-construction/pet_packages-wary5-WARY52 2>/dev/null
  10. sync
  11. echo "...done"
  12. mkdir -p ../pet-construction/pet_packages-wary5-WARY52
  13. echo "Copying all old wary pkgs to ../pet-construction/pet_packages-wary5-WARY52 ..."
  14. cp -a ../pet-construction/pet_packages-wary5/* ../pet-construction/pet_packages-wary5-WARY52/
  15. sync
  16. rm -f ../pet-construction/pet_packages-wary5-WARY52/*.pet
  17. sync
  18. echo "...done"
  19. cp -f Packages-puppy-wary5-official Packages-puppy-wary5-official-WARY52
  20. #120812 subcategory...
  21. #db fields: pkgname|nameonly|version|pkgrelease|category[;subcategory]|size|path|fullfilename|dependencies|description|compileddistro|compiledrelease|repo|
  22. rm -f t2laterversions 2>/dev/null
  23. cat Packages-t2-9-official |
  24. while read ALINE
  25. do
  26. DB_nameonly1="`echo -n "$ALINE" | cut -f 2 -d '|'`"
  27. DB_version1="`echo -n "$ALINE" | cut -f 3 -d '|'`"
  28. nPTNexe="|${DB_nameonly1}|"
  29. nPTNdev="|${DB_nameonly1}_DEV|"
  30. nPTNdoc="|${DB_nameonly1}_DOC|"
  31. nPTNnls="|${DB_nameonly1}_NLS|"
  32. for nPTN1 in $nPTNexe $nPTNdev $nPTNdoc $nPTNnls
  33. do
  34. DB_version2="`grep "$nPTN1" Packages-puppy-wary5-official | tail -n 1 | cut -f 3 -d '|'`"
  35. [ "$DB_version2" = "" ] && continue
  36. NAMEONLY="`echo -n "$nPTN1" | tr -d '|'`" #convert ex1: |abiword| to abiword ex2: |abiword_DEV| to abiword_DEV
  37. DB_fullfilenamex="`grep "$nPTN1" Packages-puppy-wary5-official | tail -n 1 | cut -f 8 -d '|' | sed -e 's%\.pet$%%'`"
  38. #NEWNAME="`echo -n "$DB_fullfilenamex" | sed -e 's%$%-w52%' -e 's%-w5-w52$%-w52%'`" #append -w52 to pkg name.
  39. NEWNAME="`echo -n "$DB_fullfilenamex" | sed -e 's%-w5$%-w52%'`" #change -w5 to -w52
  40. if [ -d packages-t2test/${NAMEONLY} -a "$DB_fullfilenamex" ];then
  41. if [ -d ../pet-construction/pet_packages-wary5/${DB_fullfilenamex} ];then
  42. echo "$NAMEONLY"
  43. #truncate versions to same length...
  44. DB_version2x="`echo -n "$DB_version2" | cut -f 1 -d '-' | cut -f 1 -d '_'`"
  45. DB_version1x="`echo -n "$DB_version1" | cut -f 1 -d '-' | cut -f 1 -d '_'`"
  46. if vercmp $DB_version1x eq $DB_version2x;then
  47. #copy the original pkg to a new place...
  48. rm -rf ../pet-construction/pet_packages-wary5-WARY52/${DB_fullfilenamex} #get rid of old one.
  49. cp -a ../pet-construction/pet_packages-wary5/${DB_fullfilenamex} ../pet-construction/pet_packages-wary5-WARY52/${NEWNAME}
  50. #now copy the files from the t2 pkgs...
  51. sPTN="s%../pet-construction/pet_packages-wary5-WARY52/${NEWNAME}/%%"
  52. find ../pet-construction/pet_packages-wary5-WARY52/${NEWNAME} -type f | sed -e "$sPTN" |
  53. while read ONEFND
  54. do
  55. ONEDIR="`dirname "$ONEFND"`"
  56. #mkdir -p ../pet-construction/pet_packages-wary5-WARY52/${NEWNAME}/${ONEDIR}
  57. if [ -f "packages-t2test/${NAMEONLY}/${ONEFND}" ];then
  58. echo " ${ONEFND}"
  59. cp -a -f --remove-destination "packages-t2test/${NAMEONLY}/${ONEFND}" "../pet-construction/pet_packages-wary5-WARY52/${NEWNAME}/${ONEDIR}/"
  60. fi
  61. done
  62. #fix pet.specs...
  63. NEWSPECS="`cat ../pet-construction/pet_packages-wary5-WARY52/${NEWNAME}/pet.specs | tr -d '\n' | tr '|' '\n' | sed -e 's%-w5$%-w52%' -e 's%-w5\.pet$%-w52.pet%' | tr '\n' '|'`"
  64. grep -v "$nPTN1" Packages-puppy-wary5-official-WARY52 > /tmp/ppwo52
  65. mv -f /tmp/ppwo52 Packages-puppy-wary5-official-WARY52
  66. echo "$NEWSPECS" >> Packages-puppy-wary5-official-WARY52
  67. echo "$NEWSPECS" > ../pet-construction/pet_packages-wary5-WARY52/${NEWNAME}/pet.specs
  68. else
  69. if vercmp $DB_version1x gt $DB_version2x;then
  70. #more tricky, version has changed...
  71. NEWNAME="${NAMEONLY}-${DB_version1}-w52" #ex: abiword-2.9.1-w52
  72. NEWVERSION="${DB_version1}-w52"
  73. NEWNAMEONLY="${NAMEONLY}"
  74. NEWPET="${NEWNAME}.pet"
  75. echo "UPDATED PKG: ${NEWNAME}"
  76. echo "PKG:${NAMEONLY} NEW:${DB_version1x} OLD:${DB_version2x}" >> WARNING_NEW_VERSIONS
  77. #copy the t2 pkg to a new place...
  78. mv -f ../pet-construction/pet_packages-wary5-WARY52/${DB_fullfilenamex} ../pet-construction/pet_packages-wary5-WARY52/${DB_fullfilenamex}OLDWARY5PKG #rename the old one. kept for manual comparison.
  79. cp -a packages-t2test/${NAMEONLY} ../pet-construction/pet_packages-wary5-WARY52/${NEWNAME}
  80. #db fields: pkgname|nameonly|version|pkgrelease|category[;subcategory]|size|path|fullfilename|dependencies|description|compileddistro|compiledrelease|repo|
  81. #the t2 spec is $ALINE, however, get it from old wary...
  82. OLDSPEC="`grep "$nPTN1" Packages-puppy-wary5-official | tail -n 1`"
  83. DB_category="`echo -n "$OLDSPEC" | cut -f 5 -d '|' | cut -f 1 -d ';'`" #120812
  84. DB_size="`echo -n "$ALINE" | cut -f 6 -d '|'`"
  85. DB_dependencies="`echo -n "$OLDSPEC" | cut -f 9 -d '|'`"
  86. DB_description="`echo -n "$OLDSPEC" | cut -f 10 -d '|'`"
  87. NEWSPECS="${NEWNAME}|${NEWNAMEONLY}|${NEWVERSION}||${DB_category}|${DB_size}||${NEWPET}|${DB_dependencies}|${DB_description}|puppy|wary5||"
  88. grep -v "$nPTN1" Packages-puppy-wary5-official-WARY52 > /tmp/ppwo52
  89. mv -f /tmp/ppwo52 Packages-puppy-wary5-official-WARY52
  90. echo "$NEWSPECS" >> Packages-puppy-wary5-official-WARY52
  91. echo "$NEWSPECS" > ../pet-construction/pet_packages-wary5-WARY52/${NEWNAME}/pet.specs
  92. fi
  93. fi
  94. else
  95. echo "WARNING: packages-t2test/${NAMEONLY} DOES NOT EXIST"
  96. fi
  97. fi
  98. sync
  99. done
  100. done
  101. sort Packages-puppy-wary5-official-WARY52 > /tmp/ppwo52
  102. mv -f /tmp/ppwo52 Packages-puppy-wary5-official-WARY52
  103. ###END###