From f2bc51d6abaf8d6c5bb665b996673a372f6b9e97 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Thu, 29 Apr 2021 14:25:53 -0400 Subject: add git-helper, and README --- for-repo/README.md | 25 +++++++++++++++++++++++++ scripts/git-helper.sh | 36 ++++++++++++++++++++++++++++++++++++ scripts/prep-librewolf-rpm.sh | 9 +++++---- 3 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 for-repo/README.md create mode 100755 scripts/git-helper.sh diff --git a/for-repo/README.md b/for-repo/README.md new file mode 100644 index 0000000..ffbd251 --- /dev/null +++ b/for-repo/README.md @@ -0,0 +1,25 @@ +# README for librewolf-fedora-ff + +## Overview +After using the [prep-librewolf-rpm.sh](https://gitlab.com/bgstack15/librewolf-fedora) script, a modified copy of Fedora Firefox src.rpm git repo exists on the local filesystem. + +If this README.md exists in a directory named `for-repo`, then it is still in its source location from the above link, and not in its final location. + +## This repository +This README file belongs in the modified copy of that Fedora Firefox src.rpm [git repository](https://src.fedoraproject.org/rpms/firefox). That modified git repo can be sent up to a [new web location](https://gitlab.com/bgstack15/librewolf-fedora-ff). + +Fedora [COPR](https://copr.fedorainfracloud.org/coprs/bgstack15/AfterMozilla/packages/) can then use rpkg to pull this new git repository, so users do not have to upload the 400MB src.rpm manually. + +## Using this repository +Script `git-helper.sh` included in the [librewolf-fedora](https://gitlab.com/bgstack15/librewolf-fedora) repository will add the new git repo for librewolf-fedora-ff and fix the .gitignore. + +## Differences from upstream repo +The Librewolf rpm git repo makes some changes to the Firefox rpm git repo. +Files are added or modified: +* this README.md +* .gitignore +* librewolf.spec +* LibreWolf patches that are not named here +* a few tarballs omitted from upstream git sources: + * cbindgen-vendor.tar.xz + * `firefox-langpacks-*.tar.xz` diff --git a/scripts/git-helper.sh b/scripts/git-helper.sh new file mode 100755 index 0000000..20c3aad --- /dev/null +++ b/scripts/git-helper.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# Purpose: help librewolf-fedora-ff modified git repo by adding its readme and useful git config +# Startdate: 2021-04-29 +# Dependencies: +# git + +##################################### +# Load settings +# basically, dot-source the conf file. +test -z "${librewolf_rpm_conf}" && export librewolf_rpm_conf="$( find "$( dirname "${0}" )" -maxdepth 2 -name "prep-librewolf-rpm.conf" -print 2>/dev/null | head -n1 )" +test ! -r "${librewolf_rpm_conf}" && { echo "Unable to load config file, which should be named prep-librewolf-rpm.conf. Aborted." 1>&2 ; exit 1 ; } +. "${librewolf_rpm_conf}" +script_dir="$( dirname "$( readlink -f "${0}" )" )" + +# switch to target directory +src_rpm_dir=${CI_PROJECT_DIR}/${firefox_version}/git +cd "${src_rpm_dir}" +if test "$( git remote -v | awk '$1=="origin" && $3~/fetch/{print $2}' )" != "https://src.fedoraproject.org/rpms/firefox/" ; then + echo "Cannot find git repo that cloned https://src.fedoraproject.org/rpms/firefox/. Aborted." 1>&2 + exit 1 +fi +if ! test -f librewolf.spec ; then + echo "Cannot determine that prep-librewolf-rpm.sh has run yet! Where is librewolf.spec?" 1>&2 + exit 1 +fi +# So if we get here, we're in the right spot + +# Make file changes +cp -p "${script_dir}/../for-repo/README.md" . +sed -i -r .gitignore \ + -e '/cbindgen-vendor/d' +grep -qE '\*\.spec\?' .gitignore || echo '*.spec?' >> .gitignore + +# Add git remote +git remote add gitlab https://gitlab.com/bgstack15/librewolf-fedora-ff.git +git pull --all diff --git a/scripts/prep-librewolf-rpm.sh b/scripts/prep-librewolf-rpm.sh index 1d6ddb2..7462109 100755 --- a/scripts/prep-librewolf-rpm.sh +++ b/scripts/prep-librewolf-rpm.sh @@ -178,10 +178,11 @@ sed -i -r librewolf.spec \ -e '- Fork to librewolf release.\' -e '' # upstream fedora firefox src.rpm lists some sources which are only used inside if-endif blocks -# Also, fix %files list +# Also, fix %files list, and make langpacks disabled by default sed -i -r librewolf.spec \ -e '/^Source[0-9]+:.*mochitest-python\.tar/{i%if 0' -e 'a%endif' -e '}' \ - -e '/^%files -f/,/^%change/{' -e '/_bindir|mozappdir|\/icons/{/browser/!{s/firefox/librewolf/g;}}}' + -e '/^%files -f/,/^%change/{' -e '/_bindir|mozappdir|\/icons/{/browser/!{s/firefox/librewolf/g;}}}' \ + -e '/%bcond_with(out)? langpacks/s/_without/_with/;' if test -z "${SKIP_SRC_RPM}" ; then if test -f "firefox-${firefox_version}.source.tar.xz" || test -z "${SKIP_SPECTOOL}" ; then @@ -191,8 +192,8 @@ if test -z "${SKIP_SRC_RPM}" ; then # Unfortunately the version available may not be identical to what is in src.fedoraproject.org cd "${work_dir}" ; dnf download --source firefox this_srcrpm="$( find . -iname 'firefox-*.src.rpm' -printf '%f\n' | sort | tail -n1 )" - # find the tarballs closest to these expressions: firefox-langpacks cbindgen-vendor - cd "${src_rpm_dir}" ; rpm2cpio "${work_dir}/${this_srcrpm}" | cpio -idm $( spectool -l --sources "${src_rpm_dir}/librewolf.spec" | awk '$NF ~/z$/ && $NF ~ /cbindgen|langpacks/{print $NF}' ) + # find the tarballs closest to these expressions: cbindgen-vendor + cd "${src_rpm_dir}" ; rpm2cpio "${work_dir}/${this_srcrpm}" | cpio -idm $( spectool -l --sources "${src_rpm_dir}/librewolf.spec" | awk '$NF ~/z$/ && $NF ~ /cbindgen/{print $NF}' ) # I only know how to get rpmbuild to pull sources from ~/rpmbuild/SOURCES mkdir -p ~/rpmbuild/SOURCES cd "${src_rpm_dir}" ; cp -pf * ~/rpmbuild/SOURCES ; -- cgit