From e589d617513767c99eb5e35f6fcdf74d6ed6b4fb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 29 Dec 2012 17:29:50 -0500 Subject: fix up both scripts --- moz-normalize-PKGBUILD | 10 ++++++++-- moz-normalize-mozconfig | 49 ++++++++++++++++++++++++++++++------------------- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/moz-normalize-PKGBUILD b/moz-normalize-PKGBUILD index 930c47b..c254d19 100755 --- a/moz-normalize-PKGBUILD +++ b/moz-normalize-PKGBUILD @@ -54,7 +54,7 @@ sort-array() { normalize() { local file=$1 - for var in {make,check,opt,}depends arch license; do + for var in {make,check,}depends arch license; do format-array "$var" "$file" sort-array "$var" "$file" done @@ -63,7 +63,13 @@ normalize() { sed -ri 's/\s+$//' "$file" # generalize - sed -i 's/firefox/$pkgbase/g' "$file" + sed -ri \ + -e 's/([^=])firefox/\1$pkgbase/g' \ + -e 's/\$pkgbase-(install-dir\.patch)/firefox-\1/g' \ + "$file" + if ! grep -q pkgbase= "$file"; then + sed -i '/pkgdesc=/iif [[ -z $pkgbase ]]\; then pkgbase=$pkgname\; fi' "$file" + fi } main() { diff --git a/moz-normalize-mozconfig b/moz-normalize-mozconfig index 62cce3f..92a848d 100755 --- a/moz-normalize-mozconfig +++ b/moz-normalize-mozconfig @@ -16,6 +16,7 @@ classify-lines() { ac_add_options\ --enable-application=*) class=setapp;; .\ *mozconfig) class=setapp;; + *profile-guided-optimization*|*pgo*) class=pgo;; *optimiz*) class=vendor;; ac_add_options\ --*-dirs) class=vendor;; @@ -24,8 +25,9 @@ classify-lines() { ac_add_options\ --prefix=*) class=vendor;; *OFFICIAL*) class=vendor;; - ac_add_options\ --with-*=*) class=appsetting;; - *MOZ_PHOENIX*) class=appsetting;; + ac_add_options\ --with-*=*) class=application;; + ac_add_options\ --*branding*) class=application;; + *MOZ_PHOENIX*) class=application;; ac_add_options\ --*-system-*) class=system;; ac_add_options\ --with-pthreads) class=system;; @@ -36,6 +38,7 @@ classify-lines() { ac_add_options\ --*=*) class=other;; ac_add_options\ --enable-toolkit-*) class=other;; + ac_add_options\ --disable-toolkit-*) class=other;; ac_add_options\ --enable-*) class=feature;; ac_add_options\ --disable-*) class=feature;; @@ -53,13 +56,14 @@ classify-lines() { class_id='' case "$class" in - setapp) class_id=0;; - system) class_id=1;; - feature) class_id=2;; - vendor) class_id=3;; - platform) class_id=4;; - appsetting) class_id=5;; - other) class_id=6;; + setapp) class_id=0;; + system) class_id=1;; + feature) class_id=2;; + vendor) class_id=3;; + platform) class_id=4;; + application) class_id=5;; + other) class_id=6;; + pgo) class_id=7;; *) libremessages error "INVALID CLASS: $class"; exit 1;; esac printf '%s:%s\n' "$class_id" "$line" @@ -75,13 +79,14 @@ format-classes() ( if [[ "$class_id" != "$prev_id" ]]; then echo '' case "$class_id" in - 0) echo '# Set the application';; + 0) :;; 1) echo '# System libraries';; 2) echo '# Features';; 3) echo '# Vendor settings';; 4) echo '# Platform settings';; 5) echo '# Application settings';; 6) echo '# Other';; + 7) echo '# PGO';; esac fi printf '%s\n' "$line" @@ -91,6 +96,20 @@ format-classes() ( echo '# Build-generated' ) +clean() { + sed -r \ + -e '/#\s*(System libraries|Features|Other|PGO)/d' \ + -e '/#\s*(Vendor|Platform|Application) settings/d' \ + -e '/#\s*Build-generated/d' +} +hack() { + sed -r \ + -e '/^\s*$/d' \ + -e '/#\s*(IceCat|Iceweasel)/d' \ + -e '/#\s*(ConnochaetOS|Parabola)/d' \ + -e 's/# (ac_add_options)/#\1/' +} + add-comments() { while read line; do file="$tempdir/comments-$(urlencode "$line")" @@ -105,17 +124,9 @@ add-comments() { fi } -hack() { - sed -r \ - -e '/^\s*$/d' \ - -e '/#\s*(System libraries|Features|Optimization|Build-generated)/d' \ - -e '/#\s*(Icecat|IceWeasel)/d' \ - -e '/#\s*(ConnochaetOS|Parabola)/d' \ - -e 's/# (ac_add_options)/#\1/' -} - main() { cat \ + | clean \ | hack \ | classify-lines "$file" \ | sort \ -- cgit v1.2.3-2-g168b