diff mbox

[2/2] fedora/buildrpm.sh: Add build script for RPMs

Message ID 1484262210-9899-3-git-send-email-prarit@redhat.com
State Superseded
Headers show

Commit Message

Prarit Bhargava Jan. 12, 2017, 11:03 p.m. UTC
This script automatically builds the RPM specified in fwts.spec.
It is built locally in this tree, fwts/fedora/rpm/...

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 fedora/buildrpm.sh |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100755 fedora/buildrpm.sh

Comments

Alex Hung Jan. 12, 2017, 11:53 p.m. UTC | #1
On 2017-01-12 03:03 PM, Prarit Bhargava wrote:
> This script automatically builds the RPM specified in fwts.spec.
> It is built locally in this tree, fwts/fedora/rpm/...
>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> ---
>  fedora/buildrpm.sh |   27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>  create mode 100755 fedora/buildrpm.sh
>
> diff --git a/fedora/buildrpm.sh b/fedora/buildrpm.sh
> new file mode 100755
> index 000000000000..c9a67088432d
> --- /dev/null
> +++ b/fedora/buildrpm.sh
> @@ -0,0 +1,27 @@
> +#!/bin/bash
> +#
> +# Script to build Fedora and Red Hat fwts rpms
> +#
> +# NOTE: release changes should be made directly to the fwts.spec file
> +# and not this script.  This script reads from fwts.spec to determine the
> +# values of major, minor, and submajor values.
> +
> +#setup RPM env
> +RPMBUILD=$(if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
> +	   else echo rpm; fi)
> +RPM="$(pwd)/rpm"
> +mkdir -p $RPM/SOURCES $RPM/BUILD $RPM/SRPMS $RPM/SPECS
> +
> +# get the tarball
> +major=$(cat fwts.spec | grep -m 1 major | awk -F " " ' { print $3 }')
> +minor=$(cat fwts.spec | grep -m 1 minor | awk -F " " ' { print $3 }')
> +subminor=$(cat fwts.spec | grep -m 1 subminor | awk -F " " ' { print $3 }')
> +tarversion="V$major.$minor.$subminor"
> +
> +cd $RPM/SOURCES && curl -O http://fwts.ubuntu.com/release/fwts-${tarversion}.tar.gz
> +
> +# copy the specfile over
> +cp fwts.spec $RPM/SPECS

I ran this on Ubuntu, not on fedora, but it seems it changed directory 
where fwts.spec is not present.  As a result, this fails with "cp: 
cannot stat 'fwts.spec': No such file or directory"


> +
> +# build the rpm
> +$RPMBUILD --define "_sourcedir $RPM/SOURCES" --define "_builddir $RPM/BUILD" --define "_srcrpmdir $RPM/SRPMS" --define "_rpmdir $RPM/RPMS" --define "_specdir $RPM/SPECS" -ba $RPM/SPECS/fwts.spec
>
Prarit Bhargava Jan. 13, 2017, 1:38 p.m. UTC | #2
On 01/12/2017 06:53 PM, Alex Hung wrote:
> On 2017-01-12 03:03 PM, Prarit Bhargava wrote:
>> This script automatically builds the RPM specified in fwts.spec.
>> It is built locally in this tree, fwts/fedora/rpm/...
>>
>> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
>> ---
>>  fedora/buildrpm.sh |   27 +++++++++++++++++++++++++++
>>  1 file changed, 27 insertions(+)
>>  create mode 100755 fedora/buildrpm.sh
>>
>> diff --git a/fedora/buildrpm.sh b/fedora/buildrpm.sh
>> new file mode 100755
>> index 000000000000..c9a67088432d
>> --- /dev/null
>> +++ b/fedora/buildrpm.sh
>> @@ -0,0 +1,27 @@
>> +#!/bin/bash
>> +#
>> +# Script to build Fedora and Red Hat fwts rpms
>> +#
>> +# NOTE: release changes should be made directly to the fwts.spec file
>> +# and not this script.  This script reads from fwts.spec to determine the
>> +# values of major, minor, and submajor values.
>> +
>> +#setup RPM env
>> +RPMBUILD=$(if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
>> +       else echo rpm; fi)
>> +RPM="$(pwd)/rpm"
>> +mkdir -p $RPM/SOURCES $RPM/BUILD $RPM/SRPMS $RPM/SPECS
>> +
>> +# get the tarball
>> +major=$(cat fwts.spec | grep -m 1 major | awk -F " " ' { print $3 }')
>> +minor=$(cat fwts.spec | grep -m 1 minor | awk -F " " ' { print $3 }')
>> +subminor=$(cat fwts.spec | grep -m 1 subminor | awk -F " " ' { print $3 }')
>> +tarversion="V$major.$minor.$subminor"
>> +
>> +cd $RPM/SOURCES && curl -O
>> http://fwts.ubuntu.com/release/fwts-${tarversion}.tar.gz
>> +
>> +# copy the specfile over
>> +cp fwts.spec $RPM/SPECS
> 
> I ran this on Ubuntu, not on fedora, but it seems it changed directory where
> fwts.spec is not present.  As a result, this fails with "cp: cannot stat
> 'fwts.spec': No such file or directory"
> 

You're right.  I had a rpm/SPECS/fwts.spec left over from previous testing and
didn't catch this error.

Alex, sorry if I've asked this before: what is the appropriate way to post a v2
on fwts-devel?  Can I just do a v2 of 2/2 or repost v2 of the entire patchset?

P.

> 
>> +
>> +# build the rpm
>> +$RPMBUILD --define "_sourcedir $RPM/SOURCES" --define "_builddir $RPM/BUILD"
>> --define "_srcrpmdir $RPM/SRPMS" --define "_rpmdir $RPM/RPMS" --define
>> "_specdir $RPM/SPECS" -ba $RPM/SPECS/fwts.spec
>>
> 
>
Prarit Bhargava Jan. 13, 2017, 1:54 p.m. UTC | #3
On 01/13/2017 08:38 AM, Prarit Bhargava wrote:
> On 01/12/2017 06:53 PM, Alex Hung wrote:
>> On 2017-01-12 03:03 PM, Prarit Bhargava wrote:
>>> This script automatically builds the RPM specified in fwts.spec.
>>> It is built locally in this tree, fwts/fedora/rpm/...
>>>
>>> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
>>> ---
>>>  fedora/buildrpm.sh |   27 +++++++++++++++++++++++++++
>>>  1 file changed, 27 insertions(+)
>>>  create mode 100755 fedora/buildrpm.sh
>>>
>>> diff --git a/fedora/buildrpm.sh b/fedora/buildrpm.sh
>>> new file mode 100755
>>> index 000000000000..c9a67088432d
>>> --- /dev/null
>>> +++ b/fedora/buildrpm.sh
>>> @@ -0,0 +1,27 @@
>>> +#!/bin/bash
>>> +#
>>> +# Script to build Fedora and Red Hat fwts rpms
>>> +#
>>> +# NOTE: release changes should be made directly to the fwts.spec file
>>> +# and not this script.  This script reads from fwts.spec to determine the
>>> +# values of major, minor, and submajor values.
>>> +
>>> +#setup RPM env
>>> +RPMBUILD=$(if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
>>> +       else echo rpm; fi)
>>> +RPM="$(pwd)/rpm"
>>> +mkdir -p $RPM/SOURCES $RPM/BUILD $RPM/SRPMS $RPM/SPECS
>>> +
>>> +# get the tarball
>>> +major=$(cat fwts.spec | grep -m 1 major | awk -F " " ' { print $3 }')
>>> +minor=$(cat fwts.spec | grep -m 1 minor | awk -F " " ' { print $3 }')
>>> +subminor=$(cat fwts.spec | grep -m 1 subminor | awk -F " " ' { print $3 }')
>>> +tarversion="V$major.$minor.$subminor"
>>> +
>>> +cd $RPM/SOURCES && curl -O
>>> http://fwts.ubuntu.com/release/fwts-${tarversion}.tar.gz
>>> +
>>> +# copy the specfile over
>>> +cp fwts.spec $RPM/SPECS
>>
>> I ran this on Ubuntu, not on fedora, but it seems it changed directory where
>> fwts.spec is not present.  As a result, this fails with "cp: cannot stat
>> 'fwts.spec': No such file or directory"
>>
> 
> You're right.  I had a rpm/SPECS/fwts.spec left over from previous testing and
> didn't catch this error.
> 
> Alex, sorry if I've asked this before: what is the appropriate way to post a v2
> on fwts-devel?  Can I just do a v2 of 2/2 or repost v2 of the entire patchset?
> 

The answer doesn't matter :) -- I have to change both patches so I'm doing an
entire repost anyway.

P.
Alex Hung Jan. 13, 2017, 6:30 p.m. UTC | #4
On Fri, Jan 13, 2017 at 5:54 AM, Prarit Bhargava <prarit@redhat.com> wrote:

> On 01/13/2017 08:38 AM, Prarit Bhargava wrote:
> > On 01/12/2017 06:53 PM, Alex Hung wrote:
> >> On 2017-01-12 03:03 PM, Prarit Bhargava wrote:
> >>> This script automatically builds the RPM specified in fwts.spec.
> >>> It is built locally in this tree, fwts/fedora/rpm/...
> >>>
> >>> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> >>> ---
> >>>  fedora/buildrpm.sh |   27 +++++++++++++++++++++++++++
> >>>  1 file changed, 27 insertions(+)
> >>>  create mode 100755 fedora/buildrpm.sh
> >>>
> >>> diff --git a/fedora/buildrpm.sh b/fedora/buildrpm.sh
> >>> new file mode 100755
> >>> index 000000000000..c9a67088432d
> >>> --- /dev/null
> >>> +++ b/fedora/buildrpm.sh
> >>> @@ -0,0 +1,27 @@
> >>> +#!/bin/bash
> >>> +#
> >>> +# Script to build Fedora and Red Hat fwts rpms
> >>> +#
> >>> +# NOTE: release changes should be made directly to the fwts.spec file
> >>> +# and not this script.  This script reads from fwts.spec to determine
> the
> >>> +# values of major, minor, and submajor values.
> >>> +
> >>> +#setup RPM env
> >>> +RPMBUILD=$(if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
> >>> +       else echo rpm; fi)
> >>> +RPM="$(pwd)/rpm"
> >>> +mkdir -p $RPM/SOURCES $RPM/BUILD $RPM/SRPMS $RPM/SPECS
> >>> +
> >>> +# get the tarball
> >>> +major=$(cat fwts.spec | grep -m 1 major | awk -F " " ' { print $3 }')
> >>> +minor=$(cat fwts.spec | grep -m 1 minor | awk -F " " ' { print $3 }')
> >>> +subminor=$(cat fwts.spec | grep -m 1 subminor | awk -F " " ' { print
> $3 }')
> >>> +tarversion="V$major.$minor.$subminor"
> >>> +
> >>> +cd $RPM/SOURCES && curl -O
> >>> http://fwts.ubuntu.com/release/fwts-${tarversion}.tar.gz
> >>> +
> >>> +# copy the specfile over
> >>> +cp fwts.spec $RPM/SPECS
> >>
> >> I ran this on Ubuntu, not on fedora, but it seems it changed directory
> where
> >> fwts.spec is not present.  As a result, this fails with "cp: cannot stat
> >> 'fwts.spec': No such file or directory"
> >>
> >
> > You're right.  I had a rpm/SPECS/fwts.spec left over from previous
> testing and
> > didn't catch this error.
> >
> > Alex, sorry if I've asked this before: what is the appropriate way to
> post a v2
> > on fwts-devel?  Can I just do a v2 of 2/2 or repost v2 of the entire
> patchset?
> >
>
​Either one is fine.

>
> The answer doesn't matter :) -- I have to change both patches so I'm doing
> an
> entire repost anyway.
>
> P.
>
diff mbox

Patch

diff --git a/fedora/buildrpm.sh b/fedora/buildrpm.sh
new file mode 100755
index 000000000000..c9a67088432d
--- /dev/null
+++ b/fedora/buildrpm.sh
@@ -0,0 +1,27 @@ 
+#!/bin/bash
+#
+# Script to build Fedora and Red Hat fwts rpms
+#
+# NOTE: release changes should be made directly to the fwts.spec file
+# and not this script.  This script reads from fwts.spec to determine the
+# values of major, minor, and submajor values.
+
+#setup RPM env
+RPMBUILD=$(if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
+	   else echo rpm; fi)
+RPM="$(pwd)/rpm"
+mkdir -p $RPM/SOURCES $RPM/BUILD $RPM/SRPMS $RPM/SPECS
+
+# get the tarball
+major=$(cat fwts.spec | grep -m 1 major | awk -F " " ' { print $3 }')
+minor=$(cat fwts.spec | grep -m 1 minor | awk -F " " ' { print $3 }')
+subminor=$(cat fwts.spec | grep -m 1 subminor | awk -F " " ' { print $3 }')
+tarversion="V$major.$minor.$subminor"
+
+cd $RPM/SOURCES && curl -O http://fwts.ubuntu.com/release/fwts-${tarversion}.tar.gz
+
+# copy the specfile over
+cp fwts.spec $RPM/SPECS
+
+# build the rpm
+$RPMBUILD --define "_sourcedir $RPM/SOURCES" --define "_builddir $RPM/BUILD" --define "_srcrpmdir $RPM/SRPMS" --define "_rpmdir $RPM/RPMS" --define "_specdir $RPM/SPECS" -ba $RPM/SPECS/fwts.spec