Re: Makefile target to download SourceX file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Doug Warner wrote:
> On 08/10/2009 02:14 PM, Todd Zullinger wrote:
>> Would a make target be much simpler than using spectool -g
>> foo.spec?  It wouldn't take much to wrap that, if it would be
>> helpful.
>
> No, it wouldn't be.  spectool is definitely what I was looking for,
> thanks!

Well, in case anyone thinks it would be helpful, here's a quick patch
for Makefile.common to add a few convenient targets (get-sources and
get-patches, as well as get-source-% and get-patch-%, which can be
used to grab selected source and patch files, respectively):

Index: Makefile.common
===================================================================
RCS file: /cvs/extras/common/Makefile.common,v
retrieving revision 1.132
diff -u -p -r1.132 Makefile.common
--- Makefile.common	10 Aug 2009 14:45:16 -0000	1.132
+++ Makefile.common	10 Aug 2009 19:01:49 -0000
@@ -326,6 +326,23 @@ upload new-source new-sources:
 	@echo "FILES variable not set!"
 endif
 
+# Download Source and Patch files via the URL in the spec file
+SPECTOOL ?= $(shell which spectool 2>/dev/null)
+spectool-check:
+	@if [ ! -x "$(SPECTOOL)" ]; then echo "Must have spectool (from the rpmdevtools package) installed"; exit 1; fi
+
+get-sources: spectool-check $(SPECFILE)
+	$(SPECTOOL) --get --sources $(SPECFILE)
+
+get-source-%: spectool-check $(SPECFILE)
+	$(SPECTOOL) --get --source $* $(SPECFILE)
+
+get-patches: spectool-check $(SPECFILE)
+	$(SPECTOOL) --get --patches $(SPECFILE)
+
+get-patch-%: spectool-check $(SPECFILE)
+	$(SPECTOOL) --get --patch $* $(SPECFILE)
+
 # allow overriding buildarch so you can do, say, an i386 build on x86_64
 ifndef BUILDARCH
 BUILDARCH := $(shell rpm --eval "%{_arch}")

I found that spectool currently has a bug if you try to pass multiple
source or patch numbers.  The spectool help says --source x,y is
accepted, but it is not.  The option parsing code enforces the value
passed to --source and --patch be an integer.  A trivial fix for this
may be:

--- spectool~	2008-09-23 11:47:54.000000000 -0400
+++ spectool	2009-08-10 15:04:20.000000000 -0400
@@ -271,8 +271,8 @@
 			'v|verbose' => sub { $verbose++; },
 			'n|dryrun|dry-run' => sub { $dryrun = 1; },
 			'V|version' => sub { $command = 'version'; },
-			's|source=i' => \@sources,
-			'p|patch=i' => \@patches,
+			's|source=s' => \@sources,
+			'p|patch=s' => \@patches,
 			'S|sources' => sub { push @what, 'sources'; },
 			'P|patches' => sub { push @what, 'patches'; },
 			'A|all' => sub { push @what, 'all'; },

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Nothing is so simple that it cannot be misunderstood.
    -- Teague's Paradox

Attachment: pgpMqreRgE9kt.pgp
Description: PGP signature

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux