Procházet zdrojové kódy

introduce a vendor system to change sources.list

Many derivatives make quiet a few simple changes to apt introducing
silly diffs just to change examples and co making it harder for
them to update apt and harder for us to merge real changes back.

First stop: doc/examples/sources.list
David Kalnischkies před 12 roky
rodič
revize
eef71f11a5

+ 3 - 0
.gitignore

@@ -35,3 +35,6 @@
 /debian/libapt-pkg*.install
 /debian/libapt-inst*.install
 /debian/libapt-pkg-dev.install
+/vendor/current
+/vendor/debian/sources.list
+/vendor/ubuntu/sources.list

+ 2 - 1
Makefile

@@ -11,6 +11,7 @@ default: startup all
 
 .PHONY: headers library clean veryclean all binary program doc test update-po
 all headers library clean veryclean binary program doc manpages debiandoc test update-po startup dirs:
+	$(MAKE) -C vendor $@
 	$(MAKE) -C apt-pkg $@
 	$(MAKE) -C apt-inst $@
 	$(MAKE) -C apt-private $@
@@ -20,7 +21,7 @@ all headers library clean veryclean binary program doc manpages debiandoc test u
 	$(MAKE) -C dselect $@
 	$(MAKE) -C doc $@
 	$(MAKE) -C po $@
-	$(MAKE) -C test $@ 
+	$(MAKE) -C test $@
 
 all headers library clean veryclean binary program doc manpages debiandoc test update-po: startup dirs
 

+ 2 - 2
doc/apt-verbatim.ent

@@ -221,11 +221,11 @@
 <!-- this will be updated by 'prepare-release' -->
 <!ENTITY apt-product-version "0.9.7.6ubuntu2">
 
-<!-- Codenames for debian releases -->
+<!-- (Code)names for various things used all over the place -->
 <!ENTITY oldstable-codename "squeeze">
 <!ENTITY stable-codename "wheezy">
 <!ENTITY testing-codename "jessie">
-<!ENTITY stable-version "7.0">
+<!ENTITY stable-version "7">
 <!ENTITY ubuntu-codename "precise">
 
 <!-- good and bad just refers to matching and not matching a pattern…

+ 8 - 4
doc/makefile

@@ -12,8 +12,9 @@ include $(DEBIANDOC_H)
 
 doc: manpages debiandoc
 
-examples/sources.list: examples/sources.list.in apt-verbatim.ent
-	sed -e 's#&stable-codename;#$(shell grep --max-count=1 '^<!ENTITY stable-codename "' apt-verbatim.ent | cut -d'"' -f 2)#g' examples/sources.list.in > examples/sources.list
+examples/sources.list: ../vendor/current/sources.list
+	ln -sf $(shell readlink -f $^) $@
+
 
 # Examples
 SOURCE = examples/apt.conf examples/sources.list examples/configure-index examples/apt-https-method-example.conf
@@ -23,8 +24,8 @@ include $(COPY_H)
 
 .PHONY: clean clean/subdirs veryclean veryclean/subdirs manpages/subdirs debiandoc/subdirs all binary doc stats
 
-clean: clean/subdirs
-veryclean: veryclean/subdirs
+clean: clean/subdirs clean/examples
+veryclean: veryclean/subdirs clean/examples
 manpages: manpages/subdirs
 debiandoc: debiandoc/subdirs
 
@@ -41,6 +42,9 @@ debiandoc/subdirs manpages/subdirs clean/subdirs veryclean/subdirs:
 		$(MAKE) -C $$dir $(patsubst %/subdirs,%,$@); \
 	done
 
+clean/examples:
+	rm -f examples/sources.list
+
 stats:
 	for i in po/*.po; do echo -n "$$i: "; msgfmt --output-file=/dev/null --statistics $$i; done
 

+ 11 - 0
vendor/debian/makefile

@@ -0,0 +1,11 @@
+# -*- make -*-
+BASE=../..
+SUBDIR=vendor/debian
+
+# Bring in the default rules
+include ../../buildlib/defaults.mak
+
+doc: sources.list
+
+sources.list: sources.list.in ../../doc/apt-verbatim.ent
+	sed -e 's#&stable-codename;#$(shell grep --max-count=1 '^<!ENTITY stable-codename "' ../../doc/apt-verbatim.ent | cut -d'"' -f 2)#g' $^ > $@

doc/examples/sources.list.in → vendor/debian/sources.list.in


+ 42 - 0
vendor/makefile

@@ -0,0 +1,42 @@
+# -*- make -*-
+BASE=..
+SUBDIR=vendor
+
+# Bring in the default rules
+include ../buildlib/defaults.mak
+
+all headers library binary program doc manpages debiandoc test update-po startup dirs: current
+all: all/subdirs
+binary: binary/subdirs
+doc: doc/subdirs
+clean: clean/subdirs
+veryclean: veryclean/subdirs
+dirs: dirs/subdirs
+
+all/subdirs binary/subdirs doc/subdirs dirs/subdirs:
+	$(MAKE) -C current $(patsubst %/subdirs,%,$@)
+
+clean/subdirs veryclean/subdirs:
+	test ! -e current || $(MAKE) -C current $(patsubst %/subdirs,%,$@)
+
+current:
+	rm -f $@
+	# search for an exact match to use the correct sources.list example
+	find -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | while read DISTRO; do \
+		if dpkg-vendor --is $$DISTRO; then \
+			ln -s $$DISTRO $@; \
+			break; \
+		fi; \
+	done
+	# if we haven't found a specific, look for a deriving in hardcoded order
+	test -e $@ || \
+		(dpkg-vendor --derives-from ubuntu && cp ln -s ubuntu $@ ) || \
+		ln -s debian $@
+
+.PHONY: clean veryclean all binary vendor
+
+clean: clean/current
+
+clean/current:
+	test ! -e current || $(MAKE) -C current clean
+	rm -f current

+ 11 - 0
vendor/ubuntu/makefile

@@ -0,0 +1,11 @@
+# -*- make -*-
+BASE=../..
+SUBDIR=vendor/ubuntu
+
+# Bring in the default rules
+include ../../buildlib/defaults.mak
+
+doc: sources.list
+
+sources.list: sources.list.in ../../doc/apt-verbatim.ent
+	sed -e 's#&ubuntu-codename;#$(shell grep --max-count=1 '^<!ENTITY ubuntu-codename "' ../../doc/apt-verbatim.ent | cut -d'"' -f 2)#g' $^ > $@

+ 10 - 0
vendor/ubuntu/sources.list.in

@@ -0,0 +1,10 @@
+ # See sources.list(5) manpage for more information
+ # Remember that CD-ROMs, DVDs and such are managed through the apt-cdrom tool.
+deb http://us.archive.ubuntu.com/ubuntu &ubuntu-codename; main restricted
+deb-src http://us.archive.ubuntu.com/ubuntu &ubuntu-codename; main restricted
+
+deb http://security.ubuntu.com/ubuntu &ubuntu-codename;-security main restricted
+deb-src http://security.ubuntu.com/ubuntu &ubuntu-codename;-security main restricted
+
+deb http://us.archive.ubuntu.com/ubuntu &ubuntu-codename;-updates main restricted
+deb-src http://us.archive.ubuntu.com/ubuntu &ubuntu-codename;-updates main restricted