@@ -6,23 +6,102 @@ outdir ?= $(CURDIR)
66srpm :
77 @test -f " $( spec) " || { echo " Spec file not found: $( spec) " ; exit 1; }
88 @mkdir -p " $( outdir) "
9- @name=$$(sed -n 's/^Name:[[:space:]]*//p' "$(spec ) " | head -n1 ) ; \
10- version=$$(sed -n 's/^Version:[[:space:]]*//p' "$(spec ) " | head -n1 ) ; \
9+ @name=$$(rpmspec -q --srpm --qf '%{name}\n' "$(spec ) " 2>/dev/null | head -n1 || true ) ; \
10+ version=$$(rpmspec -q --srpm --qf '%{version}\n' "$(spec ) " 2>/dev/null | head -n1 || true ) ; \
11+ if [ -z " $$ name" ] || echo " $$ name" | grep -q ' %' ; then \
12+ name=$$(sed -n 's/^Name:[[:space:]]*//p' "$(spec ) " | head -n1 ) ; \
13+ fi ; \
14+ if [ -z " $$ version" ] || echo " $$ version" | grep -q ' %' ; then \
15+ pub_version=$$(awk '/^version:/ {print $$2; exit}' pubspec.yaml ) ; \
16+ version=$$ {pub_version%%+* }; \
17+ fi ; \
1118 test -n " $$ name" && test -n " $$ version" || { echo " Unable to parse Name/Version from $( spec) " ; exit 1; }; \
1219 tarball=" $( outdir) /$$ name-$$ version.tar.gz" ; \
1320 staging=" $( outdir) /.copr-srpm-tmp" ; \
14- rm -rf " $$ staging" ; \
15- mkdir -p " $$ staging/$$ name-$$ version" ; \
16- echo " Generating $$ tarball from checked out sources" ; \
17- cp -a . " $$ staging/$$ name-$$ version/" ; \
18- rm -rf " $$ staging/$$ name-$$ version/.git" \
19- " $$ staging/$$ name-$$ version/dist" \
20- " $$ staging/$$ name-$$ version/build" \
21- " $$ staging/$$ name-$$ version/outputs" \
22- " $$ staging/$$ name-$$ version/linux/__pycache__" ; \
23- tar -C " $$ staging" -czf " $$ tarball" " $$ name-$$ version" ; \
24- rm -rf " $$ staging" ; \
25- echo " Building SRPM into $( outdir) " ; \
21+ rm -rf " $$ staging" ; \
22+ echo " Generating $$ tarball from checked out sources" ; \
23+ if git rev-parse --is-inside-work-tree > /dev/null 2>&1 && git rev-parse --verify HEAD > /dev/null 2>&1 ; then \
24+ git archive --worktree-attributes --format=tar --prefix=" $$ name-$$ version/" HEAD | gzip -cn > " $$ tarball" ; \
25+ else \
26+ mkdir -p " $$ staging/$$ name-$$ version" ; \
27+ rsync -a --delete \
28+ --exclude " .git" \
29+ --exclude " .git/" \
30+ --exclude " .idea" \
31+ --exclude " .idea/" \
32+ --exclude " .codex" \
33+ --exclude " .codex/" \
34+ --exclude " .agents" \
35+ --exclude " .agents/" \
36+ --exclude " .dart_tool" \
37+ --exclude " .dart_tool/" \
38+ --exclude " .pub-cache" \
39+ --exclude " .pub-cache/" \
40+ --exclude " .pub" \
41+ --exclude " .pub/" \
42+ --exclude " build" \
43+ --exclude " build/" \
44+ --exclude " coverage" \
45+ --exclude " coverage/" \
46+ --exclude " COPR.md" \
47+ --exclude " docs/old" \
48+ --exclude " docs/old/" \
49+ --exclude " docs/road.md" \
50+ --exclude " docs/road-plan.md" \
51+ --exclude " docs/git-yukleme-notu.md" \
52+ --exclude " docs/grafik-driver-politikasi.md" \
53+ --exclude " docs/profesyonel-installer-ana-plani.md" \
54+ --exclude " docs/ro-apps-packaging-notu.md" \
55+ --exclude " docs/siyah-ekran-kernel-notlari.md" \
56+ --exclude " docs/sonraki-adim-notu.md" \
57+ --exclude " docs/yeni-makine-qemu-rehberi.md" \
58+ --exclude " durum.md" \
59+ --exclude " eksikler.md" \
60+ --exclude " gerçeksistemdenloglar" \
61+ --exclude " gerçeksistemdenloglar/" \
62+ --exclude " implementation_plan.md" \
63+ --exclude " kernel-black-screen-diagnostics.md" \
64+ --exclude " optimizasyon.md" \
65+ --exclude " plan.md" \
66+ --exclude " test.md" \
67+ --exclude " outputs" \
68+ --exclude " outputs/" \
69+ --exclude " rpm-outputs" \
70+ --exclude " rpm-outputs/" \
71+ --exclude " iso-release" \
72+ --exclude " iso-release/" \
73+ --exclude " iso-realese" \
74+ --exclude " iso-realese/" \
75+ --exclude " linux/flutter/ephemeral" \
76+ --exclude " linux/flutter/ephemeral/" \
77+ --exclude " __pycache__" \
78+ --exclude " __pycache__/" \
79+ --exclude " .copr-srpm-tmp" \
80+ --exclude " .copr-srpm-tmp/" \
81+ --exclude " *.iso" \
82+ --exclude " *.qcow2" \
83+ --exclude " *.fd" \
84+ --exclude " *.rpm" \
85+ --exclude " *.src.rpm" \
86+ --exclude " *.tar.gz" \
87+ --exclude " *.pyc" \
88+ --exclude " *.log" \
89+ --exclude " .git.broken-*" \
90+ --exclude " .git.broken-*/" \
91+ --exclude " stitch_velvet_nebula_installer_redesign" \
92+ --exclude " stitch_velvet_nebula_installer_redesign/" \
93+ ./ " $$ staging/$$ name-$$ version/" ; \
94+ tar --sort=name --mtime=' UTC 1970-01-01' --owner=0 --group=0 --numeric-owner -C " $$ staging" -czf " $$ tarball" " $$ name-$$ version" ; \
95+ rm -rf " $$ staging" ; \
96+ fi ; \
97+ bad=$$(tar -tzf "$$tarball" | grep -E '(^|/ ) (\. git| \. idea| \. codex| \. agents| \. dart_tool| build| coverage| docs/old| gerçeksistemdenloglar| outputs| rpm-outputs| iso-release| iso-realese| linux/flutter/ephemeral| __pycache__)(/| $$ )| (^| /)(COPR| durum| eksikler| implementation_plan| kernel-black-screen-diagnostics| optimizasyon| plan| test)\. md$$ | (^| /)docs/(road| road-plan| git-yukleme-notu| grafik-driver-politikasi| profesyonel-installer-ana-plani| ro-apps-packaging-notu| siyah-ekran-kernel-notlari| sonraki-adim-notu| yeni-makine-qemu-rehberi)\. md$$ | \. (iso| qcow2| fd| rpm| src\. rpm| tar\. gz| pyc| log)$$ ' | head -n 50 || true); \
98+ if [ -n " $$ bad" ]; then \
99+ echo " Source tarball contains forbidden files:" ; \
100+ echo " $$ bad" ; \
101+ exit 1; \
102+ fi ; \
103+ sha256sum " $$ tarball" > " $$ tarball.sha256" ; \
104+ echo " Building SRPM into $( outdir) " ; \
26105 rpmbuild -bs " $( spec) " \
27106 --define " _sourcedir $( outdir) " \
28107 --define " _srcrpmdir $( outdir) "
0 commit comments